Skip to content

Step counter ​

Steps a day against a goal, with the days reached and the streak. Good for activity trackers and wellness challenges.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'stepcount',
  goal: 8000,
  data: [
    { label: 'Mo 1', steps: 8153 },
    { label: 'Tu 2', steps: 6989 },
    { label: 'We 3', steps: 4984 },
    { label: 'Th 4', steps: 7809 },
    { label: 'Fr 5', steps: 4575 },
    { label: 'Sa 6', steps: 4534 },
    { label: 'Su 7', steps: 8997 },
    { label: 'Mo 8', steps: 8296 },
    { label: 'Tu 9', steps: 5388 },
    { label: 'We 10', steps: 5595 },
    { label: 'Th 11', steps: 5328 },
    { label: 'Fr 12', steps: 8322 },
    { label: 'Sa 13', steps: 15068 },
    { label: 'Su 14', steps: 6731 },
  ],
};

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

/** Steps a day against a goal, with the days the goal was reached and the streak. */
interface StepCountSpec extends Base {
  type: 'stepcount';
  data: { label: string; steps: number }[];
  /** 10 000 by default. */
  goal?: number;
}

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