Skip to content

Time spiral ​

One turn for each year, so that the same months line up. Good for seasons and cycles over several years.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'spiral',
  period: 12,
  steps: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  turns: ['2021', '2022', '2023', '2024', '2025'],
  data: [
    { label: 'Jan 2021', value: 22 },
    { label: 'Feb 2021', value: 30 },
    { label: 'Mar 2021', value: 41 },
    { label: 'Apr 2021', value: 62 },
    { label: 'May 2021', value: 69 },
    { label: 'Jun 2021', value: 76 },
    { label: 'Jul 2021', value: 82 },
    { label: 'Aug 2021', value: 73 },
    { label: 'Sep 2021', value: 53 },
    { label: 'Oct 2021', value: 39 },
    { label: 'Nov 2021', value: 26 },
    { label: 'Dec 2021', value: 20 },
    { label: 'Jan 2022', value: 34 },
    { label: 'Feb 2022', value: 28 },
    { label: 'Mar 2022', value: 53 },
    { label: 'Apr 2022', value: 59 },
    { label: 'May 2022', value: 79 },
    { label: 'Jun 2022', value: 82 },
    { label: 'Jul 2022', value: 81 },
    { label: 'Aug 2022', value: 80 },
    { label: 'Sep 2022', value: 55 },
    { label: 'Oct 2022', value: 47 },
    { label: 'Nov 2022', value: 36 },
    { label: 'Dec 2022', value: 29 },
    { label: 'Jan 2023', value: 37 },
    { label: 'Feb 2023', value: 36 },
    { label: 'Mar 2023', value: 54 },
    { label: 'Apr 2023', value: 72 },
    { label: 'May 2023', value: 91 },
    { label: 'Jun 2023', value: 86 },
    { label: 'Jul 2023', value: 91 },
    { label: 'Aug 2023', value: 79 },
    { label: 'Sep 2023', value: 60 },
    { label: 'Oct 2023', value: 56 },
    { label: 'Nov 2023', value: 36 },
    { label: 'Dec 2023', value: 33 },
    { label: 'Jan 2024', value: 43 },
    { label: 'Feb 2024', value: 52 },
    { label: 'Mar 2024', value: 58 },
    { label: 'Apr 2024', value: 70 },
    { label: 'May 2024', value: 93 },
    { label: 'Jun 2024', value: 94 },
    { label: 'Jul 2024', value: 94 },
    { label: 'Aug 2024', value: 86 },
    { label: 'Sep 2024', value: 69 },
    { label: 'Oct 2024', value: 65 },
    { label: 'Nov 2024', value: 43 },
    { label: 'Dec 2024', value: 35 },
    { label: 'Jan 2025', value: 37 },
    { label: 'Feb 2025', value: 43 },
    { label: 'Mar 2025', value: 61 },
    { label: 'Apr 2025', value: 73 },
    { label: 'May 2025', value: 92 },
    { label: 'Jun 2025', value: 104 },
    { label: 'Jul 2025', value: 101 },
    { label: 'Aug 2025', value: 91 },
    { label: 'Sep 2025', value: 81 },
    { label: 'Oct 2025', value: 56 },
    { label: 'Nov 2025', value: 45 },
    { label: 'Dec 2025', value: 45 },
  ],
};

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 spiral takes:

/** Time spiral: one turn per period, so that the same season of each period lines up. */
interface SpiralSpec extends Base {
  type: 'spiral';
  data: { label: string; value: number }[];
  /** Values in one turn: 12 months, 52 weeks, 7 days; 12 by default. */
  period?: number;
  /** Names around the spiral, one for each step of a turn: the months. */
  steps?: string[];
  /** Names of the turns, written where each one starts: the years. The first label of the turn by default. */
  turns?: string[];
  color?: 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