KyvisLabs ApexChart Event Handlers

@kyvislabs
Splintering off of this thread I need to get some advice/tips from the devs or anyone who has had success using the animationEnd, mounted, and updated event handlers on the apex chart components of this module.

I’m trying to set a view custom property once chart updates are finished loading, as occasionally my chart data my take a little while to render. During the interim, I use the view custom prop to show a loading graphic superimposed on the chart. However, in testing, the handlers mentioned above all only fire once when the view is loaded, but none ever fire again, regardless of whether the chart series or options are updated at runtime.

According to the docs the animationEnd and mounted handlers behave as I would expect. The updated handler is what I would expect to fire when the chart data is updated. The reference mentions this updated function fires when the updateOptions() or updateSeries() functions are called, but I do not see any way to do this with the apex chart component.

I don’t think you can access those…

These event handlers can be utilized if the appropriate config settings are set:

I am having issues trying to get the right behavior. I have 6 different series on this chart, and i have two series i would like to show / hide depending on the View parameters.
I would like these view parameters to be examined after the data has been refreshed by the data binding, but not if the update event is fired due to toggling the series manually.


Event handlers tested:

animationEnd

Fires when the chart’s initial animation is finished

This gives me the functionality i want, but it looks a bit average to show the series animation, then quickly hide the series. Ideally it wouldn't show on the View at all.

beforeMount

Fires before the chart has been drawn on screen

This works, but only seems to be fired on load of View.
If data on chart is updated, it does not fire again.

mounted

Fires after the chart has been drawn on screen

This works, but only seems to be fired on load of View.
If data on chart is updated, it does not fire again.

updated

Fires when the chart has been dynamically updated either with updateOptions() or updateSeries() function

Kinda works, but if i toggle the series myself, it will fire "updateSeries()" and then force the series off based on the parameter value which is not ideal.


Any thoughts on how to handle this better?
ie: Using View parameters to set the initial state of an Apex Chart series, while still allowing it to be updated via the Apex Chart legend clicking?

2 Likes

Hi,

Is it possible to show a specific message or a loading bar (or an hourglass, whatever ... ) during a serie update ?