Skip to content

Circular bar chart ​

Bars that radiate from a ring. Good for many categories, with style, when a ranking is not the point.

The smallest code that works. change the code, then press Run

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'circularbar',
  sort: true,
  center: 'Sales',
  data: [
    { name: 'Juice', value: 96 },
    { name: 'Tea', value: 22 },
    { name: 'Cheese', value: 70 },
    { name: 'Soup', value: 20 },
    { name: 'Dates', value: 53 },
    { name: 'Rice', value: 38 },
    { name: 'Olives', value: 40 },
    { name: 'Fruit', value: 78 },
    { name: 'Coffee', value: 21 },
    { name: 'Bread', value: 54 },
    { name: 'Honey', value: 67 },
    { name: 'Nuts', value: 55 },
  ],
};

export default function Example() {
  return <Chart spec={spec} style={{ height: 340 }} />;
}

Or import this chart alone: what each import weighs.

Options

Beside the fields shared by every chart (title, format, heading, export…), type circularbar takes:

/** Bars that radiate from a ring. */
interface CircularBarSpec extends Base {
  type: 'circularbar';
  data: Item[];
  color?: string;
  /** Size of the hole, as a share of the radius: 0.3 by default. */
  inner?: number;
  sort?: boolean;
  /** Text in the hole. */
  center?: string;
}

Style it

  • Colours: theme.palette, chart.setColor(name, colour), or --nervure-palette in your CSS. More
  • Marks: [data-series="name"], parts: [data-part="axes"], legend, series. What you change is kept in exports.
  • Movement: animation: false draws at once. More
  • Files: chart.download('png'), svg, csv. More

Close to it