Type 'spline' changed to 'line' causes problems going to other types after that. #2322
Comments
Workaround: remove defaultSeriesType: http://jsfiddle.net/j932J/1/ |
The problem is that the
Demonstrated here: http://jsfiddle.net/highcharts/W2etK/ A permanent fix would not only resolve this case, but also similar potential cases where a method survives switching where it shouldn't. |
It's because when a Series is created it's given a specific prototype given its type (for example, OHLCSeries). When the type changes, this prototype isn't changed. This is the core issue. You can also reproduce this by creating a Candlestick series and switching it to type Line. |
Yes that's the core issue, but it's not easy to change. So the current approach is to replace all the methods of the prototype object. |
Here's a new demo, probably of the same issue: http://jsfiddle.net/highcharts/97651yvn/5/. The console log shows how a prototype property from Candlestick is first removed, then it appears again on the second time the button is clicked. |
I am using 3.0.6. The specific issue noted in Issue #2270 has been fixed. However, there are other similar problems.
I have 3 series in a chart of type=spline. I can toggle between line and spline correctly. However, when I go from Line to Area I get an AreaSpline instead. And when I click Line I get a Spline instead. Clicking Line after that does nothing. But if I click Spline and THEN click Line the chart is re-drawn correctly.
Similarly, if I click Column it renders correctly. But when I click Line after that it renders a Spline instead.
Same thing for Scatter and Pie charts.
Bottom line - if the chart is first set up as a Spline then you click a button to change it to Line, the renderings of other buttons do not work correctly going forward or coming back to Line.
On the positive side: if the chart starts life as a Line chart then all transitions to other types seem to work correctly.
-Joe
The text was updated successfully, but these errors were encountered: