Skip to content

ChartTooltip

The box that follows the pointer or the focus over a chart: the position, then every series with its colour and value. It flips sides past the middle so it never leaves the chart.

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

On this page
  1. Over a bar chart
  2. When to use it
  3. For everyone
  4. Props

Over a bar chart

Hover a bar, or press Tab until one is focused.

Deploys
Per day
  • Finished
  • Failed
051015MonTueWedThuFri
View as table
FinishedFailed
Mon61
Tue90
Wed42
Thu111
Fri70
Code
import { BarChart } from '@sypnia/ui/react';

// Hover a bar or reach it with Tab: the tooltip lists every series with its colour and value.
export default function Hover() {
  return <BarChart title="Deploys" subtitle="Per day" x={['Mon', 'Tue', 'Wed', 'Thu', 'Fri']}
    series={[{ id: 'ok', label: 'Finished', data: [6, 9, 4, 11, 7] }, { id: 'fail', label: 'Failed', data: [1, 0, 2, 1, 0] }]} />;
}

When to use it

Use it when

  • Charts you draw yourself; the library's charts show it already.

Do not use it when

  • Information found only in the tooltip: the table view must have it too.

For everyone

  • It opens on keyboard focus as well as on hover.
  • Every value is also in the table view.

Props

ChartTooltipTypeDefault
atrequired number
rowsrequired { i: number; label: string; value: string; }[]
widthrequired number
xrequired ReactNode
y number 8
  1. Over a bar chart
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms