Rose

A rose gives every category the same angle. The radius is the value. A longer sector is a larger number. The angle does not change with the share.

When to use it

Use a rose when the categories are a cycle, or a small set you want arranged around a point, and the number should be a length. Saturday audience is six places. Quay reaches farthest because it has the most listeners. Every place still occupies the same wedge.

A pie encodes the share as the angle. A larger slice is wider, and the radius stays put. A donut is that pie with a hole. A radial bar also puts categories around a circle, and the length is the radius, but it draws a bar on a track. Several series sit side by side in the category, or stack outward. A rose fills the whole equal angle out to the value.

Two categories are a thin chart. Fewer than three warns CK3074. More than about sixteen gets hard to read. A ranked list on a straight axis is a bar.

Rose, pie, and radial bar

type: "rose" keeps the angles equal and maps encoding.y to the radius. polarArea, polar-area, nightingale, and rose-chart repair to rose.

type: "pie" maps the value to the angle. type: "donut" does that with a hole. Setting layout.coordinate to polar on a pie or a donut repairs the type to rose. On a bar it repairs the type to radial bar. The coordinate does not turn a rose into a pie.

type: "radial-bar" draws a bar whose length is the radius, with a track behind it. The hole defaults to 0.34. A rose starts at the center. mark.innerRadius defaults to 0.

Data

Each row is one category and one number. encoding.x is the category. encoding.y is the radius. Saturday audience uses place and listeners. The angles stay equal. You do not pass a share.

The categories run clockwise from the start angle, in data order. mark.sort is a pie and donut key. On a rose it warns CK3010 and the order stays put.

A negative radius warns CK3073 and is drawn as zero. A list of fields on encoding.y is several series. They share the category's angle unless mark.stack is stack or percent, which runs them outward. Saturday audience is one series.

a11y.alt is required. One sentence, 10 to 500 characters, with the point of the chart.

A spec that renders

This is the smallest rose. version, type, and a11y.alt are required. layout.coordinate is polar, which is how a rose is drawn. The gap defaults to 1.2 degrees and the labels default to off, so mark can be omitted.

spec.json
{
  "version": "1",
  "type": "rose",
  "data": [
    {
      "place": "Hale",
      "listeners": 4200
    },
    {
      "place": "Mill",
      "listeners": 3100
    },
    {
      "place": "Quay",
      "listeners": 5600
    },
    {
      "place": "Ridge",
      "listeners": 1800
    }
  ],
  "encoding": {
    "x": "place",
    "y": "listeners"
  },
  "layout": {
    "coordinate": "polar"
  },
  "a11y": {
    "alt": "Quay is the largest share of the evening audience."
  }
}

Install core and the adapter for your framework. The menu in the sidebar picks the snippet. spec is the JSON above.

Import@chartkitdev/core/charts/roseBundle@chartkitdev/core/extraFamilyLibrary
React
npm install @chartkitdev/core
npm install @chartkitdev/react

import { Chart } from "@chartkitdev/react";

export function Panel() {
  return <Chart spec={spec} />;
}
Vanilla
npm install @chartkitdev/core
npm install @chartkitdev/vanilla

import { mount } from "@chartkitdev/vanilla";

const chart = mount(document.querySelector("#chart"), spec);
chart.update(spec);
Vue
npm install @chartkitdev/core
npm install @chartkitdev/vue

<script setup>
import { Chart } from "@chartkitdev/vue";
</script>

<template>
  <Chart :spec="spec" />
</template>
Svelte
npm install @chartkitdev/core
npm install @chartkitdev/svelte

<script>
  import { Chart } from "@chartkitdev/svelte";
</script>

<Chart {spec} />
Astro
npm install @chartkitdev/core
npm install @chartkitdev/astro

---
import { Chart } from "@chartkitdev/astro";
---

<Chart spec={spec} />
Solid
npm install @chartkitdev/core
npm install @chartkitdev/solid

import { Chart } from "@chartkitdev/solid";

export function Panel() {
  return <Chart spec={spec} />;
}
Qwik
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} />;
});
Angular
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;
}
Custom element
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

Saturday audience is the rose in the gallery, on the homepage, and in the Lumen desk showcase. The other rose specs in the library are that same chart, trimmed. One example is the set.

Start angle

mark.startAngle is where the first category starts, in degrees. 0 is the top, and the sectors run clockwise. The value can be from -360 to 360. Omit it and the first category starts at the top.

mark.startAngle
{
  "mark": { "startAngle": 90 }
}

Labels

mark.labels draws the value on a sector tall enough to hold it. Omit it, or set false, and the sectors are unlabeled. The category names stay outside the circle. Set true and the number is drawn. Saturday audience sets true.

mark.labels
{
  "mark": { "labels": true }
}

Turning labels off and on again puts the example's label keys back. Saturday audience comes back with mark.labels set to true.

Legend

A rose with one series hides the legend. Saturday audience is one series, so the legend stays hidden even when the key is omitted. A rose with several series shows it. Omit legend, or set true, and that legend sits on top. false hides it. legend.position is top, right, bottom, left, or inside.

legend.position
{
  "legend": { "position": "bottom" }
}

The control still writes the key on a one-series rose. The picture waits for a second series.

Tooltip

tooltip is on for a rose when the key is omitted. Hovering a sector shows the category and the value. tooltip: false turns the card off. tooltip: true turns it on.

tooltip false
{
  "tooltip": false
}
tooltip true
{
  "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 sectors, in degrees. A rose defaults to 1.2. Saturday audience sets that same gap. Above 8 degrees warns CK3076. mark.innerRadius opens a hole. The default is 0, at the center. A hole does not change the type to donut. mark.cornerRadius rounds the outer end. mark.stack is how several series share a category. Theme presets live on the playground, with the full option list.