Pie and donut
Parts of a whole. The donut leaves room for a headline number in the middle.
| Name | Type | What it does |
|---|---|---|
pieChart(data, options) | component | data: { slices: [{ name, value }] } |
{ donut: true } | modifier | Option: draw a ring instead of a full pie (or use type="donut" on the tag) |
{ center } | modifier | Option: text for the middle of a donut |
{ width, height } | modifier | Option: the drawing's proportions. It always scales to the width of its container |
{ label } | modifier | Option: a description read out by screen readers |
Donut with a total
<script type="module" src="node_modules/glimmer-ui/charts.js"></script>
<gl-chart type="donut" data='{"slices":[{"name":"Photos","value":2418},{"name":"Videos","value":940},{"name":"Stories","value":512},{"name":"Other","value":230}]}' options='{"center":"4,100"}'></gl-chart>Pie
<script type="module" src="node_modules/glimmer-ui/charts.js"></script>
<gl-chart type="pie" data='{"slices":[{"name":"Photos","value":2418},{"name":"Videos","value":940},{"name":"Stories","value":512},{"name":"Other","value":230}]}'></gl-chart>