This video will show you how to customize chart.js global options
Global options allow us to config common chart characteristic such as animation speed, behavior, tooltips style and etc.
You can see the full option list at chart.js documentation page
The options are separated into categories like title, tooltips, animation and etc.
For example, if I want to disable the legend, I need to update the legend.display to false
All global options are defined inside Chart.defaults.global
You'll see that now the legend has disappeared.
Since we're changing global option directly, this will be applied to all charts on the page
However, you can override the global setting for a specfic chart by passing that option when you initialize the chart
Now the legend is back for this chart. But if you have another charts, the legend will still be hidden
Let's try another example
I'm going to change the chart animation speed
This time we'll need to access the global.animation class
Let's change the animation.duration to 5000ms
Again, this will be applied to all charts but you can always override it for each chart
Thanks for watching. Please like or subscribe to support us :)
