Donut
The default: a donut with the total in the middle and centerLabel below it, the legend on the right with the share of every slice. A click on a legend entry hides the slice; total and shares count only the visible ones.
| Services | % | |
|---|---|---|
| Color | 539 | 42% |
| Cut | 334 | 26% |
| Treatments | 231 | 18% |
| Retail | 180 | 14% |
Code
<script lang="ts">
import { PieChart } from '@likable-hair/svelte';
const data = {
labels: ['Color', 'Cut', 'Treatments', 'Retail'],
datasets: [{ label: 'Services', data: [539, 334, 231, 180] }]
};
</script>
<PieChart {data} label="Services by type" centerLabel="services" />