Scatter Chart

Points on two value axes to see how two measures relate — and bubbles when a third value sets the size. Drawn as SVG by the component, rendered on the server and themed by the design tokens.

Part of @tectra-ng/charts (npm install @tectra-ng/charts, also included in tectra-ng).

Features15APIThemingAccessibility

Basic

Points on two value axes, one colour per series. Hover a point: it gets a ring and dashed guides to both axes, and the tooltip shows its x and y named after the axis titles.

Arrow keys move between values
Session length and pages viewed. Scatter chart, 2 series, 24 values, from 2 to 21
CategorySession length, minPages viewed
Desktop4.26
Desktop6.89
Desktop9.111
Desktop12.415
Desktop3.14
Desktop7.712
Desktop10.613
Desktop14.819
Desktop5.58
Desktop8.910
Desktop11.717
Desktop16.221
Mobile1.83
Mobile2.94
Mobile3.74
Mobile5.26
Mobile6.17
Mobile2.42
Mobile4.65
Mobile7.39
Mobile8.48
Mobile3.35
Mobile5.95
Mobile9.610

Bubble

A size on the points turns them into bubbles. The area of a bubble follows its size, the biggest are drawn first and the tooltip adds the size under sizeLabel, formatted by sizeFormat.

Arrow keys move between values
Price, rating and number of reviews by product. Bubble chart, 2 series, 8 values, from 3.7 to 4.8
CategoryPrice, $RatingReviews
Headphones, Model S494.11.2K
Headphones, Model M894.45.4K
Headphones, Model L1494.68.9K
Headphones, Model Pro2994.82.1K
Speakers, Mini393.7800
Speakers, Home1194.23.6K
Speakers, Room1994.56.2K
Speakers, Studio3494.3950

Trend line

trendLine fits a straight least-squares line through every series and draws it dashed in the series colour over its x range.

Arrow keys move between values
Ad spend and sign-ups by week. Scatter chart, 2 series, 18 values, from 90 to 390
CategoryAd spend, $KSign-ups
Search2120
Search3160
Search4170
Search5230
Search6240
Search7300
Search8310
Search9360
Search10390
Social290
Social395
Social4130
Social5120
Social6150
Social7140
Social8175
Social9170
Social10190

Point colors and labels

color on a point overrides the series colour — here the slow services are marked. label names the point in the tooltip and in the data table for screen readers.

Arrow keys move between values
Response time and error rate by service. Scatter chart, 1 series, 6 values, from 0.2% to 4.8%
CategoryResponse time, msError rate
Services, Auth1200.4%
Services, Search2100.9%
Services, Billing3401.6%
Services, Profile950.2%
Services, Reports6404.8%
Services, Export4803.1%

Time axis

xType="time" takes dates, timestamps or ISO strings and places them at their real distance on a calendar axis.

Arrow keys move between values
Build duration over time. Scatter chart, 2 series, 12 values, from 11 to 31
CategoryxDuration, min
MainSep 2, 202614
MainSep 9, 202616
MainSep 17, 202615
MainSep 28, 202619
MainOct 6, 202618
MainOct 15, 202622
MainOct 27, 202612
MainNov 3, 202611
ReleaseSep 5, 202624
ReleaseSep 21, 202627
ReleaseOct 10, 202631
ReleaseOct 30, 202621

Axes

Compact numbers on both axes with xValueFormat and valueFormat, a log y axis for values of very different size, horizontal grid lines only and the y axis on the right.

Arrow keys move between values
Population and area by city. Scatter chart, 1 series, 7 values, from 12 to 1.5K
CategoryPopulationArea, km²
Cities, City A2.1M105
Cities, City B3.6M890
Cities, City C870K41
Cities, City D1.8M755
Cities, City E540K220
Cities, City F4.2M1.5K
Cities, City G320K12

Annotations

Annotations on value axes: an x-band between two numbers and a y-line for a limit.

Arrow keys move between values
Services against their limits. Scatter chart, 1 series, 6 values, from 0.2 to 4.8
CategoryResponse time, msError rate, %
Services, Auth1200.4
Services, Search2100.9
Services, Billing3401.6
Services, Profile950.2
Services, Reports6404.8
Services, Export4803.1

Tooltip template

txChartTooltip replaces the tooltip content: data.title is the point label, data.rows hold the series, x, y and size with their formatted value.

Arrow keys move between values
Experience and closed tasks. Scatter chart, 1 series, 6 values, from 42 to 88
CategoryExperience, yearsTasks closed
Team, Robin142
Team, Sam361
Team, Alex458
Team, Jordan677
Team, Taylor870
Team, Casey1188

Events

pointClick reports the clicked point with its index in the series data, its values and label; seriesToggle reports legend changes.

Arrow keys move between values
Story points and days to close. Scatter chart, 2 series, 6 values, from 1 to 12
CategoryStory pointsDays
Features, Export34
Features, Filters57
Features, Reports812
Bugs, Typo11
Bugs, Crash23
Bugs, Sync54

Click a point or a legend item.

Loading and empty

loading keeps the size with a skeleton; empty series (or only null values) show "No data".

No data

Live

Changing series or trendLine redraws in place — points slide to their new place and bubbles grow or shrink.

Arrow keys move between values
Shuffled sample. Scatter chart, 2 series, 24 values, from 0 to 75
Categoryxy
Sample A00
Sample A721
Sample A1420
Sample A1635
Sample A2334
Sample A2549
Sample A3247
Sample A3969
Sample A4161
Sample A4860
Sample A5075
Sample A5773
Sample B411
Sample B626
Sample B1320
Sample B1511
Sample B2228
Sample B2922
Sample B3137
Sample B3831
Sample B4045
Sample B4739
Sample B5433
Sample B5648

Accessibility

Tab to the chart: ←/→ walk the points of a series in x order, ↑/↓ jump to the nearest point of the next series, Home / End go to the ends, Escape closes the tooltip. Each point is announced with its axis names; screen readers also get a summary and a hidden table of every point.

Arrow keys move between values
Hours studied and test score. Scatter chart, 2 series, 10 values, from 49 to 88
CategoryHours studiedScore
Morning group258
Morning group466
Morning group571
Morning group780
Morning group988
Evening group149
Evening group360
Evening group669
Evening group877
Evening group1085

Design tokens

dt sets the point and bubble radius, the fill opacity, the trend line width and dash and the palette of one chart.

Arrow keys move between values
Temperature and sales. Scatter chart, 1 series, 8 values, from 185 to 614
Categoryxy
Sales14215
Sales16325
Sales12185
Sales19412
Sales22522
Sales18406
Sales25614
Sales23544

Pass through

pt reaches the parts — point, trendLine, guide, grid, axis, legend, legendItem, plot, tooltip and more. Here the points become rings in the series colour.

Arrow keys move between values
Width and height of parts. Scatter chart, 2 series, 10 values, from 3.9 to 5.7
Categoryxy
Batch 110.24.1
Batch 110.64.4
Batch 19.83.9
Batch 110.94.6
Batch 110.14.2
Batch 211.45.1
Batch 211.95.4
Batch 211.14.8
Batch 212.35.7
Batch 211.75.2

Unstyled

unstyled removes the tectra styles: no tokens, no rings, no motion — the geometry, the colours of the series, the tooltip and the keyboard stay, ready for your own CSS.

Arrow keys move between values
Unstyled chart. Scatter chart, 1 series, 4 values, from 3 to 7
Categoryxy
Points13
Points25
Points34
Points47