x_axis and y_axis values. Where bar charts compare categories and line charts show change over time, scatter charts reveal relationships between two continuous variables — whether they’re correlated, clustered, or independent.
Basic Usage
Every scatter chart needs three things: the data, a series definition, and the two axis mappings. Thedata is a list of dicts where each dict is a point. x_axis and y_axis name the fields that position each point on the chart. The data_key on ChartSeries is an identifier for the series — it controls color and legend display.
Multiple Series
To plot multiple groups on the same axes, add a_series field to each data point that matches the data_key of its series. Each series gets its own color from the theme palette and appears as a separate entry in the legend. This is useful for comparing distributions across categories — here, two classes of students plotted by study hours vs. test scores.
Bubble Chart
Setz_axis to a numeric field to scale each point’s size proportionally, turning the scatter into a bubble chart. This encodes a third dimension directly in the visualization — larger bubbles represent higher values of the z-axis field. Useful for comparing entities that have three measurable attributes.
API Reference
ScatterChart Parameters
Data as a list of dicts, or a
{{ field }} interpolation reference. For multiple series, include a _series field in each dict matching the series data_key.Series definitions — each becomes a group of scatter points on the chart.
Data key for x-axis numeric values.
Data key for y-axis numeric values.
Data key for bubble size. When set, point radii scale proportionally to this field’s values.
Chart height in pixels.
Show a legend below the chart.
Show tooltips on hover.
Show cartesian grid lines.
Additional Tailwind CSS classes.
ChartSeries Parameters
Identifier for the series — used for color mapping and legend display. For multi-series scatter charts, this must match the
_series values in the data.Display label for legends and tooltips. Defaults to the
data_key value.CSS color override. By default, colors cycle through the theme’s chart palette (
--chart-1 through --chart-5).Protocol Reference
ScatterChart
ChartSeries