Skip to main content
196

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Data display

ScatterChart

Shows numeric relationships and bubble magnitude across one or more series.

FrameworksAstro · React · Elements

Registry commandlumen add ScatterChart

InteractionEnhanced runtime

← All chart guides · Framework setup · Native counterparts

01

See it and copy it

Framework example

Explore the live chart, then open its code for Astro, React, or Elements.

AstroCode target · live preview uses Astro

Engagement and conversion

X: weekly active users (%) · Y: trial conversion (%)

3 series, 22 points. Values range from 12 to 84.

  • Self-serve
  • Guided onboarding
  • Partner-led
View chart data
XSeriesValueSize
18Self-serve1244
27Self-serve2172
34Self-serve1856
42Self-serve3296
51Self-serve2864
58Self-serve4382
66Self-serve3848
74Self-serve5260
24Guided onboarding2932
36Guided onboarding4256
44Guided onboarding3844
53Guided onboarding5574
62Guided onboarding5192
69Guided onboarding6762
78Guided onboarding6248
86Guided onboarding7836
31Partner-led3424
46Partner-led4838
57Partner-led6352
67Partner-led5866
76Partner-led7646
91Partner-led8430
September 2026 · Each bubble is a trial cohort; size represents 24–96 teams. Illustrative data compares three onboarding channels.
View ScatterChart code

Framework usage

Switch targets to compare the adapter code. This live preview runs the Astro example. React and Elements use their own behavior APIs; complete the matching framework setup before copying an example.
astro
---
import { ScatterChart } from '@santi020k/lumen-astro'
import type { LumenChartSeries } from '@santi020k/lumen-core'

const series = [
  {
    id: 'self-serve',
    label: 'Self-serve',
    tone: 'series-1',
    data: [
      { x: 18, y: 12, size: 44 },
      { x: 27, y: 21, size: 72 },
      { x: 34, y: 18, size: 56 },
      { x: 42, y: 32, size: 96 },
      { x: 51, y: 28, size: 64 },
      { x: 58, y: 43, size: 82 },
      { x: 66, y: 38, size: 48 },
      { x: 74, y: 52, size: 60 }
    ]
  },
  {
    id: 'guided',
    label: 'Guided onboarding',
    tone: 'series-2',
    data: [
      { x: 24, y: 29, size: 32 },
      { x: 36, y: 42, size: 56 },
      { x: 44, y: 38, size: 44 },
      { x: 53, y: 55, size: 74 },
      { x: 62, y: 51, size: 92 },
      { x: 69, y: 67, size: 62 },
      { x: 78, y: 62, size: 48 },
      { x: 86, y: 78, size: 36 }
    ]
  },
  {
    id: 'partner',
    label: 'Partner-led',
    tone: 'series-3',
    data: [
      { x: 31, y: 34, size: 24 },
      { x: 46, y: 48, size: 38 },
      { x: 57, y: 63, size: 52 },
      { x: 67, y: 58, size: 66 },
      { x: 76, y: 76, size: 46 },
      { x: 91, y: 84, size: 30 }
    ]
  }
] satisfies readonly LumenChartSeries[]
---

<ScatterChart
  aria-label="Trial conversion by weekly product engagement and onboarding channel"
  heading="Engagement and conversion"
  description="X: weekly active users (%) · Y: trial conversion (%)"
  caption="September 2026 · Each bubble is a trial cohort; size represents 24–96 teams. Illustrative data compares three onboarding channels."
  {series}
/>
Edit ScatterChart in browser

Framework differences

Elements: Pass series as a JSON attribute or through the public element property. The Elements example serializes the sample data with JSON.stringify; Astro expression bindings are not HTML attributes.

When to use ScatterChart

Use to explore relationships, clusters, and outliers across observations with both X and Y measurements.

  • Point position shows the X/Y pair. When size is supplied, explain what bubble magnitude represents in the caption.
  • Use labeled references for meaningful lines or regions, such as a threshold. The data table retains both coordinates and supplied size.

Prepare the data

ts
import type { LumenChartSeries } from '@santi020k/lumen-core'

const series = [{
  id: 'teams',
  label: 'Teams',
  data: [
    { id: 'starter', label: 'Starter teams', x: 12, y: 24, size: 18 },
    { id: 'growing', label: 'Growing teams', x: 38, y: 57, size: 32 }
  ]
}] satisfies readonly LumenChartSeries[]
  • Use finite numeric X values for the default linear scale, or timestamps/ISO dates for xScale="time". Logarithmic X values must be positive.
  • Y measurements are finite numbers or null. Optional size values must be finite and nonnegative; use labels to identify observations.
  • domain controls Y and xDomain controls X. formatX and formatY let each axis use its own measurement unit.

Shared data and formatting guidance →

Avoid misleading comparisons

  • Association does not establish causation. State the population and relevant sampling limits.
  • Overlapping points can hide observations. Inspect exact data and consider grouping or filtering in the application when the plot becomes dense.

Chart accessibility and keyboard guidance →

02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add ScatterChart
lumen add ScatterChart

API reference

Lumen-specific props and runtime attributes for the Astro primitive. Use the framework differences above and the copyable examples for React composition and Elements attributes; the public adapter types define their supported contracts.

AttributeValuesDefaultDescription
drilldownboolean (Astro / Elements attribute)falseEnables plotted datum actions and an equivalent native button disclosure, including with hidden tables. Astro requires UIPrimitives; Elements owns its lifecycle.
onDatumActivate(detail: LumenChartDatumActivationDetail) => void (React)-Enables React datum actions and receives validated values with raw identities. Navigation and filtering remain application owned.
explore-data-label, datum-action-prefix, datumActionFormatterstring attributes, (context: string) => string property (Elements)English labelsLocalizes the Elements disclosure and datum actions.
labels.exploreData, labels.formatDatumActionstring, (context: string) => stringEnglish labelsLocalizes the actions disclosure and each contextual datum button.
formatX, formatYformatter callbacksString, formatValueFormats independent units without altering numeric geometry.
xDomain, domainPartial<LumenChartDomain>derivedProvides explicit X and Y bounds; log X requires positive increasing values.
referencesreadonly LumenScatterReference[][]Draws labeled reference lines or regions using the same scales as points.
seriesLumenChartSeries[][]Provides x/y points with optional labels and bubble sizes.
xScale"linear" | "time" | "log""linear"Selects the numeric x-axis scale used to position points.
formatValue(value: number) => stringStringFormats point values and bubble sizes in titles and the accessible table.
showLegendbooleantrue for multiple seriesShows the color-independent series key.
showTablebooleantrueProvides a revealable semantic table containing every point.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Keyboard interactions

Keyboard behavior provided by the Astro UIPrimitives runtime for this component.

KeyAction
TabFocus the actions disclosure and its native buttons in document order.
Enter, SpaceToggle the disclosure or activate the focused datum button. Actions remain available when the data table is hidden.

Runtime events

CustomEvents dispatched by the Astro UIPrimitives runtime for this component.

EventTargetDetailWhen
ui:chart-datum-activateAstro chart figure or Elements data chart hostLumenChartDatumActivationDetail: series { seriesId, x, y, datumId? }, heatmap { x, y, value, datumId? }, range { x, low, high, datumId? }Fires once after a plotted datum or its native action button is activated. Requires drilldown. Astro uses UIPrimitives, Elements owns its lifecycle, and React uses onDatumActivate instead.

Web docsFull catalog