The documentation of chartJS plugins is available here, however it is incomplete as there is no full description of each of the hooks:
afterInit
beforeUpdate (cancellable)
afterUpdate
beforeLayout (cancellable)
afterLayout
beforeDatasetsUpdate (cancellable)
afterDatasetsUpdate
beforeDatasetUpdate (cancellable)
afterDatasetUpdate
beforeRender (cancellable)
afterRender
beforeDraw (cancellable)
afterDraw
beforeDatasetsDraw (cancellable)
afterDatasetsDraw
beforeDatasetDraw (cancellable)
afterDatasetDraw
beforeEvent (cancellable)
afterEvent
resize
destroy
This list can be summarize to the following functions, yet the order is not clear for me:
- Update
- Layout
- DatasetsUpdate
- DatasetUpdate
- Render
- Draw
- DatasetsDraw
- DatasetDraw
- Event
- resize
- destroy
Some of the names might know what is the order of execution of the hooks.
Use case
I want to implement several behaviours on the charts that activate on certain conditions on the data, as an example, I want to update the legend labels when there is no data available, so, instead of displaying the name of the category in the legend, it would display a message saying no data.
To be sure, I have manage to implement plugins, but since the order is not clear for me, I keep getting things mixed up due to the order.