TorsteinHonsi / Motion-Highcharts-Plugin

17 stars 7 forks source link

Exporting incorrect chart state #6

Closed TorsteinHonsi closed 7 years ago

TorsteinHonsi commented 8 years ago

This issue was first reported at https://github.com/highcharts/highcharts/issues/5196.

See Highcharts official example: http://jsfiddle.net/larsac07/pbezw72b/?utm_source=website&utm_medium=embed&utm_campaign=pbezw72b

Highcharts/maps built with the motion.js as a separate include break the exporting functionality for PNG/JPEG/GIF/JPEG. No matter what state is selected on the play-controls, the exporting function always saves the final state of the chart.

Printing does correctly export the selected state, but glitches the play controls after export.

TorsteinHonsi commented 8 years ago

Interestingly, when you run Series.setData or Point.update, the new values are exported successfully. So what is the Motion plugin doing different?

larsac07 commented 8 years ago

The chart seems to be redrawn after print is called, thus drawn as the last child in the <div id="container">, making the play controls appear on top. This however cannot explain why the last state of the chart is exported as PNG/JPEG/etc.. Motion uses Point.update(), so it should not be any different.

@TorsteinHonsi Does export do anything like reloading the HTML before exporting? I would assume this may set the marker at the default state (this.dataLength - 1), and update the data in the chart accordingly.

TorsteinHonsi commented 8 years ago

Exporting actually builds a whole new chart from the same options, therefore it is important that modified options are reflected in chart.options, series.options, axis.options etc.

larsac07 commented 8 years ago

Alright, I'll have a look at this when my thesis is delivered ;)