amcharts / amcharts5

The newest, fastest, and most advanced amCharts charting library for JavaScript and TypeScript apps.
Other
345 stars 92 forks source link

Chart series not disposing correctly on dynamic data addition columnseries #1644

Closed Ashishvkale closed 1 month ago

Ashishvkale commented 1 month ago

I'm trying to dispose the previous column serieses to create new ones with dynamic data

Chart getting freezed on the data addition and labels getting faded away Making everything overlap on each other and ended messed up Any idea why its happening ?

Below the codepen for the same I'm trying to dispose the older series before creating new one

https://codepen.io/ashish-kale-ak/pen/RwzKmrw?editors=0010

efitzkiwi commented 1 month ago

You should create a minimal CodeSandbox reproducing this behavior, it is unlikely anyone will know what your issue is. The same can be said for your other issues.

Ashishvkale commented 1 month ago

Sure @efitzkiwi I'll make minimal code CodeSandbox for all

Ashishvkale commented 1 month ago

@efitzkiwi @workingbuddy10 @martynasma Below the codepen for the same I'm trying to dispose the older series before creating new one

https://codepen.io/ashish-kale-ak/pen/RwzKmrw?editors=0010

efitzkiwi commented 1 month ago

@efitzkiwi @workingbuddy10 @martynasma Below the codepen for the same I'm trying to dispose the older series before creating new one

https://codepen.io/ashish-kale-ak/pen/RwzKmrw?editors=0010

You should be using this pattern to remove series, it says v4 but it still works for me in v5... https://www.amcharts.com/docs/v4/tutorials/dynamically-adding-and-removing-series/#Disposing_removed_series Need to remove from the chart too.

chart.series.removeIndex(
  chart.series.indexOf(series_to_remove)
).dispose();
Ashishvkale commented 1 month ago

@efitzkiwi below is the modified version of chart using remove Index method: https://codepen.io/ashish-kale-ak/pen/RwzKmrw

The case : Whenever we dynamically add the data object to data and try to dispose old series and add new everything gets messed up