ValyroUI Русская версия

Scatter Chart

Scatter and bubble charts with a trend line. Pro · Charts and analytics › Trends

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add scatter-chart
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { ScatterChart } from 'valyro-ui-pro';

Props

PropTypeDefault
series *ScatterSeries<T>[]Groups of points, each in its own color with a legend item; all share the x/y/size fields.
x *keyof T & stringNumeric field for the horizontal position.
y *keyof T & stringNumeric field for the vertical position.
sizekeyof T & stringNumeric field encoded as bubble area (radius ∝ √value) — makes it a bubble chart.
namekeyof T & stringField that names a point in the tooltip and the data table.
xLabelstringAxis titles, drawn at the ends of the axes (also the data table headers, which default to the field keys).
yLabelstringTitle above the y axis; also names y in the tooltip and data table (default there: the y key).
sizeLabelstringNames the size value in the tooltip and data table. Default: the size key.
xFormatterValueFormatterFormats x values in the tooltip; axis ticks keep its units around a shorter number. Default: compact numbers on the axis.
yFormatterValueFormatterFormats y values in the tooltip; axis ticks keep its units around a shorter number. Default: compact numbers on the axis.
sizeFormatterValueFormatterFormats size values in the tooltip and the data table.
maxBubbleSizenumber24Radius of the largest bubble in px (smaller on narrow charts). Default 24.
pointSizenumber4Radius of a point without size. Default 4.
trendLinebooleanfalseDraws a least-squares trend line per series and shows its R² in the legend.
heightnumber300Plot height in px; width follows the container. Default 300.
showGridbooleantrueGrid lines at the x and y ticks; the zero lines are drawn either way.
showLegendbooleanDefault: shown when there is more than one series or a trend line. Click an item to hide its series.
loadingbooleanfalseShows a placeholder of the same height while data loads.
localestringBCP 47 locale for the default number formatting. Default: the ThemeProvider locale, then the browser's.
labelsPartial<ScatterChartLabels>Overrides for the built-in strings.
ariaLabel *stringAccessible name of the chart (also the caption of its sr-only data table).

Related components

Previous: Area Chart · Next: Sparkline · All Charts and analytics