ember-c3
ember-c3 copied to clipboard
C3 Chart Re-Render Issue.
C3 chart re-rendering while we switch browser tab reason being original bar color lost. Do we have any mechanism to prevent chart re-rendering either implicitly or explicitly?
I'm not sure why switching browser tabs would cause color loss/re-render. Under the hood it's using didUpdateAttrs
so I'm assuming the component is seeing a data change.
There's no direct way via the component or c3
but there is a backdoor way to prevent rendering using the dtitle
attribute. It's hacky but could possible fix the issue.
The mechanism to change chart titles without refreshing the graph could be used to prevent a refresh. See guard logic in didUpdateAttrs
below. If you had dtitle
set and dtitle .refresh
set to false. the graph won't reload. Even if you are setting the title
attribute you can set dtitle
to the same value
// don't refresh other properties if they cause side effects
if (isEmpty(this.dtitle) || (isPresent(this.dtitle) && this.dtitle.refresh))
debounce(this, this._reload, 360);
It's been on my list for awhile to modernize the component for newer Ember versions. Using the same guard logic above, I could add an attribute that would prevent renders. Hopefully I can start working on the updating after the first of the year.