Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type 'spline' changed to 'line' causes problems going to other types after that. #2322

jfallon1 opened this issue Oct 4, 2013 · 5 comments


Copy link

@jfallon1 jfallon1 commented Oct 4, 2013

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.


Copy link

@pawelfus pawelfus commented Oct 29, 2013

Workaround: remove defaultSeriesType:

Copy link

@TorsteinHonsi TorsteinHonsi commented Oct 31, 2013

The problem is that the getPointSpline method is not removed from the prototype chain when switching. A drop-in workaround is to set it to null on basic series, to make sure it is overwritten when switching from spline:

$(function () {
    Highcharts.Series.prototype.getPointSpline = null;

Demonstrated here:

A permanent fix would not only resolve this case, but also similar potential cases where a method survives switching where it shouldn't.

Copy link

@emmerich emmerich commented Nov 8, 2013

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.

Copy link

@TorsteinHonsi TorsteinHonsi commented Nov 11, 2013

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.

Copy link

@TorsteinHonsi TorsteinHonsi commented Feb 14, 2017

Here's a new demo, probably of the same issue: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants