Skip to content

Scatter

Two measures of the same things, one dot each: answer size against time. Each series has its colour and the legend names them.

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

On this page
  1. Size and time of each endpoint
  2. When to use it
  3. For everyone
  4. Props

Size and time of each endpoint

Size and time of each endpoint
  • Reads
  • Writes
0200400600800050100150200Answer size (kB)Time (ms)
View as table
Answer size (kB)Time (ms)
GET /me240
GET /products1290
GET /orders48210
GET /export180640
POST /login6120
POST /checkout30300
PUT /orders90380
GET /tables2270
Code
import { Scatter } from '@sypnia/ui/react';

// Is a large answer a slow answer? Each dot is an endpoint.
const points = [[2, 40, 'GET /me'], [12, 90, 'GET /products'], [48, 210, 'GET /orders'], [180, 640, 'GET /export'], [6, 120, 'POST /login', 1], [30, 300, 'POST /checkout', 1], [90, 380, 'PUT /orders', 1], [22, 70, 'GET /tables']] as const;
export default function SizeTime() {
  return <Scatter title="Size and time of each endpoint" xLabel="Answer size (kB)" yLabel="Time (ms)" series={['Reads', 'Writes']}
    points={points.map(([x, y, label, s]) => ({ x, y, label, series: s ?? 0 }))} />;
}

When to use it

Use it when

  • Looking for a relation between two measures.

Do not use it when

  • Measures over time: use LineChart.

For everyone

  • Each dot is focusable and named with both values; the table lists them all.
  • Both axes say what they measure.

Props

ScatterTypeDefault
pointsrequired ScatterPoint[]
titlerequired ReactNode
xLabelrequired string
yLabelrequired string
empty ReactNode
error ReactNode
formatX Fmt
formatY Fmt
height number
loading boolean
series

Names of the series, in the order of their colours.

string[]
subtitle ReactNode
  1. Size and time of each endpoint
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms