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

Adding and removing series dynamically on multi-axis chart causes redraw error #8075

Closed
gbenthomas opened this Issue Mar 23, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@gbenthomas

gbenthomas commented Mar 23, 2018

Expected behaviour

Adding and removing series with separate yAxis should work properly in the following steps:

  1. Create yAxis1 and series1. Set series1.yAxis = 1 (index of yAxis1)
  2. Update all yAxis offsets
  3. Create yAxis2 and series2. Set series2.yAxis = 2 (index of yAxis2)
  4. Update all yAxis offsets
  5. Remove yAxis1 (and corresponding series)
  6. Update all yAxis offsets
  7. Create yAxis3 and series3. Set series3.yAxis = 2 (index of yAxis3 since yAxis1 was removed)
  8. Update all yAxis offsets
  9. Remove yAxis3 (and corresponding series)

Actual behaviour

In step 7 above, series3 gets associated with yAxis2 and yAxis3 which should not happen.
Subsequently, in step 9, redrawing causes the error (in Chrome):
Uncaught TypeError: Cannot read property 'isDirty' of undefined

Note that removing step 6 prevents this error so it seems to be related to the yAxis.update() call.

Live demo with steps to reproduce

http://jsfiddle.net/nrh3o8cr/

Click on the "Add/Remove Series" button which executes the steps listed above.

Product version

Highstock 6.0.7

Affected browser(s)

Chrome, Firefox, IE

@pawelfus

This comment has been minimized.

Contributor

pawelfus commented Mar 26, 2018

Hi @gbenthomas

Thank you for reporting this bug!

Internal note:
Not related to Highstock, general issue: http://jsfiddle.net/BlackLabel/nrh3o8cr/32/

Workaround:
Reset indexes after each operation: http://jsfiddle.net/BlackLabel/nrh3o8cr/35/

Highcharts.addEvent(Highcharts.Chart.prototype, 'redraw', function() {
  Highcharts.each(this.yAxis, function(axis, i) {
    axis.userOptions.index = axis.options.index = i;
  });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment