NotCoffee418 / TradingView.Blazor

Simple component for basic TradingView chart in Blazor supporting OHLC candle, volume and markers.
Apache License 2.0
36 stars 10 forks source link

How to update chart data? #3

Closed boffman closed 2 years ago

boffman commented 2 years ago

Hi, thanks for a nice module! I'm wondering if it's possible to redraw the chart with new data somehow (like, switch instrument to view)?

Right now if I update the data and run "await myChart.LoadChartAsync(data, options);" again, I get a new chart below the last one.

NotCoffee418 commented 2 years ago

Give me a few hours, i'' see if i can implement a more effective way to append and update data.

NotCoffee418 commented 2 years ago

You should be able to refresh an existing chart now by calling await myChart.UpdateChartAsync(updatedChartData);. You need to pass the new or updated chart data, but options are will be retained from the initial call to LoadChartAsync().

boffman commented 2 years ago

It worked fine - thanks alot!