crispmeasured from Attio

DonutChart

A donut / ring chart — Attio's Reports breakdown reports.

Attio's breakdown report: a segmented ring with a centred total and a legend of coloured swatches, labels, and values. Pure SVG ring using the r=15.915 (circumference 100) trick, so slices are just percentages. Renders role="img" with a summary.

Preview

Companies by category Companies

Usage

import { DonutChart } from "crisp";

<DonutChart
  data={[
    { label: "Search", value: 8 },
    { label: "Ads", value: 4 },
    { label: "Cloud", value: 3 },
  ]}
  centerCaption="companies"
/>;

API

PropTypeDefaultDescription
data{ label, value, color? }[]One slice per entry (auto-coloured).
sizenumber120Ring diameter in px.
thicknessnumber14Ring thickness in px.
centerValueReactNodetotalCentre big value.
centerCaptionReactNodeSmall caption under the centre value.
legendbooleantrueShow the legend beside the ring.
format(n: number) => stringFormats slice + total values.

On this page