@mui/x-charts 8.10.0 → 8.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.js +4 -0
- package/CHANGELOG.md +182 -0
- package/ChartContainer/ChartContainer.js +6 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/ChartsLabel/labelGradientClasses.d.ts +1 -1
- package/ChartsLabel/labelMarkClasses.d.ts +1 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +8 -2
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipTable.js +1 -0
- package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
- package/ChartsXAxis/ChartsGroupedXAxis.js +1 -0
- package/ChartsXAxis/useAxisProps.d.ts +9 -9
- package/ChartsXAxis/utilities.d.ts +1 -1
- package/ChartsYAxis/ChartsGroupedYAxis.d.ts +7 -0
- package/ChartsYAxis/ChartsGroupedYAxis.js +144 -0
- package/ChartsYAxis/ChartsSingleYAxis.d.ts +7 -0
- package/ChartsYAxis/ChartsSingleYAxis.js +133 -0
- package/ChartsYAxis/ChartsYAxis.d.ts +1 -1
- package/ChartsYAxis/ChartsYAxis.js +12 -211
- package/ChartsYAxis/useAxisProps.d.ts +4452 -0
- package/ChartsYAxis/useAxisProps.js +115 -0
- package/ChartsYAxis/utilities.d.ts +10 -0
- package/ChartsYAxis/utilities.js +42 -0
- package/LineChart/LineChart.js +4 -0
- package/ScatterChart/ScatterChart.js +4 -0
- package/SparkLineChart/SparkLineChart.d.ts +15 -5
- package/SparkLineChart/SparkLineChart.js +61 -34
- package/esm/BarChart/BarChart.js +4 -0
- package/esm/ChartContainer/ChartContainer.js +6 -0
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/esm/ChartsLabel/labelGradientClasses.d.ts +1 -1
- package/esm/ChartsLabel/labelMarkClasses.d.ts +1 -1
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +8 -2
- package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/esm/ChartsTooltip/ChartsTooltipTable.js +1 -0
- package/esm/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
- package/esm/ChartsXAxis/ChartsGroupedXAxis.js +1 -0
- package/esm/ChartsXAxis/useAxisProps.d.ts +9 -9
- package/esm/ChartsXAxis/utilities.d.ts +1 -1
- package/esm/ChartsYAxis/ChartsGroupedYAxis.d.ts +7 -0
- package/esm/ChartsYAxis/ChartsGroupedYAxis.js +138 -0
- package/esm/ChartsYAxis/ChartsSingleYAxis.d.ts +7 -0
- package/esm/ChartsYAxis/ChartsSingleYAxis.js +129 -0
- package/esm/ChartsYAxis/ChartsYAxis.d.ts +1 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +10 -207
- package/esm/ChartsYAxis/useAxisProps.d.ts +4452 -0
- package/esm/ChartsYAxis/useAxisProps.js +108 -0
- package/esm/ChartsYAxis/utilities.d.ts +10 -0
- package/esm/ChartsYAxis/utilities.js +34 -0
- package/esm/LineChart/LineChart.js +4 -0
- package/esm/ScatterChart/ScatterChart.js +4 -0
- package/esm/SparkLineChart/SparkLineChart.d.ts +15 -5
- package/esm/SparkLineChart/SparkLineChart.js +61 -34
- package/esm/index.js +1 -1
- package/esm/internals/animation/Transition.js +2 -5
- package/esm/internals/configInit.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +2 -2
- package/esm/internals/plugins/utils/ChartStore.js +16 -18
- package/esm/models/axis.d.ts +31 -48
- package/esm/tests/web-components.js +2 -4
- package/index.js +1 -1
- package/internals/animation/Transition.js +2 -5
- package/internals/configInit.js +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +2 -2
- package/internals/plugins/utils/ChartStore.js +16 -18
- package/models/axis.d.ts +31 -48
- package/package.json +16 -17
- package/tests/web-components.js +2 -4
|
@@ -10,12 +10,10 @@ export function reactToWebComponent(ReactComponent, options, renderer) {
|
|
|
10
10
|
static get observedAttributes() {
|
|
11
11
|
return [];
|
|
12
12
|
}
|
|
13
|
+
[connectedSymbol] = true;
|
|
14
|
+
[propsSymbol] = (() => ({}))();
|
|
13
15
|
constructor() {
|
|
14
16
|
super();
|
|
15
|
-
this[connectedSymbol] = true;
|
|
16
|
-
this[contextSymbol] = void 0;
|
|
17
|
-
this[propsSymbol] = {};
|
|
18
|
-
this.container = void 0;
|
|
19
17
|
if (options.shadow) {
|
|
20
18
|
this.container = this.attachShadow({
|
|
21
19
|
mode: options.shadow
|
package/index.js
CHANGED
|
@@ -15,6 +15,8 @@ var _d3Timer = require("@mui/x-charts-vendor/d3-timer");
|
|
|
15
15
|
* stopped.
|
|
16
16
|
*/
|
|
17
17
|
class Transition {
|
|
18
|
+
elapsed = 0;
|
|
19
|
+
timer = null;
|
|
18
20
|
/**
|
|
19
21
|
* Create a new ResumableTransition.
|
|
20
22
|
* @param duration Duration in milliseconds
|
|
@@ -22,11 +24,6 @@ class Transition {
|
|
|
22
24
|
* @param onTick Callback function called on each animation frame with the eased time in range [0, 1].
|
|
23
25
|
*/
|
|
24
26
|
constructor(duration, easingFn, onTick) {
|
|
25
|
-
this.duration = void 0;
|
|
26
|
-
this.elapsed = 0;
|
|
27
|
-
this.easingFn = void 0;
|
|
28
|
-
this.timer = null;
|
|
29
|
-
this.onTickCallback = void 0;
|
|
30
27
|
this.duration = duration;
|
|
31
28
|
this.easingFn = easingFn;
|
|
32
29
|
this.onTickCallback = onTick;
|
package/internals/configInit.js
CHANGED
|
@@ -7,8 +7,8 @@ exports.polarSeriesTypes = exports.cartesianSeriesTypes = void 0;
|
|
|
7
7
|
let cartesianInstance;
|
|
8
8
|
let polarInstance;
|
|
9
9
|
class CartesianSeriesTypes {
|
|
10
|
+
types = new Set();
|
|
10
11
|
constructor() {
|
|
11
|
-
this.types = new Set();
|
|
12
12
|
if (cartesianInstance) {
|
|
13
13
|
throw new Error('You can only create one instance!');
|
|
14
14
|
}
|
|
@@ -22,8 +22,8 @@ class CartesianSeriesTypes {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
class PolarSeriesTypes {
|
|
25
|
+
types = new Set();
|
|
25
26
|
constructor() {
|
|
26
|
-
this.types = new Set();
|
|
27
27
|
if (polarInstance) {
|
|
28
28
|
throw new Error('You can only create one instance!');
|
|
29
29
|
}
|
|
@@ -8,4 +8,4 @@ export declare function getAxisIndex(axisConfig: ComputedAxis, pointerValue: num
|
|
|
8
8
|
* For a pointer coordinate, this function returns the value associated.
|
|
9
9
|
* Returns `null` if the coordinate has no value associated.
|
|
10
10
|
*/
|
|
11
|
-
export declare function getAxisValue(axisConfig: ComputedAxis, pointerValue: number, dataIndex: number): number | Date | null;
|
|
11
|
+
export declare function getAxisValue(axisConfig: ComputedAxis, pointerValue: number, dataIndex: number | null): number | Date | null;
|
|
@@ -59,13 +59,12 @@ function getAxisValue(axisConfig, pointerValue, dataIndex) {
|
|
|
59
59
|
data: axisData
|
|
60
60
|
} = axisConfig;
|
|
61
61
|
if (!(0, _isBandScale.isBandScale)(scale)) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return value;
|
|
62
|
+
if (dataIndex === null) {
|
|
63
|
+
return scale.invert(pointerValue);
|
|
65
64
|
}
|
|
66
65
|
return axisData[dataIndex];
|
|
67
66
|
}
|
|
68
|
-
if (dataIndex < 0 || dataIndex >= axisData.length) {
|
|
67
|
+
if (dataIndex === null || dataIndex < 0 || dataIndex >= axisData.length) {
|
|
69
68
|
return null;
|
|
70
69
|
}
|
|
71
70
|
return axisData[dataIndex];
|
|
@@ -44,13 +44,13 @@ function valueGetter(value, axes, indexes, ids = axes.axisIds[0]) {
|
|
|
44
44
|
return Array.isArray(ids) ? ids.map((id, axisIndex) => (0, _getAxisValue.getAxisValue)(axes.axis[id], value, indexes[axisIndex])) : (0, _getAxisValue.getAxisValue)(axes.axis[ids], value, indexes);
|
|
45
45
|
}
|
|
46
46
|
const selectorChartsInteractionXAxisValue = exports.selectorChartsInteractionXAxisValue = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerX, _useChartCartesianAxisRendering.selectorChartXAxis, selectorChartsInteractionXAxisIndex, optionalGetAxisId], (x, xAxes, xIndex, id) => {
|
|
47
|
-
if (x === null ||
|
|
47
|
+
if (x === null || xAxes.axisIds.length === 0) {
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
50
|
return valueGetter(x, xAxes, xIndex, id);
|
|
51
51
|
});
|
|
52
52
|
const selectorChartsInteractionYAxisValue = exports.selectorChartsInteractionYAxisValue = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerY, _useChartCartesianAxisRendering.selectorChartYAxis, selectorChartsInteractionYAxisIndex, optionalGetAxisId], (y, yAxes, yIndex, id) => {
|
|
53
|
-
if (y === null ||
|
|
53
|
+
if (y === null || yAxes.axisIds.length === 0) {
|
|
54
54
|
return null;
|
|
55
55
|
}
|
|
56
56
|
return valueGetter(y, yAxes, yIndex, id);
|
|
@@ -6,26 +6,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ChartStore = void 0;
|
|
7
7
|
class ChartStore {
|
|
8
8
|
constructor(value) {
|
|
9
|
-
this.value = void 0;
|
|
10
|
-
this.listeners = void 0;
|
|
11
|
-
this.subscribe = fn => {
|
|
12
|
-
this.listeners.add(fn);
|
|
13
|
-
return () => {
|
|
14
|
-
this.listeners.delete(fn);
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
this.getSnapshot = () => {
|
|
18
|
-
return this.value;
|
|
19
|
-
};
|
|
20
|
-
this.update = updater => {
|
|
21
|
-
const newState = updater(this.value);
|
|
22
|
-
if (newState !== this.value) {
|
|
23
|
-
this.value = newState;
|
|
24
|
-
this.listeners.forEach(l => l(newState));
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
9
|
this.value = value;
|
|
28
10
|
this.listeners = new Set();
|
|
29
11
|
}
|
|
12
|
+
subscribe = fn => {
|
|
13
|
+
this.listeners.add(fn);
|
|
14
|
+
return () => {
|
|
15
|
+
this.listeners.delete(fn);
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
getSnapshot = () => {
|
|
19
|
+
return this.value;
|
|
20
|
+
};
|
|
21
|
+
update = updater => {
|
|
22
|
+
const newState = updater(this.value);
|
|
23
|
+
if (newState !== this.value) {
|
|
24
|
+
this.value = newState;
|
|
25
|
+
this.listeners.forEach(l => l(newState));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
30
28
|
}
|
|
31
29
|
exports.ChartStore = ChartStore;
|
package/models/axis.d.ts
CHANGED
|
@@ -194,6 +194,35 @@ export type AxisGroup = {
|
|
|
194
194
|
* @default 6
|
|
195
195
|
*/
|
|
196
196
|
tickSize?: number;
|
|
197
|
+
/**
|
|
198
|
+
* The style applied to ticks text.
|
|
199
|
+
*/
|
|
200
|
+
tickLabelStyle?: ChartsTextProps['style'];
|
|
201
|
+
};
|
|
202
|
+
export type AxisGroups = {
|
|
203
|
+
/**
|
|
204
|
+
* Each group will have a label that is the stringified value of the group.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* If the axis is grouped by day, month and year.
|
|
208
|
+
*
|
|
209
|
+
* ```tsx
|
|
210
|
+
* [
|
|
211
|
+
* { getValue: getDate },
|
|
212
|
+
* { getValue: getMonth },
|
|
213
|
+
* { getValue: getFullYear }
|
|
214
|
+
* ]
|
|
215
|
+
* ```
|
|
216
|
+
*
|
|
217
|
+
* Then the axis will have three rows, one for each group.
|
|
218
|
+
*
|
|
219
|
+
* ```bash
|
|
220
|
+
* | 31 | 1 | 2 |
|
|
221
|
+
* | Jan | Feb |
|
|
222
|
+
* | 2021 |
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
groups?: AxisGroup[];
|
|
197
226
|
};
|
|
198
227
|
export interface AxisScaleConfig {
|
|
199
228
|
band: {
|
|
@@ -212,58 +241,12 @@ export interface AxisScaleConfig {
|
|
|
212
241
|
*/
|
|
213
242
|
barGapRatio: number;
|
|
214
243
|
colorMap?: OrdinalColorConfig | ContinuousColorConfig | PiecewiseColorConfig;
|
|
215
|
-
|
|
216
|
-
* Each group will have a label that is the stringified value of the group.
|
|
217
|
-
*
|
|
218
|
-
* @example
|
|
219
|
-
* If the axis is grouped by day, month and year.
|
|
220
|
-
*
|
|
221
|
-
* ```tsx
|
|
222
|
-
* [
|
|
223
|
-
* { getValue: getDate },
|
|
224
|
-
* { getValue: getMonth },
|
|
225
|
-
* { getValue: getFullYear }
|
|
226
|
-
* ]
|
|
227
|
-
* ```
|
|
228
|
-
*
|
|
229
|
-
* Then the axis will have three rows, one for each group.
|
|
230
|
-
*
|
|
231
|
-
* ```bash
|
|
232
|
-
* | 31 | 1 | 2 |
|
|
233
|
-
* | Jan | Feb |
|
|
234
|
-
* | 2021 |
|
|
235
|
-
* ```
|
|
236
|
-
*/
|
|
237
|
-
groups?: AxisGroup[];
|
|
238
|
-
} & Pick<TickParams, 'tickPlacement' | 'tickLabelPlacement'>;
|
|
244
|
+
} & AxisGroups & Pick<TickParams, 'tickPlacement' | 'tickLabelPlacement'>;
|
|
239
245
|
point: {
|
|
240
246
|
scaleType: 'point';
|
|
241
247
|
scale: ScalePoint<number | Date | string>;
|
|
242
248
|
colorMap?: OrdinalColorConfig | ContinuousColorConfig | PiecewiseColorConfig;
|
|
243
|
-
|
|
244
|
-
* Each group will have a label that is the stringified value of the group.
|
|
245
|
-
*
|
|
246
|
-
* @example
|
|
247
|
-
* If the axis is grouped by day, month and year.
|
|
248
|
-
*
|
|
249
|
-
* ```tsx
|
|
250
|
-
* [
|
|
251
|
-
* { getValue: getDate },
|
|
252
|
-
* { getValue: getMonth },
|
|
253
|
-
* { getValue: getFullYear }
|
|
254
|
-
* ]
|
|
255
|
-
* ```
|
|
256
|
-
*
|
|
257
|
-
* Then the axis will have three rows, one for each group.
|
|
258
|
-
*
|
|
259
|
-
* ```bash
|
|
260
|
-
* | 31 | 1 | 2 |
|
|
261
|
-
* | Jan | Feb |
|
|
262
|
-
* | 2021 |
|
|
263
|
-
* ```
|
|
264
|
-
*/
|
|
265
|
-
groups?: AxisGroup[];
|
|
266
|
-
};
|
|
249
|
+
} & AxisGroups;
|
|
267
250
|
log: {
|
|
268
251
|
scaleType: 'log';
|
|
269
252
|
scale: ScaleLogarithmic<number, number>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts",
|
|
3
|
-
"version": "8.10.
|
|
3
|
+
"version": "8.10.2",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The community edition of MUI X Charts components.",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "^7.28.2",
|
|
32
|
-
"@mui/utils": "^7.
|
|
32
|
+
"@mui/utils": "^7.3.1",
|
|
33
33
|
"bezier-easing": "^2.1.0",
|
|
34
34
|
"clsx": "^2.1.1",
|
|
35
35
|
"prop-types": "^15.8.1",
|
|
36
36
|
"reselect": "^5.1.1",
|
|
37
37
|
"use-sync-external-store": "^1.5.0",
|
|
38
|
+
"@mui/x-internals": "8.10.2",
|
|
38
39
|
"@mui/x-charts-vendor": "8.6.0",
|
|
39
|
-
"@mui/x-internal-gestures": "0.2.
|
|
40
|
-
"@mui/x-internals": "8.10.0"
|
|
40
|
+
"@mui/x-internal-gestures": "0.2.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@emotion/react": "^11.9.0",
|
|
@@ -58,31 +58,30 @@
|
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=14.0.0"
|
|
60
60
|
},
|
|
61
|
-
"
|
|
61
|
+
"type": "commonjs",
|
|
62
|
+
"types": "./index.d.ts",
|
|
62
63
|
"exports": {
|
|
63
64
|
"./package.json": "./package.json",
|
|
64
65
|
".": {
|
|
65
|
-
"require": {
|
|
66
|
-
"types": "./index.d.ts",
|
|
67
|
-
"default": "./index.js"
|
|
68
|
-
},
|
|
69
66
|
"import": {
|
|
70
67
|
"types": "./esm/index.d.ts",
|
|
71
68
|
"default": "./esm/index.js"
|
|
69
|
+
},
|
|
70
|
+
"require": {
|
|
71
|
+
"types": "./index.d.ts",
|
|
72
|
+
"default": "./index.js"
|
|
72
73
|
}
|
|
73
74
|
},
|
|
74
75
|
"./*": {
|
|
75
|
-
"require": {
|
|
76
|
-
"types": "./*/index.d.ts",
|
|
77
|
-
"default": "./*/index.js"
|
|
78
|
-
},
|
|
79
76
|
"import": {
|
|
80
77
|
"types": "./esm/*/index.d.ts",
|
|
81
78
|
"default": "./esm/*/index.js"
|
|
79
|
+
},
|
|
80
|
+
"require": {
|
|
81
|
+
"types": "./*/index.d.ts",
|
|
82
|
+
"default": "./*/index.js"
|
|
82
83
|
}
|
|
83
84
|
},
|
|
84
|
-
"./esm": null
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
"types": "./index.d.ts"
|
|
85
|
+
"./esm": null
|
|
86
|
+
}
|
|
88
87
|
}
|
package/tests/web-components.js
CHANGED
|
@@ -16,12 +16,10 @@ function reactToWebComponent(ReactComponent, options, renderer) {
|
|
|
16
16
|
static get observedAttributes() {
|
|
17
17
|
return [];
|
|
18
18
|
}
|
|
19
|
+
[connectedSymbol] = true;
|
|
20
|
+
[propsSymbol] = {};
|
|
19
21
|
constructor() {
|
|
20
22
|
super();
|
|
21
|
-
this[connectedSymbol] = true;
|
|
22
|
-
this[contextSymbol] = void 0;
|
|
23
|
-
this[propsSymbol] = {};
|
|
24
|
-
this.container = void 0;
|
|
25
23
|
if (options.shadow) {
|
|
26
24
|
this.container = this.attachShadow({
|
|
27
25
|
mode: options.shadow
|