I have a widget where I can dynamically change the type of the series within the chart (the chart is already rendered when we change its type). This works correctly on all the current series on the plot (s.update(s.setType(type)); for all the series), however, doesn't work for the series that are created after the change (chart.setType(type) should do that)..
My method looks like this:
void changeChartType(Series.Type type) {
for (Series s : this.chart.getSeries()) {
s.update(s.setType(type), false);
}
this.chart.setType(type);
this.chart.redraw();
}
This could be fixed by adding something like the code below to to BaseChart#convertSeriesToJSON(Series) (before the call to copyPointsToJSONArray(); - that's line 2627 in 1.7.0 version source code):
Type seriesType = series.getType();
if (seriesType == null) seriesType = this.defaultSeriesType;
if (seriesOptions.get("type") == null) {
seriesOptions.put("type", new JSONString(seriesType.toString()));
}
However, I'm not if this would be good for all other cases. There might be also some parameters that I don't use right now but that need to be copied to the seriesOptions too.
I wanted also to override BaseChart#convertSeriesToJSON(Series) to test this change, but Series#getType() is not visible outside the package - maybe it could be made public?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a widget where I can dynamically change the type of the series within the chart (the chart is already rendered when we change its type). This works correctly on all the current series on the plot (s.update(s.setType(type)); for all the series), however, doesn't work for the series that are created after the change (chart.setType(type) should do that)..
My method looks like this:
This could be fixed by adding something like the code below to to BaseChart#convertSeriesToJSON(Series) (before the call to copyPointsToJSONArray(); - that's line 2627 in 1.7.0 version source code):
However, I'm not if this would be good for all other cases. There might be also some parameters that I don't use right now but that need to be copied to the seriesOptions too.
I wanted also to override BaseChart#convertSeriesToJSON(Series) to test this change, but Series#getType() is not visible outside the package - maybe it could be made public?