trash-and-fire / lightweight-charts-react-wrapper

React wrapper for financial lightweight charts
Other
58 stars 5 forks source link

HistogramSeries does not render as a subcomponent #4

Closed Abcold closed 1 year ago

Abcold commented 1 year ago

I want to use HistogramSeries as a sub component, but when I use use state in the parent component and then pass the value, HistogramSeries does not render, even though the value has been updated

截屏2022-11-04 下午6 22 09
trash-and-fire commented 1 year ago

https://github.com/trash-and-fire/lightweight-charts-react-wrapper#passing-data

By default data represents only the initial data. Any subsequent data update does not update series. If you want to change this behavior please add reactive={true} to your series component. In this case series will apply a new data if it is not reference equal to previous array.

This works perfectly https://codesandbox.io/s/dynamic-volume-tv7ckc?file=/example.tsx

Abcold commented 1 year ago

It worked, thank you