williaster / data-ui

A collection of data-rich UI components 📈

Home Page:https://williaster.github.io/data-ui/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Histogram with pre-binned data

IonaShanks opened this issue · comments

I am unable to get the histogram to display the pre-binned data as I'm getting error about the bar key not being unique. I am not sure where I should be adding the key. - Always only displays the last bar on this histogram
binnedData = {[{ bin0: 0, bin1: 364, count: 1 } , { bin0: 364, bin1: 728, count: 2 }, { bin0: 728, bin1: 1092, count: 3 }]}

"Warning: Encountered two children with the same key, barundefined."
and throws a failure:
"Warning: Failed prop type: Invalid prop binnedData[0] supplied to BarSeries"

@IonaShanks your data should include the field id.You can added with
binnedData=binnedData.map((b,index)=>({...b,id:index}))