Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C3 Chart Re-Render Issue. #111

Open
amit199309 opened this issue Dec 28, 2021 · 1 comment
Open

C3 Chart Re-Render Issue. #111

amit199309 opened this issue Dec 28, 2021 · 1 comment

Comments

@amit199309
Copy link

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?

@maxwondercorn
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants