Skip to content

Density scatter

Aggregate dense X/Y observations into spatial density.

Chart ID: densityScatter. Independent import: @revolist/charts/density-scatter.

Loading chart…

Inspect numeric concentration with aggregated cells. Dense groups become stronger cells, so a cell should not be mistaken for one original observation.

Bind numeric X and Y series explicitly. Bubble marks also require a non-negative size series. Channels reference stable series IDs, not labels. Parallel channel arrays can describe independent scatter/bubble groups.

The roles below describe the chart's data contract. Generic category/value roles resolve from the dataset; explicitly bind specialized numeric roles as shown in the complete example.

Data roleField count
category1 or more
x1
y1

Download the complete sample data and settings (JSON). See Data & Configuration for mapping, null values, updates and lifecycle rules.

Install the package using the installation guide, give the host an explicit height, and call createDensityScatterChart after the host mounts. This factory fixes the chart type to densityScatter.

<div id="chart" style="width: 100%; height: 450px;"></div>
Complete runnable TypeScript example with sample data
import { createDensityScatterChart } from '@revolist/charts/density-scatter';
const container = document.getElementById('chart')!;
const chart = await createDensityScatterChart({
container,
"dataset": {
"revision": 0,
"source": "client",
"categories": [
{
"id": "preview-category-0",
"label": "Alpha",
"path": [
"Alpha"
],
"labels": [
"Alpha"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-1",
"label": "Beta",
"path": [
"Beta"
],
"labels": [
"Beta"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-2",
"label": "Gamma",
"path": [
"Gamma"
],
"labels": [
"Gamma"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-3",
"label": "Delta",
"path": [
"Delta"
],
"labels": [
"Delta"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-4",
"label": "Epsilon",
"path": [
"Epsilon"
],
"labels": [
"Epsilon"
],
"depth": 1,
"kind": "leaf"
}
],
"series": [
{
"id": "preview-series-0",
"label": "Cost",
"columnPath": [
"Cost"
],
"labels": [
"Cost"
],
"kind": "leaf",
"prop": "preview-0"
},
{
"id": "preview-series-1",
"label": "Revenue",
"columnPath": [
"Revenue"
],
"labels": [
"Revenue"
],
"kind": "leaf",
"prop": "preview-1"
},
{
"id": "preview-series-2",
"label": "Volume",
"columnPath": [
"Volume"
],
"labels": [
"Volume"
],
"kind": "leaf",
"prop": "preview-2"
}
],
"values": [
[
18,
34,
12
],
[
31,
52,
28
],
[
46,
41,
18
],
[
58,
73,
42
],
[
76,
61,
32
]
],
"analyticalFrame": {
"fields": [
{
"id": "pivot:category",
"label": "pivot:category",
"role": "dimension",
"semanticType": "category"
},
{
"id": "pivot:series",
"label": "pivot:series",
"role": "dimension",
"semanticType": "category"
},
{
"id": "preview-series-0",
"label": "Cost",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-0"
},
{
"id": "preview-series-1",
"label": "Revenue",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-1"
},
{
"id": "preview-series-2",
"label": "Volume",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-2"
}
],
"observations": [
{
"id": "[\"preview-category-0\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Alpha",
"label": "Alpha",
"path": [
"Alpha"
],
"labels": [
"Alpha"
]
},
"pivot:series": {
"value": "Cost",
"label": "Cost",
"path": [
"Cost"
],
"labels": [
"Cost"
]
}
},
"measures": {
"preview-series-0": 18
}
},
{
"id": "[\"preview-category-0\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Alpha",
"label": "Alpha",
"path": [
"Alpha"
],
"labels": [
"Alpha"
]
},
"pivot:series": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
}
},
"measures": {
"preview-series-1": 34
}
},
{
"id": "[\"preview-category-0\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Alpha",
"label": "Alpha",
"path": [
"Alpha"
],
"labels": [
"Alpha"
]
},
"pivot:series": {
"value": "Volume",
"label": "Volume",
"path": [
"Volume"
],
"labels": [
"Volume"
]
}
},
"measures": {
"preview-series-2": 12
}
},
{
"id": "[\"preview-category-1\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Beta",
"label": "Beta",
"path": [
"Beta"
],
"labels": [
"Beta"
]
},
"pivot:series": {
"value": "Cost",
"label": "Cost",
"path": [
"Cost"
],
"labels": [
"Cost"
]
}
},
"measures": {
"preview-series-0": 31
}
},
{
"id": "[\"preview-category-1\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Beta",
"label": "Beta",
"path": [
"Beta"
],
"labels": [
"Beta"
]
},
"pivot:series": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
}
},
"measures": {
"preview-series-1": 52
}
},
{
"id": "[\"preview-category-1\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Beta",
"label": "Beta",
"path": [
"Beta"
],
"labels": [
"Beta"
]
},
"pivot:series": {
"value": "Volume",
"label": "Volume",
"path": [
"Volume"
],
"labels": [
"Volume"
]
}
},
"measures": {
"preview-series-2": 28
}
},
{
"id": "[\"preview-category-2\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Gamma",
"label": "Gamma",
"path": [
"Gamma"
],
"labels": [
"Gamma"
]
},
"pivot:series": {
"value": "Cost",
"label": "Cost",
"path": [
"Cost"
],
"labels": [
"Cost"
]
}
},
"measures": {
"preview-series-0": 46
}
},
{
"id": "[\"preview-category-2\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Gamma",
"label": "Gamma",
"path": [
"Gamma"
],
"labels": [
"Gamma"
]
},
"pivot:series": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
}
},
"measures": {
"preview-series-1": 41
}
},
{
"id": "[\"preview-category-2\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Gamma",
"label": "Gamma",
"path": [
"Gamma"
],
"labels": [
"Gamma"
]
},
"pivot:series": {
"value": "Volume",
"label": "Volume",
"path": [
"Volume"
],
"labels": [
"Volume"
]
}
},
"measures": {
"preview-series-2": 18
}
},
{
"id": "[\"preview-category-3\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Delta",
"label": "Delta",
"path": [
"Delta"
],
"labels": [
"Delta"
]
},
"pivot:series": {
"value": "Cost",
"label": "Cost",
"path": [
"Cost"
],
"labels": [
"Cost"
]
}
},
"measures": {
"preview-series-0": 58
}
},
{
"id": "[\"preview-category-3\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Delta",
"label": "Delta",
"path": [
"Delta"
],
"labels": [
"Delta"
]
},
"pivot:series": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
}
},
"measures": {
"preview-series-1": 73
}
},
{
"id": "[\"preview-category-3\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Delta",
"label": "Delta",
"path": [
"Delta"
],
"labels": [
"Delta"
]
},
"pivot:series": {
"value": "Volume",
"label": "Volume",
"path": [
"Volume"
],
"labels": [
"Volume"
]
}
},
"measures": {
"preview-series-2": 42
}
},
{
"id": "[\"preview-category-4\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Epsilon",
"label": "Epsilon",
"path": [
"Epsilon"
],
"labels": [
"Epsilon"
]
},
"pivot:series": {
"value": "Cost",
"label": "Cost",
"path": [
"Cost"
],
"labels": [
"Cost"
]
}
},
"measures": {
"preview-series-0": 76
}
},
{
"id": "[\"preview-category-4\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Epsilon",
"label": "Epsilon",
"path": [
"Epsilon"
],
"labels": [
"Epsilon"
]
},
"pivot:series": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
}
},
"measures": {
"preview-series-1": 61
}
},
{
"id": "[\"preview-category-4\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Epsilon",
"label": "Epsilon",
"path": [
"Epsilon"
],
"labels": [
"Epsilon"
]
},
"pivot:series": {
"value": "Volume",
"label": "Volume",
"path": [
"Volume"
],
"labels": [
"Volume"
]
}
},
"measures": {
"preview-series-2": 32
}
}
],
"matrixCells": [
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-0\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-0\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-0\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-1\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-1\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-1\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-2\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-2\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-2\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-3",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-3\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-3",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-3\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-3",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-3\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-4",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-4\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-4",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-4\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-4",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-4\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
}
]
}
},
"bindings": {
"x": [
"preview-series-0"
],
"y": [
"preview-series-1"
]
},
"presentation": {
"dataLabels": false
}
});
// When the host unmounts:
// chart.destroy();

Await updates before reading a snapshot or exporting. Call chart.destroy() when the host unmounts. See the live catalog to interact with this type.

Set these fields in chartOptions. The option schema validates supported keys, ranges and choices; updating chartOptions replaces that authored object.

OptionDefaultAccepted values
showGridLinestruetrue or false
markOpacity10.2 to 1; step 0.05

Titles, legends, theme and labels belong to presentation or the corresponding top-level setting. Axis, color, navigation and interaction support depends on the selected chart; see Data & Configuration.

  • Scatter — Compare two measures as points across categories.
  • Bubble — Compare two measures while bubble area represents a third measure.
  • Connected scatter — Show the ordered path between paired X/Y observations.
  • Quadrant chart — Compare observations across four decision regions.

Charts overview · Installation · Data & Configuration