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

startPoint and showInLegend don't always work well together #7933

pulp260 opened this issue Feb 27, 2018 · 2 comments

startPoint and showInLegend don't always work well together #7933

pulp260 opened this issue Feb 27, 2018 · 2 comments


Copy link

@pulp260 pulp260 commented Feb 27, 2018

  • Set pointStart on a series once.
  • Update series data and set showInLegend to true in one command, or set showInLegend to true first and then set the data.

Expected behaviour

The data is really displayed starting from pointStart on the x-axis

Actual behaviour

The pointStart set once is ignored and the default (i.e. zero) is applied. The data is actually displayed starting from 0 on the x-axis.

Live demo with steps to reproduce

Product version

Highcharts JS v6.0.7 (2018-02-16)

Affected browser(s)


Copy link

@pawelfus pawelfus commented Feb 27, 2018

Hi @pulp260

Thank you for reporting this issue. It looks like setData() does not apply pointStart option properly.

Set pointStart again in the config:

chart.series[0].update({data: data, showInLegend: true, pointStart: chart.series[0].options.pointStart});

Internal note:
We have this lines, which most probably should check if pointStart was not set in the config previously:

// Do the merge, with some forced options
newOptions = merge(oldOptions, animation, {
index: series.index,
pointStart: series.xData[0] // when updating after addPoint
}, { data: }, newOptions);

@pawelfus pawelfus added the Type: Bug label Feb 27, 2018
Copy link

@pulp260 pulp260 commented Feb 27, 2018

Hi @pawelfus

Thank you for your swift answer and the workaround you suggested.
I actually already found another workaround, namely setting the new data first (with setData()) and then updating showInLegend (with update()), like this:

chart.series[0].setData(data, false);
chart.series[0].update({showInLegend: true});

I would expect then to have to pass pointStart: chart.series[0].options.pointStart to the update() call in this case too, if the issue is, like you presume, that the internal code does not check whether pointStart was already set in the config. But strangely enough, the update() call with just {showInLegend: true} as an argument DOES result in a correct (shifted) display of the data, if it is called AFTER setData().

Anyway, that was just an additional note from my side, which might help you debug.
Thanks again.

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
2 participants