chart.js
Version:
Simple HTML5 charts using the canvas element.
17 lines (14 loc) • 384 B
text/typescript
import { Chart, ChartMeta, Element } from '../../index.esm';
const chart = new Chart('id', {
type: 'doughnut',
data: {
labels: [],
datasets: [{
data: [],
}]
},
});
// A cast is required because the exact type of ChartMeta will vary with
// mixed charts
const meta = <ChartMeta<Element, Element, 'doughnut'>>chart.getDatasetMeta(0);
const total = meta.total;