Skip to content

Legend

The names of the series with their colours, in the order of the five series colours. Charts draw it themselves when there are two or more series.

import { Legend } from '@sypnia/ui/react'

On this page
  1. Beside a chart of your own
  2. When to use it
  3. For everyone
  4. Props

Beside a chart of your own

  • Answered
  • Failed
  • Retried
Code
import { Legend, SparkBar } from '@sypnia/ui/react';

// Beside a chart you draw yourself: the names in the order of the five colours.
export default function Own() {
  return <div className="sy-stack"><Legend items={[{ label: 'Answered' }, { label: 'Failed' }, { label: 'Retried', line: true }]} /><SparkBar label="Requests per hour" data={[3, 5, 4, 8, 6, 9, 12]} /></div>;
}

When to use it

Use it when

  • Beside a chart you draw yourself.

Do not use it when

  • One series: the title already names it.

For everyone

  • The names are text, never only colour; lines are marked as lines.

Props

LegendTypeDefault
itemsrequired { label: string; line?: boolean | undefined; }[]
  1. Beside a chart of your own
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms