From f30009417f90743b6b0118a06a34cb2455a93031 Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 21 Jul 2025 23:35:55 +0200 Subject: [PATCH] Mon 21 Jul 22:43:21 CEST 2025 --- js/ui/chart/docs/charts/scatter.md | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 js/ui/chart/docs/charts/scatter.md diff --git a/js/ui/chart/docs/charts/scatter.md b/js/ui/chart/docs/charts/scatter.md new file mode 100644 index 0000000..0107fd4 --- /dev/null +++ b/js/ui/chart/docs/charts/scatter.md @@ -0,0 +1,49 @@ +# Scatter Chart + +Scatter charts are based on basic line charts with the x axis changed to a linear axis. To use a scatter chart, data must be passed as objects containing X and Y properties. The example below creates a scatter chart with 3 points. + +```javascript +var scatterChart = new Chart(ctx, { + type: 'scatter', + data: { + datasets: [{ + label: 'Scatter Dataset', + data: [{ + x: -10, + y: 0 + }, { + x: 0, + y: 10 + }, { + x: 10, + y: 5 + }] + }] + }, + options: { + scales: { + xAxes: [{ + type: 'linear', + position: 'bottom' + }] + } + } +}); +``` + +## Dataset Properties +The scatter chart supports all of the same properties as the [line chart](./line.md#dataset-properties). + +## Data Structure + +Unlike the line chart where data can be supplied in two different formats, the scatter chart only accepts data in a point format. + +```javascript +data: [{ + x: 10, + y: 20 + }, { + x: 15, + y: 10 + }] +```