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

Series update method() didn't update every series in chart. #6162

Closed
Izothep opened this issue Dec 18, 2016 · 3 comments
Closed

Series update method() didn't update every series in chart. #6162

Izothep opened this issue Dec 18, 2016 · 3 comments
Assignees

Comments

@Izothep
Copy link
Contributor

Izothep commented Dec 18, 2016

Expected behaviour

When iterating over chart series and updating them with new parameters, all series should be updated, not just some of them.

It looks to be working fine in Highstock 4.2.7 version:
http://jsfiddle.net/pv9rqduf/6/

Actual behaviour

It looks that not every series is updating its parameters.

Live demo with steps to reproduce

http://jsfiddle.net/pv9rqduf/7/

Steps to reproduce: click on 'aaa' button, then look on tooltip.

@pawelfus
Copy link
Contributor

Workaround:
Update series, starting from the last one, in a decrementing order: http://jsfiddle.net/pv9rqduf/8/

function updateChartIterator(chart, options) {
  for (var i = chart.series.length - 1; i >= 0; i--) {
    chart.series[i].update(options, false);
  }
  chart.redraw();
}

Internal note:
It's related to auto-updating navigator's series and something is wrong with indexes (note: update actually remove series and recreates it).

@TorsteinHonsi
Copy link
Collaborator

See in this modified demo how we update Series 1, and the Navigator is re-inserted in the wrong place.

@pawelfus
Copy link
Contributor

pawelfus commented Dec 19, 2016

Internal note:
It's caused by this line: when first series is updated then it's index is set to 0. Now, navigator takes index from that series and creates a navigator series with index=0 (options are extended/merged). Because of that, we have wrong order of series. Alternatively we can set chart.series.length as index, but I don't see any reason to add complexity.

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

No branches or pull requests

3 participants