Creates a simple donut chart in mithril (v2.2.2) using TypeScript, including a legend and tooltips. A playground is provided in flems.
// Example usage:
const data: DonutChartSlice[] = [
{ label: 'Future Projects', value: 23, color: '#ff7f0e' },
{ label: 'Projects started', value: 21, color: '#1f77b4' },
{ label: 'Projects closed', value: 20, color: '#2ca02c' }
];
const innerRadius = 50; // Use 0 for a pie chart.
const outerRadius = 100;
m.mount(document.body, {
view: () => m(DonutChart, { data, innerRadius, outerRadius })
});