I'm new to Chart.js, saw the v3 doc:
Chart.js 3 is tree-shakeable, so it is necessary to import and register the controllers, elements, scales, and plugins you are going to use.
I'm wondering where do I find these things for registering, for example, what needs to be registered for this example to work?
You will get an error in your console if you use something that is not imported. If you want to be sure you just have everything and throw away the benefit of tree-shaking you can use this import and register:
Or in one line:
For the example to work, the elements that need to be imported and registered are:
barControllerbarElementcategoryScaleTooltipLegendGenerally speaking for a chart you need its controller so
lineControllerfor line chart,pieControllerfor a pie chart, etc. You need the element so alineElementandpointElementfor line or radar chart,arcElementfor pie, doughnut or polar area chart, andbarElementfor bar chart. And then you need to import the supplied plugins for the title, filler (for area charts), legend, and the tooltip.