Charts
PieChart
Proportional data as pie, donut or Nightingale rose, with an optional center label.
<script>
import { PieChart } from "@codeatlasdev/ui/charts";
</script>
<PieChart data={[{ name: "Cloud", value: 38 }, { name: "SaaS", value: 24 }]} donut />
Basic donut
Code
Donut with center KPI
centerLabel overlays a value and caption in the hole of a donut.
Code
Rose chart
Nightingale rose: the radius of each slice scales with its value.
Code
Animated proportions
Swap the data and the slices animate to the new proportions.
Q1 Q2 Q3
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
data | ChartSlice[] | – | Slices as { name, value }. |
donut | boolean | false | Renders a ring instead of a solid pie. |
rose | boolean | false | Nightingale rose, where the slice radius scales with the value. |
centerLabel | { value: string; label: string } | – | Text centered in a donut, such as a KPI total. Use with donut. |
height | string | '300px' | CSS height of the chart. |
class | string | '' | Extra class names. |