Chartjs-Chartjs display stats with a doughnut, but get no legend and infos of pices

0👍

You need to import and register everything you are using if you are using treeshaking, so in your case you also need to import the legend and tooltip and register those.

import {Chart, Legend, Tooltip} from 'chart.js';

Chart.register(Legend, Tooltip);

Or you can let chart.js handle everything for you and use this import

import Chart from 'chart.js/auto';

Leave a comment