mariusmuntean / ChartJs.Blazor

Brings Chart.js charts to Blazor
https://www.iheartblazor.com/
MIT License
676 stars 151 forks source link

Call SetupCompletedCallback.InvokeAsync on Update() #185

Open vouksh opened 3 years ago

vouksh commented 3 years ago

Describe the feature request

I'm using a gradient color scheme on a chart, and discovered that if I update the chart data, everything turns into the base color and the gradient disappears. After some tinkering, I found that if I made a ref to the chart, I can do await _timelineChart.SetupCompletedCallback.InvokeAsync(_timelineChart); And the chart will then re-apply the styling from the javascript. Manually invoking the SetupCompletedCallback method did not achieve anything.

Which charts does this feature request apply to?

All charts

Describe the solution you'd like

When running await chart.Update(), SetupCompletedCallback is re-invoked.

JavaScript equivalent

(Sorry, not well-versed enough in JS to fill this section in)

Describe alternatives you've considered

I'm currently running the invoke manually like SetupTimelineChart(); await _timelineChart.Update(); await _timelineChart.SetupCompletedCallback.InvokeAsync(_timelineChart);

Additional context

Without invoking the SetupCompletedCallback: image image With: image