Replies: 1 comment
-
Encountered this last week. Not sure why there hasn't been any activity or a fix for this in past 6 months. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a simple chart generated with ApexCharts v3.45.1. This is on a single page application where when I fetch another page via an AJAX call, the original chart in the DOM is removed on purpose (using knockout's data-bind if statement).
In the stacktrace, it seems the apexchart's redrawOnParentResize is being triggered, and when it finds the node is no longer there, it has a height of "NaN" under:
It's trying to redraw a chart which no longer exists before I even had the time to destroy it.
Spent some time trying to find a resolution. I can set redrawOnParentResize and WindowResize both to false. This fixes the issue, but the chart will not resize dynamically.
I did implement a solution which seems to work by initiating a ResizeObserver BEFORE the chart is rendered. The purpose here is to destroy the chart if it becomes hidden/removed from the DOM.
This doesn't always work and depends on how quick I move to another page before the event gets triggered.
Is this a bug in Apexcharts or is there a better way of handling this?
Beta Was this translation helpful? Give feedback.
All reactions