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

(bug) Animation causes all charts not to render unless resized or forced to reset #394

Open
tonyawad88 opened this issue Jan 23, 2025 · 1 comment

Comments

@tonyawad88
Copy link

Hello,

There is a bug it seems in how charts are rendering in Angular 18 with "apexcharts": "^3.53.0", and "ng-apexcharts": "^1.12.0",. This results in the chart data not rendering and remaining empty as shown in the below gif:

Animation Enabled (note how on refresh, chart loads and then clears):

Image

Animation Disabled:

Image

Temporary Workarounds:

There are a couple of workaround that I came across that seem hacky but have yielded results, each work on its own and no need to combine:

  1. Disable animation on the chart chart: { animations: { enabled : false } }
  2. Use @ViewChild("chart") chart: ChartComponent | undefined; to reference the apex chart and then when the chart options are set, call this.chart.resetSeries()
  3. Use ng-if with a flag to delay rendering until ChartOption has been initialized

All seem hacky, any chance you can provide some guidance on this as to why you think it's happening? If you guide me I can see if I can code a fix.
Cheers.

@tonyawad88
Copy link
Author

This may also have been my fault, as I was emitting an empty array and emitting a full array right after it. I have a BehaviorSubject containing the data to display and on init I was initializing with an empty array instead of undefined and then the data got loaded which caused double renders, animation issues, etc. If someone is running into this, check what you are emitting and how many times are you rendering as it could cause a race.

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

No branches or pull requests

1 participant