Skip to content
bahtuiv0.6.0

<baht-donut-chart>

Pure-SVG donut with legend (report type “pie”). The center number defaults to the group sum. Part-to-whole at a glance only: at most six slices, the tail folded into a grey “Other”, and a 2px gap that shows the surface between touching segments.

Groups

<baht-donut-chart center-label="requests"></baht-donut-chart>

<script>
  const el = document.querySelector('baht-donut-chart');
  el.groups = [
    {
      "label": "Open",
      "count": 4
    },
    {
      "label": "In approval",
      "count": 6
    },
    {
      "label": "Closed",
      "count": 9
    }
  ];
</script>
NameTypeDefaultDescription
groupsJSChartGroup[][]{ label, count }[] in legend order
totalnumber | nullnullCenter number when it differs from the sum
colorstring''CSS color override
center-labelstring'records'Under the number
other-labelstring'Other'Name of the folded tail bucket
empty-messagestring'No data to chart'Shown when groups is empty
loadingbooleanfalseHold the previous render at 0.5 opacity
show-tablebooleantrueRender the "View as table" twin
formatChartFormat'number'number | currency | percent | compact
currencystring'THB'ISO currency code for `format="currency"` (THB renders `฿`).