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 Error on combination of export and chart.update() #6007

Closed
rstrietzel opened this issue Nov 21, 2016 · 5 comments
Closed

Type Error on combination of export and chart.update() #6007

rstrietzel opened this issue Nov 21, 2016 · 5 comments
Assignees
Labels

Comments

@rstrietzel
Copy link

@rstrietzel rstrietzel commented Nov 21, 2016

Expected behaviour

The chart can be updated and exported multiple times.

Actual behaviour

After an export followed by an update to deactivate the legend on exports clicking anywhere leads to a Type Error: k.setState is not a function.

It's working fine with Highcharts 4.2.2, therefore probably a regression.

Live demo with steps to reproduce

https://jsfiddle.net/jc74psrt/1/

  1. export as png
  2. push the button
  3. clicking anywhere leads to "TypeError: k.setState is not a function"

Affected browser(s)

Firefox, Chrome

@TorsteinHonsi
Copy link
Collaborator

@TorsteinHonsi TorsteinHonsi commented Nov 22, 2016

Internal note:
Chart.update didn't exist in v4.2.2.

@TorsteinHonsi
Copy link
Collaborator

@TorsteinHonsi TorsteinHonsi commented Dec 2, 2016

Observation: We may bypass the error message by checking for button.setState, but the issue then is that the export menu doesn't open the second time, after updating the legend.

@pawelfus
Copy link
Contributor

@pawelfus pawelfus commented Dec 2, 2016

Internal note:
I think the problem is with the event closures:

We recreate the exporting button with all events, except the event with hide() for the context menu - we still use old button reference, because menu = chart[cacheName] exists (no destroying in destroyExport(), simple test: chart['cache-highcharts-contextmenu'] = null; - will show the new context menu, still with the error. Number of errors per click will increase, because everytime we add a new event).

In destroyExport() we can try to remove event removeMouseUp ("destroy" event for a chart is not called when updating the chart, right?) instead of addEvent(chart, 'destroy', removeMouseUp);. How does it sound?

@TorsteinHonsi
Copy link
Collaborator

@TorsteinHonsi TorsteinHonsi commented Dec 5, 2016

Sounds like music to my ears 👍

@yoderexploder
Copy link

@yoderexploder yoderexploder commented Feb 2, 2017

Hello, any update on this problem?

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

Successfully merging a pull request may close this issue.

None yet
4 participants