Hi
I have found a problem when adding and removing series in the chart.
The following happens
i have created 2 series and add them to the chart, i see 2 series in my chart.
Then i remove all series and create and add 3 series. I see 3 series in the chart
Finally i remove all and create 2 series. I see 3 series in the chart
Unfortunatly i am not an expert to simultae this code on the fly but i think i have found where the problem come from.
In BaseChart, when the chart is display the foloowing code is ran
// #2: We need to setup whatever data series needs to be rendered initially in the chartif(seriesList.size()>0){finalJSONValueseriesValue=options.get("series");if(seriesValue==null||seriesValue.isArray()==null){options.put("series",newJSONArray());}finalJSONArrayseriesArray=(JSONArray)options.get("series");for(inti=0,seriesListSize=seriesList.size();i<seriesListSize;i++){Seriesseries=seriesList.get(i);JSONObjectseriesOptions=convertSeriesToJSON(series);seriesArray.set(i,seriesOptions);}}
a quick look show that seriesValue contains the first time 2 entries, then 3 entries, and stays at 3 entries.
The highChart creates and add series by reading this options object (method init() then firstRender())
// Initialize the series
each(options.series || [], function (serieOptions) {
chart.initSeries(serieOptions);
});
Which explain why 3 series are displayed instead of 2.
a simple
highCharts.removeAllSeries(false);
JSONObject options = highCharts.getOptions();
options.put("series", new JSONArray());
will effectivly remove all Series.
Do you think you can correct this fir the futur version ?
thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I have found a problem when adding and removing series in the chart.
The following happens
i have created 2 series and add them to the chart, i see 2 series in my chart.
Then i remove all series and create and add 3 series. I see 3 series in the chart
Finally i remove all and create 2 series. I see 3 series in the chart
Unfortunatly i am not an expert to simultae this code on the fly but i think i have found where the problem come from.
In BaseChart, when the chart is display the foloowing code is ran
a quick look show that seriesValue contains the first time 2 entries, then 3 entries, and stays at 3 entries.
The highChart creates and add series by reading this options object (method init() then firstRender())
// Initialize the series
each(options.series || [], function (serieOptions) {
chart.initSeries(serieOptions);
});
Which explain why 3 series are displayed instead of 2.
a simple
highCharts.removeAllSeries(false);
JSONObject options = highCharts.getOptions();
options.put("series", new JSONArray());
will effectivly remove all Series.
Do you think you can correct this fir the futur version ?
thanks