Skip to content
ChartslibraryUI
Get Pro

React radial bar chart

Progress toward a few goals as concentric rings, each filled to its share of the goal.

FreeMIT · install in one command<RadialBarChart />

A radial bar chart draws one ring per goal, filled to the share reached, like the activity rings on a watch. Each ring runs three quarters of a circle, and its name and percentage sit at its start, so the reader doesn't need a legend.

Each row can bring its own goal (a quota per team, a target per metric), or you set one maximum for all rows. A ring that passes its goal is drawn full and the label shows the real share, so 107% is never hidden. Negative or missing values are noted, not drawn as progress.

Use it for a handful of goals on a dashboard: quota by team, OKRs for the quarter, onboarding steps. Rings near the centre are shorter than outer rings, so it is not for comparing sizes; use a bar or bullet chart for that, and a gauge for one number against a limit.

When to use

  • Sales quota attainment by team
  • OKR or goal progress for a quarter
  • Onboarding or checklist completion rates

When not to use

Good practice

  • Use it for progress toward a goal, not for comparing sizes: outer rings are longer than inner ones.
  • Order rings by importance, not by value.
  • Keep to two to six rings.

Installation

Radial bar chart is free under the MIT license.

pnpm dlx shadcn@latest add https://chartslibraryui.com/r/radial-bar-chart.json

Installs the chart, its dependencies and the shared core into your components folder.

Then import the theme once: import "@/components/charts/core/charts.css" Installation guide

Building with an AI tool? Download the radial bar chart for your AI tool and attach it to Claude, ChatGPT, Lovable or Cursor. No terminal needed. How it works

Usage

import { RadialBarChart } from "@/components/charts/radial-bar-chart";
import { quotaByTeam } from "./sample-data";

export function Example() {
  return (
    <RadialBarChart
      title="Only SMB has passed its Q3 quota"
      subtitle="Bookings as a share of quota by sales team, Q3"
      data={quotaByTeam}
      label="team"
      value="bookings"
      target="quota"
      format="currency"
    />
  );
}

Data

One row per ring with a label key, a value key and either a goal key per row or one max for all rows.

[{ team: "Enterprise", bookings: 1720000, quota: 2000000 }, ...]

Missing values are null. Invalid values make the chart say what’s wrong instead of drawing a misleading picture. How charts handle bad data

Props

Every chart also accepts the shared frame props: title, subtitle, source, height, mode, toolbar. Common API

export interface RadialBarChartProps extends FrameProps {
  /** Rows to draw, one ring per row, outermost first. See the Data section for the shape. */
  data: Row[];
  /** Key of the ring name. */
  label: string;
  /** Key of the value. */
  value: string;
  /** Key of each row's goal. A ring is full when its value reaches its goal. */
  target?: string;
  /** One goal for every row when there is no `target` key. Default 100, or 1 for percent formats. */
  max?: number;
  /** Number format for values: "currency", "percent", "integer", "compact" or a format object. */
  format?: FormatInput;
}

Source

Installs radial-bar-chart.tsx and the shared core/ (12 files).

View radial-bar-chart.tsx
"use client";

import { useMemo } from "react";
import { color as tokens } from "./core/color";
import { readNum, type Issue, type Row } from "./core/data";
import { formatShare, formatValue, type FormatInput } from "./core/format";
import { ChartFrame, ChartTooltip, useActiveIndex, type FrameProps } from "./core/frame";
import { arcPath } from "./core/path";
import { textWidth, truncate } from "./core/text";
import { useWords } from "./core/words";

export interface RadialBarChartProps extends FrameProps {
  /** Rows to draw, one ring per row, outermost first. See the Data section for the shape. */
  data: Row[];
  /** Key of the ring name. */
  label: string;
  /** Key of the value. */
  value: string;
  /** Key of each row's goal. A ring is full when its value reaches its goal. */
  target?: string;
  /** One goal for every row when there is no `target` key. Default 100, or 1 for percent formats. */
  max?: number;
  /** Number format for values: "currency", "percent", "integer", "compact" or a format object. */
  format?: FormatInput;
}

interface Ring {
  name: string;
  value: number;
  goal: number;
  share: number;
  row: Row;
}

const SWEEP = Math.PI * 1.5;
const FONT = 11;

/**
 * Progress rings: one ring per metric, filled to its share of the goal over three quarters of a circle, with the
 * name and percentage at the start of each ring. Use it for a few goals side by side, such as quarterly OKRs.
 */
export function RadialBarChart({ data, label, value, target, max: maxProp, format, height: hProp, ...frame }: RadialBarChartProps) {
  const L = useWords(frame.words);
  const isPct = format === "percent" || (typeof format === "object" && format !== null && "kind" in format && format.kind === "percent");
  const max = maxProp ?? (isPct ? 1 : 100);
  const { rings, issues } = useMemo(() => {
    const issues: Issue[] = [];
    if (!Array.isArray(data) || !data.length) return { rings: [] as Ring[], issues: [{ level: "error", message: "No data to display." }] as Issue[] };
    const rings: Ring[] = [];
    let skipped = 0;
    let badGoal = 0;
    let over = 0;
    let negative = 0;
    for (const r of data) {
      const n = readNum(r?.[value]);
      const g = target ? readNum(r?.[target]) : { value: max, state: "ok" as const };
      if (n.state === "invalid" || g.state === "invalid") {
        issues.push({ level: "error", message: `"${String(r?.[label] ?? "")}" has a non-numeric value or goal.` });
        continue;
      }
      if (n.value === null) {
        skipped++;
        continue;
      }
      if (g.value === null || g.value <= 0) {
        badGoal++;
        continue;
      }
      let v = n.value;
      if (v < 0) {
        negative++;
        v = 0;
      }
      if (v > g.value) over++;
      rings.push({ name: String(r?.[label] ?? ""), value: n.value, goal: g.value, share: Math.min(1, v / g.value), row: r });
    }
    if (skipped) issues.push({ level: "note", message: `${skipped} row(s) without a value are not drawn.` });
    if (badGoal) issues.push({ level: "note", message: `${badGoal} row(s) without a positive goal are not drawn.` });
    if (over) issues.push({ level: "note", message: `${over} ring(s) passed the goal and are drawn full; the label shows the real share.` });
    if (negative) issues.push({ level: "note", message: `${negative} negative value(s) are drawn as an empty ring.` });
    if (rings.length > 8) issues.push({ level: "warning", message: `${rings.length} rings are hard to compare; consider a bar chart past 6.` });
    return { rings, issues };
  }, [data, label, value, target, max]);
  const height = hProp ?? Math.max(220, Math.min(420, rings.length * 40 + 90));
  const f = (v: unknown) => formatValue(v as number, format, { context: "table" });
  const table = {
    columns: [
      { key: "name", label },
      { key: "value", label: value, align: "right" as const, format: f },
      { key: "goal", label: target ?? L.target, align: "right" as const, format: f },
      { key: "share", label: L.progress, align: "right" as const, format: (v: unknown) => formatShare(v as number, 0) },
    ],
    rows: rings.map((r) => ({ name: r.name, value: r.value, goal: r.goal, share: r.goal > 0 ? r.value / r.goal : null })),
  };
  const summary = `Radial bar chart of ${rings.length} goals. ${rings.map((r) => `${r.name} ${formatShare(r.value / r.goal)} of ${formatValue(r.goal, format)}`).join("; ")}.`;
  return (
    <ChartFrame {...frame} height={height} issues={issues} table={table} summary={summary}>
      {({ width }) => <Plot {...{ width, height, rings, format }} />}
    </ChartFrame>
  );
}

function Plot(p: { width: number; height: number; rings: Ring[]; format?: FormatInput }) {
  const L = useWords();
  const { width, height, rings } = p;
  const { active, setActive, keyProps } = useActiveIndex(rings.length, { describe: (i) => ({ label: rings[i]?.name, row: rings[i]?.row }) });
  const R = Math.max(50, Math.min(height / 2 - 6, width / 2 - 6));
  // names sit in the open top-left quadrant and may run past the rings to the left; move the rings right if they need it
  const need = Math.max(0, ...rings.map((r) => textWidth(`${r.name} ${formatShare(r.goal > 0 ? r.value / r.goal : 0)}`, FONT) + 12));
  const cx = Math.max(width / 2, Math.min(width - R - 6, need + 14));
  const cy = height / 2;
  const labelRoom = cx - 12;
  const hole = R * 0.28;
  const step = (R - hole) / Math.max(1, rings.length);
  const thick = Math.max(6, Math.min(22, step * 0.72));
  return (
    <>
      <svg width={width} height={height} role="group" aria-roledescription="chart" aria-label="Radial bar chart. Use arrow keys to read rings." {...keyProps}>
        {rings.map((r, i) => {
          const outer = R - i * step;
          const inner = outer - thick;
          const mid = (outer + inner) / 2;
          const c = tokens.series(i);
          const pct = formatShare(r.goal > 0 ? r.value / r.goal : 0);
          const name = truncate(r.name, Math.max(0, labelRoom - textWidth(` ${pct}`, FONT) - 6), FONT);
          return (
            <g key={i} className={`clui-mark${active !== null && active !== i ? " clui-dim" : ""}`} onPointerEnter={() => setActive(i)} onPointerLeave={() => setActive(null)}>
              <path d={arcPath(cx, cy, inner, outer, 0, SWEEP)} style={{ fill: "var(--clui-grid)" }} />
              {r.share > 0 && <path d={arcPath(cx, cy, inner, outer, 0, SWEEP * r.share)} style={{ fill: c }} />}
              <text x={cx - 8} y={cy - mid} dy="0.32em" textAnchor="end" className="clui-label" aria-hidden>
                <tspan style={{ fill: "var(--clui-ink-2)" }}>{name}</tspan>
                <tspan className="clui-label-strong" dx={5}>
                  {pct}
                </tspan>
              </text>
            </g>
          );
        })}
      </svg>
      {active !== null && rings[active] && (
        <ChartTooltip
          x={cx + (R - active * step) * Math.sin(SWEEP * rings[active].share)}
          y={cy - (R - active * step) * Math.cos(SWEEP * rings[active].share)}
          width={width}
          height={height}
          data={{
            title: rings[active].name,
            rows: [
              { label: L.value, value: formatValue(rings[active].value, p.format, { context: "tooltip" }), color: tokens.series(active), shape: "square", strong: true },
              { label: L.target, value: formatValue(rings[active].goal, p.format, { context: "tooltip" }) },
              { label: L.progress, value: formatShare(rings[active].value / rings[active].goal, 1) },
            ],
          }}
        />
      )}
    </>
  );
}

Gauge chart

One number on a half-circle scale against a fixed limit, with an optional target.

Pro

Bullet chart

KPIs against targets and qualitative ranges: the compact replacement for gauges.

KPI row

A responsive row of KPI tiles that wraps cleanly.

Sign in to ChartslibraryUI

New here? The same step creates your account.

Continue with Google
or

No password needed. Bought Pro? Use the email you paid with and your license is there. By signing in you agree to the Terms and Privacy policy.