Scatter.
COMMUNITYShow relationships between two continuous variables as individual points.
LIVE EXAMPLE
Two measurements
Appearance and style6
Axes and grid lines14
Legend and interaction15
Title and dimensions3
Explore the relationship between X and Y as individual points. All values are sample data.
View code
<div id="chart-container" style="width: 100%; min-width: 0;"></div>
<script type="module">
import { defineCustomElement as define0 } from '@syidax/advanced/components/sy-scatter-chart.js';
define0();
const specs = [
{
"id": "example-chart",
"tag": "sy-scatter-chart",
"props": {
"engine": "standard",
"values": [
{
"x": 0,
"y": 7
},
{
"x": 16,
"y": 4
},
{
"x": 29,
"y": -3
},
{
"x": 37,
"y": -7
},
{
"x": 44,
"y": -5
},
{
"x": 55,
"y": 2
},
{
"x": -1,
"y": 17
},
{
"x": 15,
"y": 15
},
{
"x": 29,
"y": 9
},
{
"x": 38,
"y": 4
},
{
"x": 45,
"y": 4
},
{
"x": 55,
"y": 10
},
{
"x": -3,
"y": 26
},
{
"x": 14,
"y": 26
},
{
"x": 29,
"y": 21
},
{
"x": 39,
"y": 15
},
{
"x": 47,
"y": 13
},
{
"x": 55,
"y": 18
},
{
"x": -4,
"y": 35
},
{
"x": 13,
"y": 37
},
{
"x": 29,
"y": 33
},
{
"x": 40,
"y": 26
},
{
"x": 48,
"y": 23
},
{
"x": 56,
"y": 26
},
{
"x": -5,
"y": 43
},
{
"x": 11,
"y": 47
},
{
"x": 28,
"y": 45
},
{
"x": 41,
"y": 38
},
{
"x": 49,
"y": 33
},
{
"x": 57,
"y": 35
},
{
"x": -5,
"y": 51
},
{
"x": 10,
"y": 56
},
{
"x": 27,
"y": 56
},
{
"x": 41,
"y": 50
},
{
"x": 51,
"y": 44
},
{
"x": 58,
"y": 44
}
],
"markerSize": 5,
"xAxis": {
"kind": "linear"
},
"yAxis": {
"kind": "linear"
},
"width": 640,
"height": 360,
"brandPosition": "bottom-right",
"brandLogo": ""
}
}
];
const container = document.querySelector('#chart-container');
const elements = specs.map(({ tag, id, props }) => {
const element = document.createElement(tag);
element.id = id;
Object.assign(element, props);
element.setAttribute('aria-label', 'scatter example chart');
return element;
});
container.replaceChildren(...elements);
const chart = elements.at(-1);
const onEvent = event => {
console.log('pointClick', event.detail);
};
chart.addEventListener('pointClick', onEvent);
const observer = new ResizeObserver(([entry]) => {
const width = Math.max(160, Math.floor(entry.contentRect.width));
elements.forEach(element => { element.width = width; });
});
observer.observe(container);
// In an SPA, call this function when the view is disposed.
function disposeChart() {
observer.disconnect();
chart.removeEventListener('pointClick', onEvent);
container.replaceChildren();
}
</script>Usage and data
#Explore correlation, clusters, and outliers. Use series to distinguish observation groups.
A visible relationship does not establish causation. Adjust marker size or sample count to inspect overlapping points.
Data contract
| Property | Input format |
|---|---|
values | An array of [x, y] or { x, y }. |
series | Set values, name, and color for each group. |
xAxis | Use a linear axis for continuous coordinates. |
Updating data
Assign a new array or object to the property instead of mutating values inside an array. Chart events provide selection results through event.detail. When disposing of the view, clean up ResizeObserver and event listeners registered by your app.
Feature examples
#Try 31 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.
Marker size and outline
Show the same observations with larger markers and distinct outlines.
View code
Highlight points on hover
Hover over a point to dim other points. Move away to restore them.
View code
Right-side legend
Place the legend on the right. Click items to hide or show series.
View code
Inspect values with the pointer
Point to data to view the value at that location.
View code
Crosshair tracking
Move the pointer to read horizontal and vertical coordinates alongside values.
View code
Drag to zoom and pan
Drag to zoom and hold Shift to pan. Use Ctrl + wheel to zoom in or out.
View code
Replay animation
Redraw the same example to inspect its initial display animation.
View code
Animation
Compare 1 examples of Animation. Buttons and options update both the live result and source code.
View code
Axis
Compare 10 examples of Axis. Buttons and options update both the live result and source code.
View code
Crosshair
Compare 5 examples of Crosshair. Buttons and options update both the live result and source code.
View code
Engine Compare
Compare 2 examples of Engine Compare. Buttons and options update both the live result and source code.
View code
Legend
Compare 3 examples of Legend. Buttons and options update both the live result and source code.
View code
Marker
Compare 1 examples of Marker. Buttons and options update both the live result and source code.
View code
Null Values
Compare 1 examples of Null Values. Buttons and options update both the live result and source code.
View code
Large datasets
Compare 1 examples of Large datasets. Buttons and options update both the live result and source code.
View code
Highlight state
Compare 6 examples of Highlight state. Buttons and options update both the live result and source code.
View code
Series
Compare 7 examples of Series. Buttons and options update both the live result and source code.
View code
Size
Compare 3 examples of Size. Buttons and options update both the live result and source code.
View code
Symbols
Compare 1 examples of Symbols. Buttons and options update both the live result and source code.
View code
Tooltip
Compare 12 examples of Tooltip. Buttons and options update both the live result and source code.
View code
Data input
Compare 4 examples of Data input. Buttons and options update both the live result and source code.
View code
Visual Map
Compare 1 examples of Visual Map. Buttons and options update both the live result and source code.
View code
Zoom and pan
Compare 6 examples of Zoom and pan. Buttons and options update both the live result and source code.
View code
Context menu
Compare 1 examples of Context menu. Buttons and options update both the live result and source code.
View code
Data context menu
Compare 1 examples of Data context menu. Buttons and options update both the live result and source code.
View code
Read coordinates and data
Compare 2 examples of Read coordinates and data. Buttons and options update both the live result and source code.
View code
Runtime API
Compare 1 examples of Runtime API. Buttons and options update both the live result and source code.
View code
Overview
Compare 1 examples of Overview. Buttons and options update both the live result and source code.
View code
Streaming · Live updatesPRO
Select Start to add one data point at a time. The latest 40 items are shown, with controls for update speed, pause, and reset.
View code
Streaming · Add batchesPRO
Select Start to add four data points at a time. The latest 40 items are shown, with controls for update speed, pause, and reset.
View code
Streaming · Add and update live dataPRO
Compare 2 examples of Add and update live data. Buttons and options update both the live result and source code.
View code
Add to your interface
#The code tabs below the preview contain the full data, options, event bindings, and responsive sizing for the current example. Copy them into an app project, such as Vite, that can resolve the installed packages.
API reference
#The full public API for sy-scatter-chart. Pass objects and arrays as JavaScript properties. Select a name to view usage code and type definitions.
Key properties
| Attribute / Property | Type / Default | Description |
|---|---|---|
ScatterChartSeries[]Default: undefined | Set values, name, and color for each group. | |
ScatterChartValuesDefault: [] | An array of [x, y] or { x, y }. | |
numberDefault: 600 | Chart width in pixels. Update with ResizeObserver when the container changes. | |
numberDefault: 360 | Chart height in pixels. | |
| brandLogo | stringDefault: undefined | The default is the Syidax logo. With the Pro chart.branding entitlement, use none or a PNG, JPEG, or WebP data URL. |
| brandPosition | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'Default: 'bottom-right' | The corner where the logo is anchored. Applies equally to Community and Pro, on screen and in image exports. |
| markerSize | numberDefault: 4 | Set as an HTML attribute or JavaScript property. type: number. |
| markerLineWidth | numberDefault: 0 | Set as an HTML attribute or JavaScript property. type: number. |
| inactiveOtherPoints | booleanDefault: false | Set as an HTML attribute or JavaScript property. type: boolean. |
| inactivePointOpacity | numberDefault: 0.2 | Set as an HTML attribute or JavaScript property. type: number. |
| animated | booleanDefault: false | Whether to animate initial display and data changes. |
| animationDuration | numberDefault: 400 | Animation duration in milliseconds. |
| animationEasing | ScatterChartEasingDefault: 'ease-out' | Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'. |
| animationType | ScatterChartAnimationTypeDefault: undefined | Allowed values: initial, update. Default: undefined. |
booleanDefault: false | Whether to show a legend for series or items. | |
| legendPosition | ScatterChartLegendPositionDefault: 'bottom' | Where the legend is positioned. |
| xAxis | CartesianAxisInput | ReadonlyArray<CartesianAxisInput>Default: undefined | Use a linear axis for continuous coordinates. |
| yAxis | CartesianYAxisInputDefault: undefined | Allowed values: auto, off. Default: undefined. |
| chartTitle | stringDefault: undefined | The title inside the chart. Explain the data's unit and meaning alongside it. |
| chartSubtitle | stringDefault: undefined | The subtitle inside the chart. |
CartesianTooltipInputDefault: undefined | Tooltip settings for pointer-driven values, position, and content. | |
CartesianCrosshairInputDefault: undefined | Pass as a JavaScript property. type: CartesianCrosshairInput. | |
| gridLines | CartesianGridLinesInputDefault: undefined | Allowed values: auto, off. Default: undefined. |
CartesianZoomInputDefault: undefined | Settings for zooming and the visible range. |
Other properties 22
| Attribute / Property | Type / Default | Description |
|---|---|---|
| activeSeriesIndex | numberDefault: undefined | Set as an HTML attribute or JavaScript property. type: number. |
| seriesState | ScatterChartSeriesStateOptionsDefault: undefined | Pass as a JavaScript property. type: ScatterChartSeriesStateOptions. |
| seriesActiveTrigger | ScatterChartSeriesActiveTriggerDefault: 'hover' | Allowed values: hover, click, custom. Default: 'hover'. |
stringDefault: '#2563eb' | Set as an HTML attribute or JavaScript property. type: string. | |
ScatterChartMarkerSymbolDefault: 'circle' | Allowed values: circle, square, triangle, cross, diamond, star, triangle-down, wye. Default: 'circle'. | |
| hitTolerance | numberDefault: 8 | Set as an HTML attribute or JavaScript property. type: number. |
ScatterChartEngineModeDefault: 'auto' | Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type. | |
| proThreshold | numberDefault: 50_000 | Set as an HTML attribute or JavaScript property. type: number. |
ScatterChartUnavailableBehaviourDefault: 'fallback' | Allowed values: fallback, error. Default: 'fallback'. | |
| streamSource | ScatterChartStreamSourceDefault: undefined | A stream source for live data. Check the contract for the specific type. |
| streamWindow | numberDefault: undefined | The streaming data range to keep visible. |
| streamMax | numberDefault: undefined | The maximum number of streaming data points to retain. |
| legendItems | LegendItem[]Default: undefined | Pass as a JavaScript property. type: LegendItem[]. |
| seriesName | stringDefault: undefined | Set as an HTML attribute or JavaScript property. type: string. |
CartesianBrushInputDefault: undefined | Allowed values: auto, off, true, false, rect, lasso. Default: undefined. | |
ChartDrawingsInputDefault: undefined | Pass as a JavaScript property. type: ChartDrawingsInput. | |
| drawingMode | DrawingModeInputDefault: undefined | Allowed values: none, off, true, false, draw, select. Default: undefined. |
| drawingTool | stringDefault: undefined | Set as an HTML attribute or JavaScript property. type: string. |
| drawingSpace | DrawingSpaceDefault: undefined | Allowed values: data, pixel. Default: undefined. |
number | booleanDefault: undefined | Pass as a JavaScript property. type: number | boolean. | |
| progressiveThreshold | numberDefault: 20000 | Set as an HTML attribute or JavaScript property. type: number. |
| visualMap | VisualMapBinding | nullDefault: undefined | Pass as a JavaScript property. type: VisualMapBinding | null. |
Events 24
| Events | Detail type | Description |
|---|---|---|
ScatterChartRenderResult & { tier: ScatterChartEngineTier } | Emits rendering results in detail when chart drawing completes. | |
{ count: number } | CustomEvent.detail type: { count: number }. Event names are case-sensitive. | |
{ dropped: number } | CustomEvent.detail type: { dropped: number }. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
CartesianCrosshairEventDetail | null | CustomEvent.detail type: CartesianCrosshairEventDetail | null. Event names are case-sensitive. | |
CartesianTooltipEventDetail | Whether to display the built-in tooltip. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
CartesianTooltipActionEventDetail | CustomEvent.detail type: CartesianTooltipActionEventDetail. Event names are case-sensitive. | |
CartesianZoomChangeEventDetail | CustomEvent.detail type: CartesianZoomChangeEventDetail. Event names are case-sensitive. | |
CartesianBrushChangeEventDetail | CustomEvent.detail type: CartesianBrushChangeEventDetail. Event names are case-sensitive. | |
CartesianBrushStartEventDetail | CustomEvent.detail type: CartesianBrushStartEventDetail. Event names are case-sensitive. | |
CartesianBrushMoveEventDetail | CustomEvent.detail type: CartesianBrushMoveEventDetail. Event names are case-sensitive. | |
CartesianBrushEndEventDetail | CustomEvent.detail type: CartesianBrushEndEventDetail. Event names are case-sensitive. | |
DrawingsChangeEventDetail | CustomEvent.detail type: DrawingsChangeEventDetail. Event names are case-sensitive. | |
DrawingSelectionChangeEventDetail | CustomEvent.detail type: DrawingSelectionChangeEventDetail. Event names are case-sensitive. | |
{ drawn: number; total: number; done: boolean } | CustomEvent.detail type: { drawn: number; total: number; done: boolean }. Event names are case-sensitive. | |
CartesianPointEventDetail | null | CustomEvent.detail type: CartesianPointEventDetail | null. Event names are case-sensitive. | |
CartesianPointEventDetail | A point selection event. Read the selected data and index from CustomEvent.detail. | |
ChartPointContextMenuEventDetail<CartesianPointEventDetail> | CustomEvent.detail type: ChartPointContextMenuEventDetail<CartesianPointEventDetail>. Event names are case-sensitive. | |
CartesianSeriesOutsideClickEventDetail | CustomEvent.detail type: CartesianSeriesOutsideClickEventDetail. Event names are case-sensitive. | |
ScatterChartLegendItemEventDetail | CustomEvent.detail type: ScatterChartLegendItemEventDetail. Event names are case-sensitive. | |
ScatterChartSeriesToggledEventDetail | CustomEvent.detail type: ScatterChartSeriesToggledEventDetail. Event names are case-sensitive. |
Methods 51
Stencil methods return Promises. Use await within an async function to read the result.
| Method / Arguments | Return type | Description |
|---|---|---|
Promise<ScatterChartRenderResult> | An asynchronous method. Check the argument and return types below. | |
Promise<ScatterChartEngineTier> | An asynchronous method. Check the argument and return types below. | |
| options: ScatterChartSeries, opts?: { redraw?: boolean; insertAt?: number } | Promise<number> | An asynchronous method. Check the argument and return types below. |
| idOrIndex: string | number, opts?: { redraw?: boolean } | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
| idOrIndex: string | number, patch: Partial<ScatterChartSeries>, opts?: { redraw?: boolean } | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
| idOrIndex: string | number, data: ScatterChartValues, opts?: { redraw?: boolean } | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
| idOrIndex: string | number, point: number | readonly [number, number] | { x?: number; y: number }, opts?: { shift?: boolean; redraw?: boolean } | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
| id: string | number, opts?: { redraw?: boolean } | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
| id: string | number, opts?: { redraw?: boolean } | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
| point: ScatterChartDatum | Promise<void> | An asynchronous method. Check the argument and return types below. |
| idOrIndex: string | number, points: ReadonlyArray<unknown> | Promise<void> | An asynchronous method. Check the argument and return types below. |
| idOrIndex: string | number, count?: number | Promise<void> | An asynchronous method. Check the argument and return types below. |
| idOrIndex: string | number, points: ReadonlyArray<unknown> | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<ScatterChartStreamSource | undefined> | An asynchronous method. Check the argument and return types below. | |
Promise<ChartEngineStatus> | The requested engine, the engine that draws and why (ROADMAP-loading §5.3). A Chart Pro license decision names `chart.webgpu` and its state; renderer causes (not in this build, no WebGPU, a failed GPU) stay apart. | |
| options: { duration?: number; easing?: ScatterChartEasing; enabled?: boolean; type?: ScatterChartAnimationType } | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
| cssX: number, cssY: number | Promise<{ pointIndex: number; seriesIndex: number } | null> | An asynchronous method. Check the argument and return types below. |
| pointIndex: number, seriesIndex?: number | Promise<CartesianTooltipEventDetail | null> | An asynchronous method. Check the argument and return types below. |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
| request: CartesianZoomRequest | Promise<CartesianZoomChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. |
| factor: number, anchorFraction?: number | Promise<CartesianZoomChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. |
| delta: { x?: number; y?: number } | Promise<CartesianZoomChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. |
Promise<CartesianZoomChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. | |
Promise<CartesianZoomState | null> | An asynchronous method. Check the argument and return types below. | |
| request?: CartesianZoomExtentRequest | Promise<CartesianZoomExtentDetail | null> | An asynchronous method. Check the argument and return types below. |
| request: CartesianCrosshairShowRequest | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<ChartDrawing[]> | An asynchronous method. Check the argument and return types below. | |
| drawings: ReadonlyArray<ChartDrawingInput> | null | Promise<DrawingsChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. |
| drawing: ChartDrawingInput | Promise<ChartDrawing | null> | An asynchronous method. Check the argument and return types below. |
| id: string, patch: Partial<Omit<ChartDrawing, 'id'>> | Promise<ChartDrawing | null> | An asynchronous method. Check the argument and return types below. |
| id: string | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
| ids: ReadonlyArray<string> | Promise<DrawingsChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. |
| id: string, space: DrawingSpace | Promise<ChartDrawing | null> | An asynchronous method. Check the argument and return types below. |
Promise<DrawingsChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. | |
Promise<DrawingsChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. | |
Promise<DrawingsChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. | |
Promise<DrawingLayerSnapshot | null> | An asynchronous method. Check the argument and return types below. | |
Promise<string> | An asynchronous method. Check the argument and return types below. | |
| input: ChartDrawingsInput | Promise<DrawingsChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. |
| ids: ReadonlyArray<string> | null | Promise<DrawingSelectionChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. |
Promise<string[]> | An asynchronous method. Check the argument and return types below. | |
| areas: ReadonlyArray<CartesianBrushAreaInput> | null | Promise<CartesianBrushChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. |
Promise<CartesianBrushChangeEventDetail | null> | An asynchronous method. Check the argument and return types below. | |
Promise<CartesianBrushArea[]> | An asynchronous method. Check the argument and return types below. | |
Promise<CartesianBrushSelectedSeries[]> | An asynchronous method. Check the argument and return types below. | |
| binding: VisualMapBinding | null | Promise<VisualMapBinding | null> | Bind (or clear) a visual map: every mark is coloured through it on the next paint. |
Promise<VisualMapBinding | null> | An asynchronous method. Check the argument and return types below. | |
| request?: VisualMapExtentRequest | Promise<VisualMapExtent | null> | The extent of a dimension over the visible points — what a bound `sy-visual-map` adopts as its domain. |
No matching APIs.