Skip to content

Commit 69a4e2b

Browse files
[docs] Group demos data into the dataset folder (#19549)
1 parent 844f100 commit 69a4e2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+317
-658
lines changed
File renamed without changes.
File renamed without changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[
2+
{ "id": "data-1", "x1": 21, "y1": 201, "x2": 144, "y2": 17 },
3+
{ "id": "data-2", "x1": 242, "y1": 428, "x2": 159, "y2": 85 },
4+
{ "id": "data-3", "x1": 156, "y1": 324, "x2": 292, "y2": 196 },
5+
{ "id": "data-4", "x1": 42, "y1": 254, "x2": 226, "y2": 190 },
6+
{ "id": "data-5", "x1": 23, "y1": 209, "x2": 150, "y2": 38 },
7+
{ "id": "data-6", "x1": 228, "y1": 418, "x2": 297, "y2": 206 },
8+
{ "id": "data-7", "x1": 16, "y1": 194, "x2": 181, "y2": 110 },
9+
{ "id": "data-8", "x1": 145, "y1": 326, "x2": 295, "y2": 213 },
10+
{ "id": "data-9", "x1": 0, "y1": 241, "x2": 368, "y2": 282 },
11+
{ "id": "data-10", "x1": 133, "y1": 311, "x2": 314, "y2": 201 },
12+
{ "id": "data-11", "x1": 182, "y1": 362, "x2": 309, "y2": 224 },
13+
{ "id": "data-12", "x1": 14, "y1": 212, "x2": 353, "y2": 301 },
14+
{ "id": "data-13", "x1": 95, "y1": 321, "x2": 225, "y2": 128 },
15+
{ "id": "data-14", "x1": 27, "y1": 209, "x2": 330, "y2": 294 },
16+
{ "id": "data-15", "x1": 153, "y1": 382, "x2": 181, "y2": 74 },
17+
{ "id": "data-16", "x1": 180, "y1": 342, "x2": 196, "y2": 154 },
18+
{ "id": "data-17", "x1": 15, "y1": 197, "x2": 268, "y2": 177 },
19+
{ "id": "data-18", "x1": 94, "y1": 311, "x2": 348, "y2": 224 },
20+
{ "id": "data-19", "x1": 125, "y1": 270, "x2": 370, "y2": 281 },
21+
{ "id": "data-20", "x1": 241, "y1": 476, "x2": 280, "y2": 228 }
22+
]

docs/data/charts/dataset/usUnemploymentRate.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
33
* Updated: Jun 6, 2025 7:46 AM CDT
44
*/
55

6+
export const dateAxisFormatter = (value, context) =>
7+
value.toLocaleDateString(undefined, {
8+
month:
9+
// eslint-disable-next-line no-nested-ternary
10+
context.location === 'tick'
11+
? undefined
12+
: context.location === 'tooltip'
13+
? 'long'
14+
: 'short',
15+
year: 'numeric',
16+
});
17+
18+
export const percentageFormatter = (value) =>
19+
value === null
20+
? ''
21+
: new Intl.NumberFormat(undefined, {
22+
style: 'percent',
23+
minimumSignificantDigits: 1,
24+
maximumSignificantDigits: 3,
25+
}).format(value / 100);
26+
627
export const usUnemploymentRate = [
728
{ date: new Date('1948-01-01'), rate: 3.4 },
829
{ date: new Date('1948-02-01'), rate: 3.8 },

docs/data/charts/dataset/usUnemploymentRate.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
33
* Updated: Jun 6, 2025 7:46 AM CDT
44
*/
55

6+
import { AxisValueFormatterContext } from '@mui/x-charts/models';
7+
8+
export const dateAxisFormatter = (value: Date, context: AxisValueFormatterContext<'time'>) =>
9+
value.toLocaleDateString(undefined, {
10+
month:
11+
// eslint-disable-next-line no-nested-ternary
12+
context.location === 'tick' ? undefined : context.location === 'tooltip' ? 'long' : 'short',
13+
year: 'numeric',
14+
});
15+
16+
export const percentageFormatter = (value: number | null) =>
17+
value === null
18+
? ''
19+
: new Intl.NumberFormat(undefined, {
20+
style: 'percent',
21+
minimumSignificantDigits: 1,
22+
maximumSignificantDigits: 3,
23+
}).format(value / 100);
24+
625
export const usUnemploymentRate = [
726
{ date: new Date('1948-01-01'), rate: 3.4 },
827
{ date: new Date('1948-02-01'), rate: 3.8 },
File renamed without changes.
File renamed without changes.

docs/data/charts/export/ExportChartToolbarCustomization.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export default function ExportChartToolbarCustomization() {
7171
if (context.location === 'tick' && context.defaultTickLabel === '') {
7272
return '';
7373
}
74-
7574
return populationFormatter.format(value);
7675
},
7776
zoom: true,

docs/data/charts/export/ExportChartToolbarCustomization.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export default function ExportChartToolbarCustomization() {
7474
if (context.location === 'tick' && context.defaultTickLabel === '') {
7575
return '';
7676
}
77-
7877
return populationFormatter.format(value);
7978
},
8079
zoom: true,

docs/data/charts/highlighting/ElementHighlights.js

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { LineChart } from '@mui/x-charts/LineChart';
1212
import { ScatterChart } from '@mui/x-charts/ScatterChart';
1313
import { PieChart } from '@mui/x-charts/PieChart';
1414

15+
import scatterDataset from '../dataset/random/scatterParallel.json';
16+
1517
const barChartsParams = {
1618
series: [
1719
{ data: [3, 4, 1, 6, 5], label: 'A' },
@@ -31,37 +33,10 @@ const lineChartsParams = {
3133
};
3234

3335
const scatterChartsParams = {
36+
dataset: scatterDataset,
3437
series: [
35-
{
36-
data: [
37-
{ x: 6.5e-2, y: -1.3, id: 0 },
38-
{ x: -2.1, y: -7.0e-1, id: 1 },
39-
{ x: -7.6e-1, y: -6.7e-1, id: 2 },
40-
{ x: -1.5e-2, y: -2.0e-1, id: 3 },
41-
{ x: -1.4, y: -9.9e-1, id: 4 },
42-
{ x: -1.1, y: -1.5, id: 5 },
43-
{ x: -7.0e-1, y: -2.7e-1, id: 6 },
44-
{ x: -5.1e-1, y: -8.8e-1, id: 7 },
45-
{ x: -4.0e-3, y: -1.4, id: 8 },
46-
{ x: -1.3, y: -2.2, id: 9 },
47-
],
48-
label: 'A',
49-
},
50-
{
51-
data: [
52-
{ x: 1.8, y: -1.7e-2, id: 0 },
53-
{ x: 7.1e-1, y: 2.6e-1, id: 1 },
54-
{ x: -1.2, y: 9.8e-1, id: 2 },
55-
{ x: 2.0, y: -2.0e-1, id: 3 },
56-
{ x: 9.4e-1, y: -2.7e-1, id: 4 },
57-
{ x: -4.8e-1, y: -1.6e-1, id: 5 },
58-
{ x: -1.5, y: 1.1, id: 6 },
59-
{ x: 1.3, y: 3.4e-1, id: 7 },
60-
{ x: -4.2e-1, y: 1.0e-1, id: 8 },
61-
{ x: 5.4e-2, y: 4.0e-1, id: 9 },
62-
],
63-
label: 'B',
64-
},
38+
{ datasetKeys: { id: 'id', x: 'x1', y: 'y1' }, label: 'A' },
39+
{ datasetKeys: { id: 'id', x: 'x2', y: 'y2' }, label: 'B' },
6540
],
6641
height: 400,
6742
};

0 commit comments

Comments
 (0)