Radial bar
A radial bar puts categories around a circle. The length of the bar is the value. A track runs out to the edge behind each bar. A second series is another bar in that same category, beside the first or stacked outward.
When to use it
Use a radial bar when the categories belong on a dial and you are comparing one or more measures. Lumen, minutes by desk is six desks, weeknight against Saturday. Music is the long bar on both series.
A rose also lays categories around a circle, and the radius is the value, but it fills the whole equal angle. It does not draw a bar on a track, and a single series has no side-by-side pair. A bar is the same comparison on a straight axis. Use it when the names are long or the list is not a cycle. A pie encodes share as the angle. A radial bar keeps the angles equal.
Radial bar, rose, and bar
type: "radial-bar" bends bars around a circle. encoding.y is the radius. Several y fields group side by side unless mark.stack is stack or percent. radialBar, polar-bar, and polar repair to radial bar. Setting layout.coordinate to polar on a bar repairs the type here too.
type: "rose" fills equal angles out to the value. type: "bar" is the cartesian chart. layout.coordinate cartesian on a radial bar warns CK3078. The chart stays polar.
Data
Each row is one category and one or more numbers. encoding.x is the category. encoding.y is a field name, or a list of channels when each series is its own column. Lumen, minutes by desk lists weeknight and saturday.
The categories run clockwise from the start angle, in data order. mark.sort is a pie and donut key. On a radial bar it warns CK3010 and the order stays put.
A negative radius warns CK3073 and is drawn as zero. Fewer than three categories warns CK3074. More than sixteen warns CK3079.
a11y.alt is required. One sentence, 10 to 500 characters, with the point of the chart.
A spec that renders
This is the smallest radial bar. version, type, and a11y.alt are required. layout.coordinate is polar. The hole defaults to 0.34, the gap to 2 degrees, and the bars are grouped, so mark can be omitted.
{
"version": "1",
"type": "radial-bar",
"data": [
{
"desk": "Music",
"weeknight": 186,
"saturday": 210
},
{
"desk": "Talk",
"weeknight": 74,
"saturday": 48
},
{
"desk": "News",
"weeknight": 36,
"saturday": 22
},
{
"desk": "Sky",
"weeknight": 18,
"saturday": 16
}
],
"encoding": {
"x": "desk",
"y": [
"weeknight",
"saturday"
]
},
"layout": {
"coordinate": "polar"
},
"a11y": {
"alt": "Saturday music runs longer, and talk shrinks."
}
}Install core and the adapter for your framework. The menu in the sidebar picks the snippet. spec is the JSON above.
npm install @chartkitdev/core
npm install @chartkitdev/react
import { Chart } from "@chartkitdev/react";
export function Panel() {
return <Chart spec={spec} />;
}npm install @chartkitdev/core
npm install @chartkitdev/vanilla
import { mount } from "@chartkitdev/vanilla";
const chart = mount(document.querySelector("#chart"), spec);
chart.update(spec);npm install @chartkitdev/core
npm install @chartkitdev/vue
<script setup>
import { Chart } from "@chartkitdev/vue";
</script>
<template>
<Chart :spec="spec" />
</template>npm install @chartkitdev/core
npm install @chartkitdev/svelte
<script>
import { Chart } from "@chartkitdev/svelte";
</script>
<Chart {spec} />npm install @chartkitdev/core
npm install @chartkitdev/astro
---
import { Chart } from "@chartkitdev/astro";
---
<Chart spec={spec} />npm install @chartkitdev/core
npm install @chartkitdev/solid
import { Chart } from "@chartkitdev/solid";
export function Panel() {
return <Chart spec={spec} />;
}npm install @chartkitdev/core
npm install @chartkitdev/qwik
import { component$ } from "@builder.io/qwik";
import { Chart } from "@chartkitdev/qwik";
export const Panel = component$(() => {
return <Chart spec={spec} />;
});npm install @chartkitdev/core
npm install @chartkitdev/angular
import { Component } from "@angular/core";
import { Chart } from "@chartkitdev/angular";
@Component({
standalone: true,
imports: [Chart],
template: `<ck-chart [spec]="spec" />`,
})
export class Panel {
spec = spec;
}npm install @chartkitdev/core
npm install @chartkitdev/element
import "@chartkitdev/element";
const chart = document.querySelector("chart-kit");
chart.spec = spec;Each option below is a key on the spec. The demo changes that key and updates the chart and the snippet together.
Examples
The rail switches among existing radial bars. Lumen, minutes by desk is the core example, six categories and two series. Minutes by desk is the homepage chart. It drops Ident, sets a size, and turns the legend off.
Hole
mark.innerRadius is the hole the bars grow from, as a fraction of the radius, from 0 to 0.95. Omit it and a radial bar uses 0.34. Lumen, minutes by desk sets that same hole. The track behind each bar starts there.
0 starts the bars at the center. The chart stays a radial bar. A rose is the type that fills an equal angle, and its hole defaults to 0. This control stops at 0.75. A value above 0.85 warns CK3075.
{
"mark": { "innerRadius": 0.34 }
}Start angle
mark.startAngle is where the first category starts, in degrees. 0 is the top, and the bars run clockwise. The value can be from -360 to 360. Omit it and the first category starts at the top.
{
"mark": { "startAngle": 90 }
}Stack
mark.stack is how several series share a category. Omit it, or set none, and the bars sit side by side inside the category's angle. That is grouped. stack runs the series outward from the hole, in one bar. percent makes each category 100%, so you compare the mix.
{
"mark": { "stack": "stack" }
}One series looks the same grouped or stacked. Lumen, minutes by desk and Minutes by desk are two series, so the choice changes the picture.
Labels
mark.labels draws the value on a bar tall enough to hold it. Omit it, or set false, and the bars are unlabeled. The category names stay outside the circle. Set true and the number is drawn. Both examples omit it, so the labels start off.
{
"mark": { "labels": true }
}Turning labels off and on again puts the example's label keys back.
Legend
A radial bar with one series hides the legend. A radial bar with several series shows it. Omit legend, or set true, and the legend sits on top. false hides it. legend.position is top, right, bottom, left, or inside. Minutes by desk sets false. Lumen, minutes by desk leaves the key off, so the two series get a legend on top.
{
"legend": { "position": "bottom" }
}Tooltip
tooltip is on for a radial bar when the key is omitted. Hovering a bar shows the category, the series, and the value. tooltip: false turns the card off. tooltip: true turns it on.
{
"tooltip": false
}{
"tooltip": true
}tooltip.fields chooses the rows in the card, and tooltip.position places it. Change those in the playground. Turning the card off and on again puts that object back.
The rest of the spec
mark.padAngle is the gap between categories, in degrees. A radial bar defaults to 2. Lumen, minutes by desk sets that gap. Above 8 degrees warns CK3076. mark.cornerRadius rounds the outer end of the bar, in px. The default is 3, and Lumen, minutes by desk sets 4. mark.gap is the share of the category left between grouped series. A radius domain that excludes zero warns CK3080. Theme presets live on the playground, with the full option list.