@mui/x-charts 7.11.0 → 7.11.1
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/BarElement.d.ts +2 -1
- package/BarChart/BarLabel/BarLabelItem.d.ts +2 -1
- package/BarChart/BarPlot.js +8 -8
- package/BarChart/checkScaleErrors.d.ts +4 -4
- package/BarChart/checkScaleErrors.js +11 -11
- package/BarChart/extremums.js +4 -1
- package/BarChart/formatter.js +2 -2
- package/CHANGELOG.md +84 -0
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/ChartsOverlay/ChartsOverlay.d.ts +3 -2
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
- package/ChartsTooltip/ChartsAxisTooltipContent.js +7 -3
- package/ChartsTooltip/ChartsItemTooltipContent.js +4 -4
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +4 -2
- package/LineChart/AreaElement.d.ts +2 -1
- package/LineChart/AreaPlot.js +10 -6
- package/LineChart/LineChart.js +4 -1
- package/LineChart/LineElement.d.ts +2 -1
- package/LineChart/LineHighlightPlot.d.ts +2 -1
- package/LineChart/LineHighlightPlot.js +9 -5
- package/LineChart/LinePlot.js +10 -6
- package/LineChart/MarkPlot.js +9 -5
- package/LineChart/extremums.js +4 -1
- package/LineChart/formatter.js +2 -2
- package/PieChart/PieArc.js +1 -0
- package/ResponsiveChartContainer/useChartContainerDimensions.js +2 -2
- package/ScatterChart/ScatterChart.js +4 -1
- package/ScatterChart/ScatterPlot.js +6 -3
- package/ScatterChart/extremums.js +8 -2
- package/context/CartesianProvider/CartesianContext.d.ts +1 -1
- package/context/CartesianProvider/normalizeAxis.js +1 -1
- package/context/DrawingProvider.d.ts +2 -1
- package/context/DrawingProvider.js +7 -1
- package/context/SeriesContextProvider.js +1 -1
- package/context/ZAxisContextProvider.d.ts +1 -1
- package/context/ZAxisContextProvider.js +1 -1
- package/esm/BarChart/BarPlot.js +8 -8
- package/esm/BarChart/checkScaleErrors.js +11 -11
- package/esm/BarChart/extremums.js +4 -1
- package/esm/BarChart/formatter.js +2 -2
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +2 -3
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +2 -3
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +7 -3
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +4 -4
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +4 -2
- package/esm/LineChart/AreaPlot.js +10 -6
- package/esm/LineChart/LineChart.js +4 -1
- package/esm/LineChart/LineHighlightPlot.js +9 -5
- package/esm/LineChart/LinePlot.js +10 -6
- package/esm/LineChart/MarkPlot.js +9 -5
- package/esm/LineChart/extremums.js +4 -1
- package/esm/LineChart/formatter.js +2 -2
- package/esm/PieChart/PieArc.js +1 -0
- package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +2 -2
- package/esm/ScatterChart/ScatterChart.js +4 -1
- package/esm/ScatterChart/ScatterPlot.js +6 -3
- package/esm/ScatterChart/extremums.js +8 -2
- package/esm/context/CartesianProvider/normalizeAxis.js +1 -1
- package/esm/context/DrawingProvider.js +7 -1
- package/esm/context/SeriesContextProvider.js +1 -1
- package/esm/context/ZAxisContextProvider.js +1 -1
- package/esm/hooks/useAxisEvents.js +12 -8
- package/esm/internals/SlotComponentPropsFromProps.js +1 -0
- package/esm/internals/geometry.js +1 -1
- package/esm/internals/getPercentageValue.js +1 -1
- package/esm/internals/warning.js +19 -11
- package/hooks/useAxisEvents.js +12 -8
- package/index.js +1 -1
- package/internals/SlotComponentPropsFromProps.d.ts +1 -0
- package/internals/SlotComponentPropsFromProps.js +5 -0
- package/internals/defaultizeColor.d.ts +7 -0
- package/internals/geometry.js +1 -1
- package/internals/getPercentageValue.js +1 -1
- package/internals/warning.d.ts +2 -1
- package/internals/warning.js +21 -12
- package/models/seriesType/common.d.ts +10 -0
- package/models/seriesType/scatter.d.ts +5 -0
- package/modern/BarChart/BarPlot.js +8 -8
- package/modern/BarChart/checkScaleErrors.js +11 -11
- package/modern/BarChart/extremums.js +4 -1
- package/modern/BarChart/formatter.js +2 -2
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +2 -3
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +2 -3
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +7 -3
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +4 -4
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +4 -2
- package/modern/LineChart/AreaPlot.js +10 -6
- package/modern/LineChart/LineChart.js +4 -1
- package/modern/LineChart/LineHighlightPlot.js +9 -5
- package/modern/LineChart/LinePlot.js +10 -6
- package/modern/LineChart/MarkPlot.js +9 -5
- package/modern/LineChart/extremums.js +4 -1
- package/modern/LineChart/formatter.js +2 -2
- package/modern/PieChart/PieArc.js +1 -0
- package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +2 -2
- package/modern/ScatterChart/ScatterChart.js +4 -1
- package/modern/ScatterChart/ScatterPlot.js +6 -3
- package/modern/ScatterChart/extremums.js +8 -2
- package/modern/context/CartesianProvider/normalizeAxis.js +1 -1
- package/modern/context/DrawingProvider.js +7 -1
- package/modern/context/SeriesContextProvider.js +1 -1
- package/modern/context/ZAxisContextProvider.js +1 -1
- package/modern/hooks/useAxisEvents.js +12 -8
- package/modern/index.js +1 -1
- package/modern/internals/SlotComponentPropsFromProps.js +1 -0
- package/modern/internals/geometry.js +1 -1
- package/modern/internals/getPercentageValue.js +1 -1
- package/modern/internals/warning.js +19 -11
- package/package.json +3 -3
package/BarChart/BarElement.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AnimatedProps } from '@react-spring/web';
|
|
3
|
+
import { SlotComponentPropsFromProps } from '../internals/SlotComponentPropsFromProps';
|
|
3
4
|
import { SeriesId } from '../models/seriesType/common';
|
|
4
5
|
export interface BarElementClasses {
|
|
5
6
|
/** Styles applied to the root element. */
|
|
@@ -1365,7 +1366,7 @@ export interface BarElementSlots {
|
|
|
1365
1366
|
bar?: React.ElementType<BarProps>;
|
|
1366
1367
|
}
|
|
1367
1368
|
export interface BarElementSlotProps {
|
|
1368
|
-
bar?:
|
|
1369
|
+
bar?: SlotComponentPropsFromProps<BarProps, {}, BarElementOwnerState>;
|
|
1369
1370
|
}
|
|
1370
1371
|
export type BarElementProps = Omit<BarElementOwnerState, 'isFaded' | 'isHighlighted'> & Omit<React.SVGProps<SVGRectElement>, 'ref' | 'id'> & {
|
|
1371
1372
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { SlotComponentPropsFromProps } from '../../internals/SlotComponentPropsFromProps';
|
|
2
3
|
import { BarLabelOwnerState, BarItem, BarLabelContext } from './BarLabel.types';
|
|
3
4
|
import { BarLabelProps } from './BarLabel';
|
|
4
5
|
export interface BarLabelSlots {
|
|
@@ -9,7 +10,7 @@ export interface BarLabelSlots {
|
|
|
9
10
|
barLabel?: React.JSXElementConstructor<BarLabelProps>;
|
|
10
11
|
}
|
|
11
12
|
export interface BarLabelSlotProps {
|
|
12
|
-
barLabel?:
|
|
13
|
+
barLabel?: SlotComponentPropsFromProps<BarLabelProps, {}, BarLabelOwnerState>;
|
|
13
14
|
}
|
|
14
15
|
export type BarLabelItemProps = Omit<BarLabelOwnerState, 'isFaded' | 'isHighlighted'> & Pick<BarLabelProps, 'style'> & {
|
|
15
16
|
/**
|
package/BarChart/BarPlot.js
CHANGED
|
@@ -74,16 +74,16 @@ const useAggregatedData = () => {
|
|
|
74
74
|
ids: groupIds
|
|
75
75
|
}, groupIndex) => {
|
|
76
76
|
return groupIds.flatMap(seriesId => {
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const xAxisConfig = xAxis[
|
|
80
|
-
const yAxisConfig = yAxis[
|
|
77
|
+
const xAxisId = series[seriesId].xAxisId ?? series[seriesId].xAxisKey ?? defaultXAxisId;
|
|
78
|
+
const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey ?? defaultYAxisId;
|
|
79
|
+
const xAxisConfig = xAxis[xAxisId];
|
|
80
|
+
const yAxisConfig = yAxis[yAxisId];
|
|
81
81
|
const verticalLayout = series[seriesId].layout === 'vertical';
|
|
82
|
-
(0, _checkScaleErrors.checkScaleErrors)(verticalLayout, seriesId,
|
|
82
|
+
(0, _checkScaleErrors.checkScaleErrors)(verticalLayout, seriesId, xAxisId, xAxis, yAxisId, yAxis);
|
|
83
83
|
const baseScaleConfig = verticalLayout ? xAxisConfig : yAxisConfig;
|
|
84
84
|
const xScale = xAxisConfig.scale;
|
|
85
85
|
const yScale = yAxisConfig.scale;
|
|
86
|
-
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[
|
|
86
|
+
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
87
87
|
const bandWidth = baseScaleConfig.scale.bandwidth();
|
|
88
88
|
const {
|
|
89
89
|
barWidth,
|
|
@@ -106,8 +106,8 @@ const useAggregatedData = () => {
|
|
|
106
106
|
seriesId,
|
|
107
107
|
dataIndex,
|
|
108
108
|
layout: series[seriesId].layout,
|
|
109
|
-
x: verticalLayout ? xScale(xAxis[
|
|
110
|
-
y: verticalLayout ? minValueCoord : yScale(yAxis[
|
|
109
|
+
x: verticalLayout ? xScale(xAxis[xAxisId].data?.[dataIndex]) + barOffset : minValueCoord,
|
|
110
|
+
y: verticalLayout ? minValueCoord : yScale(yAxis[yAxisId].data?.[dataIndex]) + barOffset,
|
|
111
111
|
xOrigin: xScale(0),
|
|
112
112
|
yOrigin: yScale(0),
|
|
113
113
|
height: verticalLayout ? maxValueCoord - minValueCoord : barWidth,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxisDefaultized, AxisId } from '../models/axis';
|
|
2
2
|
import { SeriesId } from '../models/seriesType/common';
|
|
3
|
-
export declare function checkScaleErrors(verticalLayout: boolean, seriesId: SeriesId,
|
|
4
|
-
[
|
|
5
|
-
},
|
|
6
|
-
[
|
|
3
|
+
export declare function checkScaleErrors(verticalLayout: boolean, seriesId: SeriesId, xAxisId: AxisId, xAxis: {
|
|
4
|
+
[axisId: AxisId]: AxisDefaultized;
|
|
5
|
+
}, yAxisId: AxisId, yAxis: {
|
|
6
|
+
[axisId: AxisId]: AxisDefaultized;
|
|
7
7
|
}): void;
|
|
@@ -6,28 +6,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.checkScaleErrors = checkScaleErrors;
|
|
7
7
|
var _constants = require("../constants");
|
|
8
8
|
var _axis = require("../models/axis");
|
|
9
|
-
const getAxisMessage = (axisDirection,
|
|
9
|
+
const getAxisMessage = (axisDirection, axisId) => {
|
|
10
10
|
const axisName = `${axisDirection}-axis`;
|
|
11
|
-
const
|
|
11
|
+
const axisIdName = `${axisDirection}Axis`;
|
|
12
12
|
const axisDefaultKey = axisDirection === 'x' ? _constants.DEFAULT_X_AXIS_KEY : _constants.DEFAULT_Y_AXIS_KEY;
|
|
13
|
-
return
|
|
13
|
+
return axisId === axisDefaultKey ? `The first \`${axisIdName}\`` : `The ${axisName} with id "${axisId}"`;
|
|
14
14
|
};
|
|
15
|
-
function checkScaleErrors(verticalLayout, seriesId,
|
|
16
|
-
const xAxisConfig = xAxis[
|
|
17
|
-
const yAxisConfig = yAxis[
|
|
15
|
+
function checkScaleErrors(verticalLayout, seriesId, xAxisId, xAxis, yAxisId, yAxis) {
|
|
16
|
+
const xAxisConfig = xAxis[xAxisId];
|
|
17
|
+
const yAxisConfig = yAxis[yAxisId];
|
|
18
18
|
const discreteAxisConfig = verticalLayout ? xAxisConfig : yAxisConfig;
|
|
19
19
|
const continuousAxisConfig = verticalLayout ? yAxisConfig : xAxisConfig;
|
|
20
|
-
const
|
|
21
|
-
const
|
|
20
|
+
const discreteAxisId = verticalLayout ? xAxisId : yAxisId;
|
|
21
|
+
const continuousAxisId = verticalLayout ? yAxisId : xAxisId;
|
|
22
22
|
const discreteAxisDirection = verticalLayout ? 'x' : 'y';
|
|
23
23
|
const continuousAxisDirection = verticalLayout ? 'y' : 'x';
|
|
24
24
|
if (!(0, _axis.isBandScaleConfig)(discreteAxisConfig)) {
|
|
25
|
-
throw new Error(`MUI X
|
|
25
|
+
throw new Error(`MUI X: ${getAxisMessage(discreteAxisDirection, discreteAxisId)} should be of type "band" to display the bar series of id "${seriesId}".`);
|
|
26
26
|
}
|
|
27
27
|
if (discreteAxisConfig.data === undefined) {
|
|
28
|
-
throw new Error(`MUI X
|
|
28
|
+
throw new Error(`MUI X: ${getAxisMessage(discreteAxisDirection, discreteAxisId)} should have data property.`);
|
|
29
29
|
}
|
|
30
30
|
if ((0, _axis.isBandScaleConfig)(continuousAxisConfig) || (0, _axis.isPointScaleConfig)(continuousAxisConfig)) {
|
|
31
|
-
throw new Error(`MUI X
|
|
31
|
+
throw new Error(`MUI X: ${getAxisMessage(continuousAxisDirection, continuousAxisId)} should be a continuous type to display the bar series of id "${seriesId}".`);
|
|
32
32
|
}
|
|
33
33
|
}
|
package/BarChart/extremums.js
CHANGED
|
@@ -18,7 +18,10 @@ const getValueExtremum = params => {
|
|
|
18
18
|
axis,
|
|
19
19
|
isDefaultAxis
|
|
20
20
|
} = params;
|
|
21
|
-
return Object.keys(series).filter(seriesId =>
|
|
21
|
+
return Object.keys(series).filter(seriesId => {
|
|
22
|
+
const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey;
|
|
23
|
+
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
24
|
+
}).reduce((acc, seriesId) => {
|
|
22
25
|
const [seriesMin, seriesMax] = series[seriesId].stackedData?.reduce((seriesAcc, values) => [Math.min(...values, ...(seriesAcc[0] === null ? [] : [seriesAcc[0]])), Math.max(...values, ...(seriesAcc[1] === null ? [] : [seriesAcc[1]]))], series[seriesId].stackedData[0]) ?? [null, null];
|
|
23
26
|
return [acc[0] === null ? seriesMin : Math.min(seriesMin, acc[0]), acc[1] === null ? seriesMax : Math.max(seriesMax, acc[1])];
|
|
24
27
|
}, [null, null]);
|
package/BarChart/formatter.js
CHANGED
|
@@ -32,7 +32,7 @@ const formatter = (params, dataset) => {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
} else if (dataset === undefined) {
|
|
35
|
-
throw new Error([`MUI X
|
|
35
|
+
throw new Error([`MUI X: bar series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
const completedSeries = {};
|
|
@@ -59,7 +59,7 @@ const formatter = (params, dataset) => {
|
|
|
59
59
|
if (typeof value !== 'number') {
|
|
60
60
|
if (process.env.NODE_ENV !== 'production' && !warnOnce && value !== null) {
|
|
61
61
|
warnOnce = true;
|
|
62
|
-
console.error([`MUI X charts: your dataset key "${dataKey}" is used for plotting bars, but contains nonnumerical elements.`, 'Bar plots only support numbers and null values.']);
|
|
62
|
+
console.error([`MUI X charts: your dataset key "${dataKey}" is used for plotting bars, but contains nonnumerical elements.`, 'Bar plots only support numbers and null values.'].join('\n'));
|
|
63
63
|
}
|
|
64
64
|
return 0;
|
|
65
65
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,90 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.11.1
|
|
7
|
+
|
|
8
|
+
_Jul 25, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 18 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🔎 Allow `Zoom` to be controllable for charts (#13858) @JCQuintas
|
|
13
|
+
- 🌍 Add Icelandic (is-IS) and Norwegian Nynorsk (nn-NO) locales on the Data Grid
|
|
14
|
+
- 🌍 Improve Norwegian Bokmål (nb-NO) and German (de-DE) locales on the Data Grid
|
|
15
|
+
- 🌍 Add Norwegian Nynorsk (nn-NO) locale on the Date and Time Pickers
|
|
16
|
+
- 🐞 Bugfixes
|
|
17
|
+
- 📚 Documentation improvements
|
|
18
|
+
|
|
19
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
20
|
+
|
|
21
|
+
### Data Grid
|
|
22
|
+
|
|
23
|
+
#### `@mui/x-data-grid@7.11.1`
|
|
24
|
+
|
|
25
|
+
- [DataGrid] Remove dead code in internal `GridPreferencesPanel` (#13934) @k-rajat19
|
|
26
|
+
- [DataGrid] Do not miss to escape formulas in CSV export (#13888) @arminmeh
|
|
27
|
+
- [l10n] Add Icelandic (is-IS) locale (#13283) @magnimarels
|
|
28
|
+
- [l10n] Add Norwegian nynorsk (nn-NO) locale and improve Norwegian bokmål (nb-NO) locale (#13588) @AnderzL7
|
|
29
|
+
- [l10n] Improve German (de-DE) locale (#13910) @lhilgert9
|
|
30
|
+
|
|
31
|
+
#### `@mui/x-data-grid-pro@7.11.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
32
|
+
|
|
33
|
+
Same changes as in `@mui/x-data-grid@7.11.1`.
|
|
34
|
+
|
|
35
|
+
#### `@mui/x-data-grid-premium@7.11.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
36
|
+
|
|
37
|
+
Same changes as in `@mui/x-data-grid-pro@7.11.1`, plus:
|
|
38
|
+
|
|
39
|
+
- [DataGridPremium] Pass the `api` object to events (#13893) @pcorpet
|
|
40
|
+
- [DataGridPremium] Fix paste to selected cells (#13967) @romgrk
|
|
41
|
+
|
|
42
|
+
### Date and Time Pickers
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-date-pickers@7.11.1`
|
|
45
|
+
|
|
46
|
+
- [fields] Prevent keyboard editing when disabled (#13900) @arthurbalduini
|
|
47
|
+
- [l10n] Add Norwegian Nynorsk (nn-NO) locale (#13946) @AnderzL7
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-date-pickers-pro@7.11.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
50
|
+
|
|
51
|
+
Same changes as in `@mui/x-date-pickers@7.11.1`.
|
|
52
|
+
|
|
53
|
+
### Charts
|
|
54
|
+
|
|
55
|
+
#### `@mui/x-charts@7.11.1`
|
|
56
|
+
|
|
57
|
+
- [charts] Add `ownerState` function to `slotProps` typing when available (#13965) @alexfauquette
|
|
58
|
+
- [charts] Allow `Zoom` to be controllable (#13858) @JCQuintas
|
|
59
|
+
- [charts] Deprecate `xAxisKey` /`zAxisKey` in favor of `xAxisId`/`zAxisId` (#13940) @alexfauquette
|
|
60
|
+
- [charts] Hide empty arcs in the PieChart (#13897) @alexfauquette
|
|
61
|
+
- [charts] Limit the trigger of exit charts (#13682) @alexfauquette
|
|
62
|
+
|
|
63
|
+
### Tree View
|
|
64
|
+
|
|
65
|
+
#### `@mui/x-tree-view@7.11.1`
|
|
66
|
+
|
|
67
|
+
- [TreeView] Allow the plugins to enrich the props passed to the item slots (#13953) @flaviendelangle
|
|
68
|
+
|
|
69
|
+
### Docs
|
|
70
|
+
|
|
71
|
+
- [docs] Bump pnpm priority as a package manager (#13894) @oliviertassinari
|
|
72
|
+
- [docs] Explicitly mark charts pro as not released (#13905) @alexfauquette
|
|
73
|
+
- [docs] Fix dot consistency a11y table @oliviertassinari
|
|
74
|
+
- [docs] Fix some typos in charts docs (#13906) @cratiu222
|
|
75
|
+
- [docs] Fix spelling (#13902) @nnsW3
|
|
76
|
+
- [docs] Improve error message when moving between plans (#13874) @oliviertassinari
|
|
77
|
+
- [docs] Update `SparkLineChart` reference not being correctly capitalised (#13960) @duckboy81
|
|
78
|
+
- [docs] Fix scroll demos disorientation (#13909) @oliviertassinari
|
|
79
|
+
|
|
80
|
+
### Core
|
|
81
|
+
|
|
82
|
+
- [core] Add `@mui/material-nextjs` to `MUI Core` renovate group (#13966) @LukasTy
|
|
83
|
+
- [core] Remove warning message in production (#13911) @oliviertassinari
|
|
84
|
+
- [code-infra] Reuse `useReactVersion` script from the monorepo (#13710) @cherniavskii
|
|
85
|
+
- [infra] Adds order id validation action (#13957) @michelengelen
|
|
86
|
+
- [infra] Fix order id validator action (#13971) @michelengelen
|
|
87
|
+
- [infra] Fix regex in order id validation (#13976) @michelengelen
|
|
88
|
+
- [infra] Issue template improvement (#13954) @michelengelen
|
|
89
|
+
|
|
6
90
|
## 7.11.0
|
|
7
91
|
|
|
8
92
|
_Jul 18, 2024_
|
package/ChartsAxis/ChartsAxis.js
CHANGED
|
@@ -66,16 +66,16 @@ function ChartsAxis(props) {
|
|
|
66
66
|
const topId = getAxisId(topAxis, xAxisIds[0]);
|
|
67
67
|
const rightId = getAxisId(rightAxis, yAxisIds[0]);
|
|
68
68
|
if (topId !== null && !xAxis[topId]) {
|
|
69
|
-
throw Error([`MUI X
|
|
69
|
+
throw Error([`MUI X: id used for top axis "${topId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
|
|
70
70
|
}
|
|
71
71
|
if (leftId !== null && !yAxis[leftId]) {
|
|
72
|
-
throw Error([`MUI X
|
|
72
|
+
throw Error([`MUI X: id used for left axis "${leftId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
|
|
73
73
|
}
|
|
74
74
|
if (rightId !== null && !yAxis[rightId]) {
|
|
75
|
-
throw Error([`MUI X
|
|
75
|
+
throw Error([`MUI X: id used for right axis "${rightId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
|
|
76
76
|
}
|
|
77
77
|
if (bottomId !== null && !xAxis[bottomId]) {
|
|
78
|
-
throw Error([`MUI X
|
|
78
|
+
throw Error([`MUI X: id used for bottom axis "${bottomId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
|
|
79
79
|
}
|
|
80
80
|
const topAxisProps = mergeProps(topAxis, slots, slotProps);
|
|
81
81
|
const bottomAxisProps = mergeProps(bottomAxis, slots, slotProps);
|
|
@@ -85,7 +85,7 @@ function ChartsAxisHighlight(props) {
|
|
|
85
85
|
const isXError = isBandScaleX && xScale(axisX.value) === undefined;
|
|
86
86
|
const isYError = isBandScaleY && yScale(axisY.value) === undefined;
|
|
87
87
|
if (isXError || isYError) {
|
|
88
|
-
console.error([`MUI X
|
|
88
|
+
console.error([`MUI X: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
@@ -46,7 +46,9 @@ function ChartsOnAxisClickHandler(props) {
|
|
|
46
46
|
Object.keys(series).filter(seriesType => ['bar', 'line'].includes(seriesType)).forEach(seriesType => {
|
|
47
47
|
series[seriesType]?.seriesOrder.forEach(seriesId => {
|
|
48
48
|
const seriesItem = series[seriesType].series[seriesId];
|
|
49
|
-
const
|
|
49
|
+
const providedXAxisId = seriesItem.xAxisId ?? seriesItem.xAxisKey;
|
|
50
|
+
const providedYAxisId = seriesItem.yAxisId ?? seriesItem.yAxisKey;
|
|
51
|
+
const axisKey = isXaxis ? providedXAxisId : providedYAxisId;
|
|
50
52
|
if (axisKey === undefined || axisKey === USED_AXIS_ID) {
|
|
51
53
|
seriesValues[seriesId] = seriesItem.data[dataIndex];
|
|
52
54
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import { SlotComponentPropsFromProps } from '../internals/SlotComponentPropsFromProps';
|
|
3
4
|
export declare function useNoData(): boolean;
|
|
4
5
|
export type CommonOverlayProps = React.SVGAttributes<SVGTextElement> & {
|
|
5
6
|
/**
|
|
@@ -21,8 +22,8 @@ export interface ChartsOverlaySlots {
|
|
|
21
22
|
noDataOverlay?: React.ElementType<CommonOverlayProps>;
|
|
22
23
|
}
|
|
23
24
|
export interface ChartsOverlaySlotProps {
|
|
24
|
-
loadingOverlay?:
|
|
25
|
-
noDataOverlay?:
|
|
25
|
+
loadingOverlay?: SlotComponentPropsFromProps<CommonOverlayProps, {}, {}>;
|
|
26
|
+
noDataOverlay?: SlotComponentPropsFromProps<CommonOverlayProps, {}, {}>;
|
|
26
27
|
}
|
|
27
28
|
export interface ChartsOverlayProps {
|
|
28
29
|
/**
|
|
@@ -19,10 +19,10 @@ function ChartsReferenceLine(props) {
|
|
|
19
19
|
y
|
|
20
20
|
} = props;
|
|
21
21
|
if (x !== undefined && y !== undefined) {
|
|
22
|
-
throw new Error('MUI X
|
|
22
|
+
throw new Error('MUI X: The ChartsReferenceLine cannot have both `x` and `y` props set.');
|
|
23
23
|
}
|
|
24
24
|
if (x === undefined && y === undefined) {
|
|
25
|
-
throw new Error('MUI X
|
|
25
|
+
throw new Error('MUI X: The ChartsReferenceLine should have a value in `x` or `y` prop.');
|
|
26
26
|
}
|
|
27
27
|
if (x !== undefined) {
|
|
28
28
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsXReferenceLine.ChartsXReferenceLine, (0, _extends2.default)({}, props));
|
|
@@ -57,7 +57,6 @@ function getXReferenceLineClasses(classes) {
|
|
|
57
57
|
label: ['label']
|
|
58
58
|
}, _chartsReferenceLineClasses.getReferenceLineUtilityClass, classes);
|
|
59
59
|
}
|
|
60
|
-
const valueError = (0, _warning.buildWarning)((value, id) => `MUI X Charts: the value ${value} does not exist in the data of x axis with id ${id}.`, 'error');
|
|
61
60
|
function ChartsXReferenceLine(props) {
|
|
62
61
|
const {
|
|
63
62
|
x,
|
|
@@ -77,7 +76,7 @@ function ChartsXReferenceLine(props) {
|
|
|
77
76
|
const xPosition = xAxisScale(x);
|
|
78
77
|
if (xPosition === undefined) {
|
|
79
78
|
if (process.env.NODE_ENV !== 'production') {
|
|
80
|
-
|
|
79
|
+
(0, _warning.warnOnce)(`MUI X: the value ${x} does not exist in the data of x axis with id ${axisId}.`, 'error');
|
|
81
80
|
}
|
|
82
81
|
return null;
|
|
83
82
|
}
|
|
@@ -57,7 +57,6 @@ function getYReferenceLineClasses(classes) {
|
|
|
57
57
|
label: ['label']
|
|
58
58
|
}, _chartsReferenceLineClasses.getReferenceLineUtilityClass, classes);
|
|
59
59
|
}
|
|
60
|
-
const valueError = (0, _warning.buildWarning)((value, id) => `MUI X Charts: the value ${value} does not exist in the data of y axis with id ${id}.`, 'error');
|
|
61
60
|
function ChartsYReferenceLine(props) {
|
|
62
61
|
const {
|
|
63
62
|
y,
|
|
@@ -77,7 +76,7 @@ function ChartsYReferenceLine(props) {
|
|
|
77
76
|
const yPosition = yAxisScale(y);
|
|
78
77
|
if (yPosition === undefined) {
|
|
79
78
|
if (process.env.NODE_ENV !== 'production') {
|
|
80
|
-
|
|
79
|
+
(0, _warning.warnOnce)(`MUI X: the value ${y} does not exist in the data of y axis with id ${axisId}.`, 'error');
|
|
81
80
|
}
|
|
82
81
|
return null;
|
|
83
82
|
}
|
|
@@ -49,11 +49,15 @@ function ChartsAxisTooltipContent(props) {
|
|
|
49
49
|
Object.keys(series).filter(_isCartesian.isCartesianSeriesType).forEach(seriesType => {
|
|
50
50
|
series[seriesType].seriesOrder.forEach(seriesId => {
|
|
51
51
|
const item = series[seriesType].series[seriesId];
|
|
52
|
-
const
|
|
52
|
+
const providedXAxisId = item.xAxisId ?? item.xAxisKey;
|
|
53
|
+
const providedYAxisId = item.yAxisId ?? item.yAxisKey;
|
|
54
|
+
const axisKey = isXaxis ? providedXAxisId : providedYAxisId;
|
|
53
55
|
if (axisKey === undefined || axisKey === USED_AXIS_ID) {
|
|
54
56
|
const seriesToAdd = series[seriesType].series[seriesId];
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
+
const xAxisId = providedXAxisId ?? xAxisIds[0];
|
|
58
|
+
const yAxisId = providedYAxisId ?? yAxisIds[0];
|
|
59
|
+
const zAxisId = seriesToAdd.zAxisId ?? seriesToAdd.zAxisKey ?? zAxisIds[0];
|
|
60
|
+
const getColor = colorProcessors[seriesType]?.(seriesToAdd, xAxis[xAxisId], yAxis[yAxisId], zAxisId && zAxis[zAxisId]) ?? (() => '');
|
|
57
61
|
rep.push((0, _extends2.default)({}, seriesToAdd, {
|
|
58
62
|
getColor
|
|
59
63
|
}));
|
|
@@ -39,10 +39,10 @@ function ChartsItemTooltipContent(props) {
|
|
|
39
39
|
zAxisIds
|
|
40
40
|
} = React.useContext(_ZAxisContextProvider.ZAxisContext);
|
|
41
41
|
const colorProcessors = (0, _useColor.useColorProcessor)();
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const getColor = colorProcessors[series.type]?.(series,
|
|
42
|
+
const xAxisId = series.xAxisId ?? series.xAxisKey ?? xAxisIds[0];
|
|
43
|
+
const yAxisId = series.yAxisId ?? series.yAxisKey ?? yAxisIds[0];
|
|
44
|
+
const zAxisId = series.zAxisId ?? series.zAxisKey ?? zAxisIds[0];
|
|
45
|
+
const getColor = colorProcessors[series.type]?.(series, xAxisId && xAxis[xAxisId], yAxisId && yAxis[yAxisId], zAxisId && zAxis[zAxisId]) ?? (() => '');
|
|
46
46
|
const Content = content ?? _DefaultChartsItemTooltipContent.DefaultChartsItemTooltipContent;
|
|
47
47
|
const chartTooltipContentProps = (0, _utils.useSlotProps)({
|
|
48
48
|
elementType: Content,
|
|
@@ -72,11 +72,13 @@ function ChartsVoronoiHandler(props) {
|
|
|
72
72
|
seriesOrder.forEach(seriesId => {
|
|
73
73
|
const {
|
|
74
74
|
data,
|
|
75
|
+
xAxisId,
|
|
76
|
+
yAxisId,
|
|
75
77
|
xAxisKey,
|
|
76
78
|
yAxisKey
|
|
77
79
|
} = series[seriesId];
|
|
78
|
-
const xScale = xAxis[xAxisKey ?? defaultXAxisId].scale;
|
|
79
|
-
const yScale = yAxis[yAxisKey ?? defaultYAxisId].scale;
|
|
80
|
+
const xScale = xAxis[xAxisId ?? xAxisKey ?? defaultXAxisId].scale;
|
|
81
|
+
const yScale = yAxis[yAxisId ?? yAxisKey ?? defaultYAxisId].scale;
|
|
80
82
|
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
81
83
|
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
82
84
|
const seriesPoints = data.flatMap(({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { SlotComponentPropsFromProps } from '../internals/SlotComponentPropsFromProps';
|
|
2
3
|
import { AnimatedAreaProps } from './AnimatedArea';
|
|
3
4
|
import { SeriesId } from '../models/seriesType/common';
|
|
4
5
|
export interface AreaElementClasses {
|
|
@@ -28,7 +29,7 @@ export interface AreaElementSlots {
|
|
|
28
29
|
area?: React.JSXElementConstructor<AnimatedAreaProps>;
|
|
29
30
|
}
|
|
30
31
|
export interface AreaElementSlotProps {
|
|
31
|
-
area?: AnimatedAreaProps
|
|
32
|
+
area?: SlotComponentPropsFromProps<AnimatedAreaProps, {}, AreaElementOwnerState>;
|
|
32
33
|
}
|
|
33
34
|
export interface AreaElementProps extends Omit<AreaElementOwnerState, 'isFaded' | 'isHighlighted'>, Pick<AnimatedAreaProps, 'skipAnimation'>, Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color' | 'id'> {
|
|
34
35
|
d: string;
|
package/LineChart/AreaPlot.js
CHANGED
|
@@ -45,22 +45,26 @@ const useAggregatedData = () => {
|
|
|
45
45
|
return [...groupIds].reverse() // Revert stacked area for a more pleasant animation
|
|
46
46
|
.map(seriesId => {
|
|
47
47
|
const {
|
|
48
|
+
xAxisId: xAxisIdProp,
|
|
49
|
+
yAxisId: yAxisIdProp,
|
|
48
50
|
xAxisKey = defaultXAxisId,
|
|
49
51
|
yAxisKey = defaultYAxisId,
|
|
50
52
|
stackedData,
|
|
51
53
|
data,
|
|
52
54
|
connectNulls
|
|
53
55
|
} = series[seriesId];
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
56
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
57
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
58
|
+
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
59
|
+
const yScale = yAxis[yAxisId].scale;
|
|
60
|
+
const xData = xAxis[xAxisId].data;
|
|
61
|
+
const gradientUsed = yAxis[yAxisId].colorScale && [yAxisId, 'y'] || xAxis[xAxisId].colorScale && [xAxisId, 'x'] || undefined;
|
|
58
62
|
if (process.env.NODE_ENV !== 'production') {
|
|
59
63
|
if (xData === undefined) {
|
|
60
|
-
throw new Error(`MUI X
|
|
64
|
+
throw new Error(`MUI X: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
61
65
|
}
|
|
62
66
|
if (xData.length < stackedData.length) {
|
|
63
|
-
throw new Error(`MUI X
|
|
67
|
+
throw new Error(`MUI X: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => {
|
package/LineChart/LineChart.js
CHANGED
|
@@ -58,7 +58,10 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
|
|
|
58
58
|
}, chartContainerProps, {
|
|
59
59
|
children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), props.grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
60
60
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, (0, _extends2.default)({}, areaPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePlot.LinePlot, (0, _extends2.default)({}, linePlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
|
|
61
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
61
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
62
|
+
"data-drawing-container": true,
|
|
63
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, (0, _extends2.default)({}, markPlotProps))
|
|
64
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, (0, _extends2.default)({}, lineHighlightPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltipProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
62
65
|
}));
|
|
63
66
|
});
|
|
64
67
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { SlotComponentPropsFromProps } from '../internals/SlotComponentPropsFromProps';
|
|
2
3
|
import { AnimatedLineProps } from './AnimatedLine';
|
|
3
4
|
import { SeriesId } from '../models/seriesType/common';
|
|
4
5
|
export interface LineElementClasses {
|
|
@@ -28,7 +29,7 @@ export interface LineElementSlots {
|
|
|
28
29
|
line?: React.JSXElementConstructor<AnimatedLineProps>;
|
|
29
30
|
}
|
|
30
31
|
export interface LineElementSlotProps {
|
|
31
|
-
line?: AnimatedLineProps
|
|
32
|
+
line?: SlotComponentPropsFromProps<AnimatedLineProps, {}, LineElementOwnerState>;
|
|
32
33
|
}
|
|
33
34
|
export interface LineElementProps extends Omit<LineElementOwnerState, 'isFaded' | 'isHighlighted'>, Pick<AnimatedLineProps, 'skipAnimation'>, Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color' | 'id'> {
|
|
34
35
|
d: string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { SlotComponentPropsFromProps } from '../internals/SlotComponentPropsFromProps';
|
|
2
3
|
import { LineHighlightElementProps } from './LineHighlightElement';
|
|
3
4
|
export interface LineHighlightPlotSlots {
|
|
4
5
|
lineHighlight?: React.JSXElementConstructor<LineHighlightElementProps>;
|
|
5
6
|
}
|
|
6
7
|
export interface LineHighlightPlotSlotProps {
|
|
7
|
-
lineHighlight?:
|
|
8
|
+
lineHighlight?: SlotComponentPropsFromProps<LineHighlightElementProps, {}, {}>;
|
|
8
9
|
}
|
|
9
10
|
export interface LineHighlightPlotProps extends React.SVGAttributes<SVGSVGElement> {
|
|
10
11
|
/**
|
|
@@ -69,20 +69,24 @@ function LineHighlightPlot(props) {
|
|
|
69
69
|
}) => {
|
|
70
70
|
return groupIds.flatMap(seriesId => {
|
|
71
71
|
const {
|
|
72
|
+
xAxisId: xAxisIdProp,
|
|
73
|
+
yAxisId: yAxisIdProp,
|
|
72
74
|
xAxisKey = defaultXAxisId,
|
|
73
75
|
yAxisKey = defaultYAxisId,
|
|
74
76
|
stackedData,
|
|
75
77
|
data,
|
|
76
78
|
disableHighlight
|
|
77
79
|
} = series[seriesId];
|
|
80
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
81
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
78
82
|
if (disableHighlight || data[highlightedIndex] == null) {
|
|
79
83
|
return null;
|
|
80
84
|
}
|
|
81
|
-
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[
|
|
82
|
-
const yScale = yAxis[
|
|
83
|
-
const xData = xAxis[
|
|
85
|
+
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
86
|
+
const yScale = yAxis[yAxisId].scale;
|
|
87
|
+
const xData = xAxis[xAxisId].data;
|
|
84
88
|
if (xData === undefined) {
|
|
85
|
-
throw new Error(`MUI X
|
|
89
|
+
throw new Error(`MUI X: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
86
90
|
}
|
|
87
91
|
const x = xScale(xData[highlightedIndex]);
|
|
88
92
|
const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
|
|
@@ -93,7 +97,7 @@ function LineHighlightPlot(props) {
|
|
|
93
97
|
})) {
|
|
94
98
|
return null;
|
|
95
99
|
}
|
|
96
|
-
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[
|
|
100
|
+
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
97
101
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({
|
|
98
102
|
id: seriesId,
|
|
99
103
|
color: colorGetter(highlightedIndex),
|
package/LineChart/LinePlot.js
CHANGED
|
@@ -44,22 +44,26 @@ const useAggregatedData = () => {
|
|
|
44
44
|
}) => {
|
|
45
45
|
return groupIds.flatMap(seriesId => {
|
|
46
46
|
const {
|
|
47
|
+
xAxisId: xAxisIdProp,
|
|
48
|
+
yAxisId: yAxisIdProp,
|
|
47
49
|
xAxisKey = defaultXAxisId,
|
|
48
50
|
yAxisKey = defaultYAxisId,
|
|
49
51
|
stackedData,
|
|
50
52
|
data,
|
|
51
53
|
connectNulls
|
|
52
54
|
} = series[seriesId];
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
55
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
56
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
57
|
+
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
58
|
+
const yScale = yAxis[yAxisId].scale;
|
|
59
|
+
const xData = xAxis[xAxisId].data;
|
|
60
|
+
const gradientUsed = yAxis[yAxisId].colorScale && [yAxisId, 'y'] || xAxis[xAxisId].colorScale && [xAxisId, 'x'] || undefined;
|
|
57
61
|
if (process.env.NODE_ENV !== 'production') {
|
|
58
62
|
if (xData === undefined) {
|
|
59
|
-
throw new Error(`MUI X
|
|
63
|
+
throw new Error(`MUI X: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
60
64
|
}
|
|
61
65
|
if (xData.length < stackedData.length) {
|
|
62
|
-
throw new Error(`MUI X
|
|
66
|
+
throw new Error(`MUI X: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
const linePath = (0, _d3Shape.line)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y(d => yScale(d.y[1]));
|
package/LineChart/MarkPlot.js
CHANGED
|
@@ -66,6 +66,8 @@ function MarkPlot(props) {
|
|
|
66
66
|
}) => {
|
|
67
67
|
return groupIds.map(seriesId => {
|
|
68
68
|
const {
|
|
69
|
+
xAxisId: xAxisIdProp,
|
|
70
|
+
yAxisId: yAxisIdProp,
|
|
69
71
|
xAxisKey = defaultXAxisId,
|
|
70
72
|
yAxisKey = defaultYAxisId,
|
|
71
73
|
stackedData,
|
|
@@ -75,15 +77,17 @@ function MarkPlot(props) {
|
|
|
75
77
|
if (showMark === false) {
|
|
76
78
|
return null;
|
|
77
79
|
}
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
const
|
|
80
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
81
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
82
|
+
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
83
|
+
const yScale = yAxis[yAxisId].scale;
|
|
84
|
+
const xData = xAxis[xAxisId].data;
|
|
81
85
|
if (xData === undefined) {
|
|
82
|
-
throw new Error(`MUI X
|
|
86
|
+
throw new Error(`MUI X: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
83
87
|
}
|
|
84
88
|
const clipId = (0, _cleanId.cleanId)(`${chartId}-${seriesId}-line-clip`); // We assume that if displaying line mark, the line will also be rendered
|
|
85
89
|
|
|
86
|
-
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[
|
|
90
|
+
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
87
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
88
92
|
clipPath: `url(#${clipId})`,
|
|
89
93
|
children: xData?.map((x, index) => {
|
package/LineChart/extremums.js
CHANGED
|
@@ -31,7 +31,10 @@ const getExtremumY = params => {
|
|
|
31
31
|
axis,
|
|
32
32
|
isDefaultAxis
|
|
33
33
|
} = params;
|
|
34
|
-
return Object.keys(series).filter(seriesId =>
|
|
34
|
+
return Object.keys(series).filter(seriesId => {
|
|
35
|
+
const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey;
|
|
36
|
+
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
37
|
+
}).reduce((acc, seriesId) => {
|
|
35
38
|
const {
|
|
36
39
|
area,
|
|
37
40
|
stackedData
|