Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Charts

ScatterChart

Relationship between two measures (MUI X's ScatterChart).

import { ScatterChart } from "@stylhero/ui";

Example

Code
import { ScatterChart } from "@stylhero/ui";

function ScatterChartExample() {
  return <ScatterChart title="Price vs. frames per second" xLabel="Price ($)" yLabel="FPS"
    series={[{ name: "Builds", data: [{ x: 800, y: 70 }, { x: 1100, y: 95 }, { x: 1500, y: 120 }, { x: 2200, y: 150, label: "Creator" }] }]} />;
}

Props

PropTypeDefaultDescription
series required ScatterSeries[] - Keep it to 3 series or fewer: past that, colors get hard to tell apart when points mix.
description string -
height number 280
subtitle ReactNode -
title ReactNode -
xFormat Fmt defaultFmt
xLabel string "x"
yFormat Fmt defaultFmt
yLabel string "y"

Also takes the HTML attributes of its root element (id, style, data-*, aria-*, event handlers…).

Types

type ScatterSeries = { name: string; data: Array<{ x: number; y: number; label?: string }> };

type Fmt = (n: number) => string;

Accessibility

  • role="img" labelled by description (else the title). The "Show as table" button switches to a data table with the same numbers.

Generated from src/components/Charts.tsx. Something wrong or missing? Open an issue.