hansmaad / chartist-plugin-zoom

Zoom Plugin for Chartist.js
Do What The F*ck You Want To Public License
17 stars 15 forks source link

Issues with zooming when updating chart data #11

Open davidmcclelland opened 7 years ago

davidmcclelland commented 7 years ago

I'm using chartist to display data that updates frequently. I've noticed two issues in my development.

First, if the data is updated while in the middle of selecting, the selection box disappears. To counteract this, I disabled updates while the user has the mouse down. This works, but led me to my second issue.

If the chart data is updated while it is zoomed in, the zoom is lost entirely. This may be desired in some situations but is definitely not desired in mine. Perhaps an option to leave zoom persistent would be helpful?

hansmaad commented 7 years ago

How do you update your chart? I cannot reproduce this using chart.update().

davidmcclelland commented 7 years ago

I'm using angular-chartist, and updating the data object that's bound to chartist-data

hansmaad commented 7 years ago

angular-chartist calls this.chart.update(this.data, this.options);. I can confirm, that the zoom is lost in this case. In my test I just call chart.update(); after changing the original data. In that case, the zoom is not lost. I'll try to figure out, how to handle this...