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

draggable-points module: error on mouseDown if dragPoint (i.e. chart.hoverPoint) does not exist #10131

Closed
Timppe opened this issue Feb 13, 2019 · 1 comment

Comments

@Timppe
Copy link

commented Feb 13, 2019

Expected behaviour

dragPoint's members should not try to be accessed if dragPoint does not exist

Actual behaviour

If the dragPoint is undefined, I get an error because there is no property series on undefined.

Explanation of how this can be achieved

Sadly, I have not produced a demo, but you can see that this will indeed happen in the light of changes made since Highcharts 7.0.2: eb55a74#diff-10a1263170fc907a94f2f1a90814c4c7R2479

Let me explain how this can occur, as it does in our app:
In our app, instead of updating the chart, we destroy it and create a new one with updated options (since this was in our case measured as a more performant option). We have the option to drag points if they are selected. For some reason, after clicking a point to select it (note: we are creating a new chart after this) and keeping the cursor steady, and then clicking or start dragging the point (essentially firing onMouseDown) the hoverPoint doesn't exist, which is when I get this error.

If I move the mouse even the slightest, it seems to update the hoverPoint and I can again happily click or start dragging the point.

However, in a chart where I have much less data, this effect doesn't occur most of the time. Can this be somehow related to how you are adding the point hover events starting from:

// Point hover event. We use a short timeout due to issues with coordinating
?

I understand this behaviour can be hard to debug without a reproducable demo, but I did my best trying to explain it. If I have more time, I might try to create a mini-demo. But at least you can remove the error from occuring :) For now, I have to revert back to 7.0.2 in order to not get this error.

Product version

Highcharts 7.0.3

Affected browser(s)

I'm only using latest chrome

@KacperMadej

This comment has been minimized.

Copy link
Contributor

commented Feb 13, 2019

Hi @Timppe

Thank you for reporting about the problem.

The chart destroy and rebuild on point click is not recommended, but if it throws an error then it's a bug.

Live demo: https://jsfiddle.net/BlackLabel/hLqo0p6b/
Steps:

  1. click on a point
  2. after initial animation click and try to drag the point
  3. error in browser console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.