Reputation: 1
Is it possibile to prevent page scroll to page top when chart is regenerated ?
After the page is loaded with C3 chart, I scrolled to bottom of the page and I have auto generating chart event with latest data for every 10 seconds dring this time scrollbar is moving to top of the page.
Upvotes: 0
Views: 388
Reputation: 11
I had this issue and it was due to the page height changing when the chart was destroyed/redrawn, it was causing the page to go from being a scrollable height to all in one window and had the affect of scrolling to the top. I fixed the issue by setting the min-height of the div containg the chart to be the same size as the drawn chart, so the page was always going to be the same height whether the chart was there or being regenerated.
Upvotes: 1
Reputation: 1080
I assume you are using c3.generate()
to load the latest data.
Why don't you use chart.load()
? This would solve your problem.
//call generate only once
var chart = c3.generate(..)
//refresh your data whenever you want
chart.load({
columns: [ ['data1', 230, 190, 300, 500, 300, 400] ]
});
Upvotes: 1