c3 icon indicating copy to clipboard operation
c3 copied to clipboard

Loading data corrupts chart if previous transition is not finished

Open lblb opened this issue 12 years ago • 3 comments

Hi, I noticed nasty behavior if you quickly load new data without waiting for the end transition. I have a couple of radio buttons in my project, that change the scope of chart, hence user can hit them quickly. It corrupts chart object meaning that any further loading of data does not correct it, but makes even worse. This is especially evident with grouped bar charts, please take a look at fiddle: http://jsfiddle.net/e7ZbT/ Simple bar chart may get to inconsistent state if new data is loaded too quickly, but usually next load fix it, so it's not so critical. In contrast grouped charts cannot be corrected, unless refresh of the page. Any suggestions are very welcome.

lblb avatar Jun 09 '14 15:06 lblb

Hi, I agree to fix this issue. I think this solution might work:

  • Detect duplicated transition
  • If detected, call flush to cancel the transition and draw as transition ends
  • Start transition

This needs to be implemented within c3, but this solution might be able to be done by calling flush before load or some API that generate a transition. I'll try these solution later.

masayuki0812 avatar Jun 10 '14 00:06 masayuki0812

Thanks for looking into this. I tried your suggestion to flush(), but it doesn't really help.
I updated my test case a little: http://jsfiddle.net/e7ZbT/1/

lblb avatar Jun 10 '14 10:06 lblb

Thank you for trying. Umm.. Please give me some time. I'll try looking into this more.

masayuki0812 avatar Jun 11 '14 00:06 masayuki0812