@mui/x-charts 8.11.2 → 8.11.3
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/index.d.ts +1 -0
- package/BarChart/useBarChartProps.js +4 -3
- package/CHANGELOG.md +86 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +4 -4
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +4 -4
- package/ChartsLegend/ChartsLegend.js +2 -1
- package/ChartsLegend/PiecewiseColorLegend.d.ts +2 -2
- package/ChartsLegend/PiecewiseColorLegend.js +32 -22
- package/ChartsLegend/piecewiseColorLegendClasses.d.ts +4 -0
- package/ChartsLegend/piecewiseColorLegendClasses.js +2 -2
- package/ChartsSurface/ChartsSurface.js +2 -1
- package/ChartsWrapper/ChartsWrapper.d.ts +4 -0
- package/ChartsWrapper/ChartsWrapper.js +73 -25
- package/ChartsXAxis/ChartsGroupedXAxisTicks.js +2 -2
- package/ChartsXAxis/ChartsXAxisImpl.js +3 -3
- package/ChartsXAxis/getVisibleLabels.js +5 -1
- package/ChartsYAxis/ChartsGroupedYAxisTicks.js +2 -2
- package/ChartsYAxis/ChartsYAxisImpl.js +3 -3
- package/LineChart/useAreaPlotData.js +2 -2
- package/LineChart/useLineChartProps.js +2 -1
- package/LineChart/useLinePlotData.js +2 -2
- package/PieChart/PieChart.js +1 -0
- package/RadarChart/RadarAxis/useRadarAxis.js +2 -2
- package/RadarChart/useRadarChartProps.js +2 -1
- package/ScatterChart/useScatterChartProps.js +2 -1
- package/Toolbar/Toolbar.js +2 -1
- package/esm/BarChart/index.d.ts +1 -0
- package/esm/BarChart/useBarChartProps.js +4 -3
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +4 -4
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +4 -4
- package/esm/ChartsLegend/ChartsLegend.js +2 -1
- package/esm/ChartsLegend/PiecewiseColorLegend.d.ts +2 -2
- package/esm/ChartsLegend/PiecewiseColorLegend.js +32 -22
- package/esm/ChartsLegend/piecewiseColorLegendClasses.d.ts +4 -0
- package/esm/ChartsLegend/piecewiseColorLegendClasses.js +2 -2
- package/esm/ChartsSurface/ChartsSurface.js +2 -1
- package/esm/ChartsWrapper/ChartsWrapper.d.ts +4 -0
- package/esm/ChartsWrapper/ChartsWrapper.js +73 -25
- package/esm/ChartsXAxis/ChartsGroupedXAxisTicks.js +2 -2
- package/esm/ChartsXAxis/ChartsXAxisImpl.js +3 -3
- package/esm/ChartsXAxis/getVisibleLabels.js +5 -1
- package/esm/ChartsYAxis/ChartsGroupedYAxisTicks.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxisImpl.js +3 -3
- package/esm/LineChart/useAreaPlotData.js +2 -2
- package/esm/LineChart/useLineChartProps.js +2 -1
- package/esm/LineChart/useLinePlotData.js +2 -2
- package/esm/PieChart/PieChart.js +1 -0
- package/esm/RadarChart/RadarAxis/useRadarAxis.js +2 -2
- package/esm/RadarChart/useRadarChartProps.js +2 -1
- package/esm/ScatterChart/useScatterChartProps.js +2 -1
- package/esm/Toolbar/Toolbar.js +2 -1
- package/esm/hooks/useScale.js +2 -2
- package/esm/hooks/useTicks.js +2 -2
- package/esm/hooks/useTicksGrouped.js +2 -2
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +1 -1
- package/esm/internals/index.js +1 -1
- package/esm/internals/invertScale.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -3
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +2 -2
- package/esm/internals/scaleGuards.d.ts +4 -0
- package/esm/internals/scaleGuards.js +3 -0
- package/esm/models/axis.d.ts +3 -0
- package/hooks/useScale.js +2 -2
- package/hooks/useTicks.js +2 -2
- package/hooks/useTicksGrouped.js +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +4 -4
- package/internals/invertScale.js +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +2 -2
- package/internals/scaleGuards.d.ts +4 -0
- package/internals/{isBandScale.js → scaleGuards.js} +2 -2
- package/models/axis.d.ts +3 -0
- package/package.json +4 -4
- package/esm/internals/isBandScale.d.ts +0 -5
- package/esm/internals/isBandScale.js +0 -3
- package/internals/isBandScale.d.ts +0 -5
package/BarChart/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export * from "./BarPlot.js";
|
|
|
3
3
|
export * from "./BarElement.js";
|
|
4
4
|
export * from "./BarLabel/index.js";
|
|
5
5
|
export * from "./barElementClasses.js";
|
|
6
|
+
export { type BarProps } from "./AnimatedBarElement.js";
|
|
6
7
|
export { barClasses, getBarUtilityClass } from "./barClasses.js";
|
|
7
8
|
export type { BarClassKey, BarClasses } from "./barClasses.js";
|
|
@@ -47,7 +47,7 @@ const useBarChartProps = props => {
|
|
|
47
47
|
barLabel,
|
|
48
48
|
className
|
|
49
49
|
} = props,
|
|
50
|
-
|
|
50
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
51
51
|
const id = (0, _useId.default)();
|
|
52
52
|
const clipPathId = `${id}-clip-path`;
|
|
53
53
|
const hasHorizontalSeries = layout === 'horizontal' || layout === undefined && series.some(item => item.layout === 'horizontal');
|
|
@@ -88,7 +88,7 @@ const useBarChartProps = props => {
|
|
|
88
88
|
scaleType: 'band'
|
|
89
89
|
}, axis)) : yAxis;
|
|
90
90
|
}, [defaultYAxis, hasHorizontalSeries, yAxis]);
|
|
91
|
-
const chartContainerProps = (0, _extends2.default)({},
|
|
91
|
+
const chartContainerProps = (0, _extends2.default)({}, other, {
|
|
92
92
|
series: seriesWithDefault,
|
|
93
93
|
width,
|
|
94
94
|
height,
|
|
@@ -142,7 +142,8 @@ const useBarChartProps = props => {
|
|
|
142
142
|
const chartsWrapperProps = {
|
|
143
143
|
sx,
|
|
144
144
|
legendPosition: props.slotProps?.legend?.position,
|
|
145
|
-
legendDirection: props.slotProps?.legend?.direction
|
|
145
|
+
legendDirection: props.slotProps?.legend?.direction,
|
|
146
|
+
hideLegend: props.hideLegend ?? false
|
|
146
147
|
};
|
|
147
148
|
return {
|
|
148
149
|
chartsWrapperProps,
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,92 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.11.3
|
|
9
|
+
|
|
10
|
+
_Sep 16, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
- 📚 Documentation improvements
|
|
16
|
+
|
|
17
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
18
|
+
@sai6855
|
|
19
|
+
|
|
20
|
+
The following are all team members who have contributed to this release:
|
|
21
|
+
@alexfauquette, @bernardobelchior, @brijeshb42, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @LukasTy, @rita-codes, @siriwatknp
|
|
22
|
+
|
|
23
|
+
### Data Grid
|
|
24
|
+
|
|
25
|
+
#### `@mui/x-data-grid@8.11.3`
|
|
26
|
+
|
|
27
|
+
- [DataGrid] Fix numeric font size not being applied (#19552) @cherniavskii
|
|
28
|
+
- [DataGrid] Improve `operator` types to display literal values (#19529) @siriwatknp
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-pro@8.11.3` [](https://mui.com/r/x-pro-svg-link "Pro plan")
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid@8.11.3`.
|
|
33
|
+
|
|
34
|
+
#### `@mui/x-data-grid-premium@8.11.3` [](https://mui.com/r/x-premium-svg-link "Premium plan")
|
|
35
|
+
|
|
36
|
+
Same changes as in `@mui/x-data-grid-pro@8.11.3`.
|
|
37
|
+
|
|
38
|
+
### Date and Time Pickers
|
|
39
|
+
|
|
40
|
+
#### `@mui/x-date-pickers@8.11.3`
|
|
41
|
+
|
|
42
|
+
- [pickers] Refactor `slots` and `slotProps` propagation strategy (#18867) @LukasTy
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-date-pickers-pro@8.11.3` [](https://mui.com/r/x-pro-svg-link "Pro plan")
|
|
45
|
+
|
|
46
|
+
Same changes as in `@mui/x-date-pickers@8.11.3`.
|
|
47
|
+
|
|
48
|
+
### Charts
|
|
49
|
+
|
|
50
|
+
#### `@mui/x-charts@8.11.3`
|
|
51
|
+
|
|
52
|
+
- [charts] Add `inline-` piecewise legend options (#19382) @JCQuintas
|
|
53
|
+
- [charts] Add bar gradient example (#19174) @bernardobelchior
|
|
54
|
+
- [charts] Ignore empty tick labels in label overlap computation (#19547) @alexfauquette
|
|
55
|
+
- [charts] Rename `isBandScale` to `isDiscreteScale` (#19514) @bernardobelchior
|
|
56
|
+
- [charts] Fix legend position affecting toolbar's position (#19257) @sai6855
|
|
57
|
+
|
|
58
|
+
#### `@mui/x-charts-pro@8.11.3` [](https://mui.com/r/x-pro-svg-link "Pro plan")
|
|
59
|
+
|
|
60
|
+
Same changes as in `@mui/x-charts@8.11.3`, plus:
|
|
61
|
+
|
|
62
|
+
- [charts-pro] Add chart title and caption to export demo (#19524) @bernardobelchior
|
|
63
|
+
|
|
64
|
+
### Tree View
|
|
65
|
+
|
|
66
|
+
#### `@mui/x-tree-view@8.11.3`
|
|
67
|
+
|
|
68
|
+
- [tree view] Stop looping through all items to publish the `removeItem` event (#19500) @flaviendelangle
|
|
69
|
+
- [tree view] Support flat DOM structure (#19350) @flaviendelangle
|
|
70
|
+
- [tree view] Update cursor styles for disabled TreeItem (#19548) @sai6855
|
|
71
|
+
|
|
72
|
+
#### `@mui/x-tree-view-pro@8.11.3` [](https://mui.com/r/x-pro-svg-link "Pro plan")
|
|
73
|
+
|
|
74
|
+
Same changes as in `@mui/x-tree-view@8.11.3`.
|
|
75
|
+
|
|
76
|
+
### Codemod
|
|
77
|
+
|
|
78
|
+
#### `@mui/x-codemod@8.11.3`
|
|
79
|
+
|
|
80
|
+
Internal changes.
|
|
81
|
+
|
|
82
|
+
### Docs
|
|
83
|
+
|
|
84
|
+
- [docs] Add styling row group recipe (#19349) @siriwatknp
|
|
85
|
+
- [docs] Group demos data into the dataset folder (#19549) @alexfauquette
|
|
86
|
+
- [docs] Add `shiny` bar chart example at the top (#19416) @JCQuintas
|
|
87
|
+
|
|
88
|
+
### Core
|
|
89
|
+
|
|
90
|
+
- [code-infra] Axios update (#19577) @Janpot
|
|
91
|
+
- [code-infra] Remove usage of copy-files command from code-infra (#19518) @brijeshb42
|
|
92
|
+
- [internal] Fix naming to match convention @oliviertassinari
|
|
93
|
+
|
|
8
94
|
## 8.11.2
|
|
9
95
|
|
|
10
96
|
_Sep 10, 2025_
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = ChartsXHighlight;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _useScale = require("../hooks/useScale");
|
|
11
|
-
var
|
|
11
|
+
var _scaleGuards = require("../internals/scaleGuards");
|
|
12
12
|
var _useSelector = require("../internals/store/useSelector");
|
|
13
13
|
var _useStore = require("../internals/store/useStore");
|
|
14
14
|
var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
|
|
@@ -39,15 +39,15 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
39
39
|
const xAxis = xAxes.axis[axisId];
|
|
40
40
|
const xScale = xAxis.scale;
|
|
41
41
|
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
42
|
-
const
|
|
42
|
+
const isXScaleOrdinal = type === 'band' && value !== null && (0, _scaleGuards.isOrdinalScale)(xScale);
|
|
43
43
|
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
-
const isError =
|
|
44
|
+
const isError = isXScaleOrdinal && xScale(value) === undefined;
|
|
45
45
|
if (isError) {
|
|
46
46
|
console.error([`MUI X Charts: 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'));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
50
|
-
children: [
|
|
50
|
+
children: [isXScaleOrdinal && xScale(value) !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlightPath.ChartsAxisHighlightPath, {
|
|
51
51
|
d: `M ${xScale(value) - (xScale.step() - xScale.bandwidth()) / 2} ${top} l ${xScale.step()} 0 l 0 ${height} l ${-xScale.step()} 0 Z`,
|
|
52
52
|
className: classes.root,
|
|
53
53
|
ownerState: {
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = ChartsYHighlight;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _useScale = require("../hooks/useScale");
|
|
11
|
-
var
|
|
11
|
+
var _scaleGuards = require("../internals/scaleGuards");
|
|
12
12
|
var _useSelector = require("../internals/store/useSelector");
|
|
13
13
|
var _useStore = require("../internals/store/useStore");
|
|
14
14
|
var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
|
|
@@ -39,15 +39,15 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
39
39
|
const yAxis = yAxes.axis[axisId];
|
|
40
40
|
const yScale = yAxis.scale;
|
|
41
41
|
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
42
|
-
const
|
|
42
|
+
const isYScaleOrdinal = type === 'band' && value !== null && (0, _scaleGuards.isOrdinalScale)(yScale);
|
|
43
43
|
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
-
const isError =
|
|
44
|
+
const isError = isYScaleOrdinal && yScale(value) === undefined;
|
|
45
45
|
if (isError) {
|
|
46
46
|
console.error([`MUI X Charts: 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'));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
50
|
-
children: [
|
|
50
|
+
children: [isYScaleOrdinal && yScale(value) !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlightPath.ChartsAxisHighlightPath, {
|
|
51
51
|
d: `M ${left} ${yScale(value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
|
|
52
52
|
className: classes.root,
|
|
53
53
|
ownerState: {
|
|
@@ -58,7 +58,8 @@ const RootElement = (0, _styles.styled)('ul', {
|
|
|
58
58
|
display: ownerState.direction === 'vertical' ? 'flex' : 'inline-flex',
|
|
59
59
|
alignItems: 'center',
|
|
60
60
|
gap: theme.spacing(1)
|
|
61
|
-
}
|
|
61
|
+
},
|
|
62
|
+
gridArea: 'legend'
|
|
62
63
|
}));
|
|
63
64
|
const ChartsLegend = exports.ChartsLegend = (0, _consumeSlots.consumeSlots)('MuiChartsLegend', 'legend', {
|
|
64
65
|
defaultProps: {
|
|
@@ -20,10 +20,10 @@ export interface PiecewiseColorLegendProps extends ColorLegendSelector, PrependK
|
|
|
20
20
|
*/
|
|
21
21
|
labelFormatter?: (params: PiecewiseLabelFormatterParams) => string | null;
|
|
22
22
|
/**
|
|
23
|
-
* Where to position the labels relative to the
|
|
23
|
+
* Where to position the labels relative to the color marks.
|
|
24
24
|
* @default 'extremes'
|
|
25
25
|
*/
|
|
26
|
-
labelPosition?: 'start' | 'end' | 'extremes';
|
|
26
|
+
labelPosition?: 'start' | 'end' | 'extremes' | 'inline-start' | 'inline-end';
|
|
27
27
|
/**
|
|
28
28
|
* Callback fired when a legend item is clicked.
|
|
29
29
|
* @param {React.MouseEvent<HTMLButtonElement, MouseEvent>} event The click event.
|
|
@@ -28,6 +28,7 @@ const RootElement = (0, _styles.styled)('ul', {
|
|
|
28
28
|
theme,
|
|
29
29
|
ownerState
|
|
30
30
|
}) => {
|
|
31
|
+
const classes = _piecewiseColorLegendClasses.piecewiseColorLegendClasses;
|
|
31
32
|
return (0, _extends2.default)({}, theme.typography.caption, {
|
|
32
33
|
color: (theme.vars || theme).palette.text.primary,
|
|
33
34
|
lineHeight: '100%',
|
|
@@ -39,8 +40,8 @@ const RootElement = (0, _styles.styled)('ul', {
|
|
|
39
40
|
paddingInlineStart: 0,
|
|
40
41
|
marginBlock: theme.spacing(1),
|
|
41
42
|
marginInline: theme.spacing(1),
|
|
42
|
-
width: '
|
|
43
|
-
[`button.${
|
|
43
|
+
width: 'fit-content',
|
|
44
|
+
[`button.${classes.item}`]: {
|
|
44
45
|
// Reset button styles
|
|
45
46
|
background: 'none',
|
|
46
47
|
border: 'none',
|
|
@@ -52,55 +53,62 @@ const RootElement = (0, _styles.styled)('ul', {
|
|
|
52
53
|
letterSpacing: 'inherit',
|
|
53
54
|
color: 'inherit'
|
|
54
55
|
},
|
|
55
|
-
[`.${
|
|
56
|
+
[`.${classes.item}`]: {
|
|
56
57
|
display: 'flex',
|
|
57
58
|
gap: theme.spacing(0.5)
|
|
58
59
|
},
|
|
59
|
-
[`li :not(.${
|
|
60
|
+
[`li :not(.${classes.minLabel}, .${classes.maxLabel}) .${classes?.mark}`]: {
|
|
60
61
|
alignSelf: 'center'
|
|
61
62
|
},
|
|
62
|
-
[`&.${
|
|
63
|
+
[`&.${classes.start}`]: {
|
|
63
64
|
alignItems: 'end'
|
|
64
65
|
},
|
|
65
|
-
[`&.${
|
|
66
|
+
[`&.${classes.end}`]: {
|
|
66
67
|
alignItems: 'start'
|
|
67
68
|
},
|
|
68
|
-
[`&.${
|
|
69
|
+
[`&.${classes.horizontal}`]: {
|
|
69
70
|
alignItems: 'center',
|
|
70
|
-
[`.${
|
|
71
|
+
[`.${classes.item}`]: {
|
|
71
72
|
flexDirection: 'column'
|
|
72
73
|
},
|
|
73
|
-
[`&.${
|
|
74
|
+
[`&.${classes.inlineStart}, &.${classes.inlineEnd}`]: {
|
|
75
|
+
gap: theme.spacing(1.5),
|
|
76
|
+
flexWrap: 'wrap',
|
|
77
|
+
[`.${classes.item}`]: {
|
|
78
|
+
flexDirection: 'row'
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
[`&.${classes.start}`]: {
|
|
74
82
|
alignItems: 'end'
|
|
75
83
|
},
|
|
76
|
-
[`&.${
|
|
84
|
+
[`&.${classes.end}`]: {
|
|
77
85
|
alignItems: 'start'
|
|
78
86
|
},
|
|
79
|
-
[`.${
|
|
87
|
+
[`.${classes.minLabel}`]: {
|
|
80
88
|
alignItems: 'end'
|
|
81
89
|
},
|
|
82
|
-
[`&.${
|
|
83
|
-
[`.${
|
|
90
|
+
[`&.${classes.extremes}`]: {
|
|
91
|
+
[`.${classes.minLabel}, .${classes.maxLabel}`]: {
|
|
84
92
|
alignItems: 'center',
|
|
85
93
|
display: 'flex',
|
|
86
94
|
flexDirection: 'row'
|
|
87
95
|
}
|
|
88
96
|
}
|
|
89
97
|
},
|
|
90
|
-
[`&.${
|
|
91
|
-
[`.${
|
|
98
|
+
[`&.${classes.vertical}`]: {
|
|
99
|
+
[`.${classes.item}`]: {
|
|
92
100
|
flexDirection: 'row',
|
|
93
101
|
alignItems: 'center'
|
|
94
102
|
},
|
|
95
|
-
[`&.${
|
|
103
|
+
[`&.${classes.start}, &.${classes.inlineStart}`]: {
|
|
96
104
|
alignItems: 'end'
|
|
97
105
|
},
|
|
98
|
-
[`&.${
|
|
106
|
+
[`&.${classes.end}, &.${classes.inlineEnd}`]: {
|
|
99
107
|
alignItems: 'start'
|
|
100
108
|
},
|
|
101
|
-
[`&.${
|
|
109
|
+
[`&.${classes.extremes}`]: {
|
|
102
110
|
alignItems: 'center',
|
|
103
|
-
[`.${
|
|
111
|
+
[`.${classes.minLabel}, .${classes.maxLabel}`]: {
|
|
104
112
|
alignItems: 'center',
|
|
105
113
|
display: 'flex',
|
|
106
114
|
flexDirection: 'column'
|
|
@@ -153,6 +161,8 @@ const PiecewiseColorLegend = exports.PiecewiseColorLegend = (0, _consumeThemePro
|
|
|
153
161
|
const isStart = labelPosition === 'start';
|
|
154
162
|
const isEnd = labelPosition === 'end';
|
|
155
163
|
const isExtremes = labelPosition === 'extremes';
|
|
164
|
+
const isInlineStart = labelPosition === 'inline-start';
|
|
165
|
+
const isInlineEnd = labelPosition === 'inline-end';
|
|
156
166
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RootElement, (0, _extends2.default)({
|
|
157
167
|
className: (0, _clsx.default)(classes?.root, className),
|
|
158
168
|
ref: ref
|
|
@@ -186,8 +196,8 @@ const PiecewiseColorLegend = exports.PiecewiseColorLegend = (0, _consumeThemePro
|
|
|
186
196
|
if (label === null || label === undefined) {
|
|
187
197
|
return null;
|
|
188
198
|
}
|
|
189
|
-
const isTextBefore = isStart || isExtremes && isFirst;
|
|
190
|
-
const isTextAfter = isEnd || isExtremes && isLast;
|
|
199
|
+
const isTextBefore = isStart || isExtremes && isFirst || isInlineStart;
|
|
200
|
+
const isTextAfter = isEnd || isExtremes && isLast || isInlineEnd;
|
|
191
201
|
const clickObject = {
|
|
192
202
|
type: 'piecewiseColor',
|
|
193
203
|
color,
|
|
@@ -255,7 +265,7 @@ process.env.NODE_ENV !== "production" ? PiecewiseColorLegend.propTypes = {
|
|
|
255
265
|
* Where to position the labels relative to the gradient.
|
|
256
266
|
* @default 'extremes'
|
|
257
267
|
*/
|
|
258
|
-
labelPosition: _propTypes.default.oneOf(['start', 'end', 'extremes']),
|
|
268
|
+
labelPosition: _propTypes.default.oneOf(['start', 'end', 'extremes', 'inline-start', 'inline-end']),
|
|
259
269
|
/**
|
|
260
270
|
* The type of the mark.
|
|
261
271
|
* @default 'square'
|
|
@@ -19,6 +19,10 @@ export interface PiecewiseColorLegendClasses {
|
|
|
19
19
|
end: string;
|
|
20
20
|
/** Styles applied to the legend with the labels on the extremes of the color marks. */
|
|
21
21
|
extremes: string;
|
|
22
|
+
/** Styles applied to the legend with the labels inlined before the color marks. */
|
|
23
|
+
inlineStart: string;
|
|
24
|
+
/** Styles applied to the legend with the labels inlined after the color marks. */
|
|
25
|
+
inlineEnd: string;
|
|
22
26
|
/** Styles applied to the marks. */
|
|
23
27
|
mark: string;
|
|
24
28
|
/** Styles applied to the series label. */
|
|
@@ -18,7 +18,7 @@ const useUtilityClasses = props => {
|
|
|
18
18
|
labelPosition
|
|
19
19
|
} = props;
|
|
20
20
|
const slots = {
|
|
21
|
-
root: ['root', direction, labelPosition],
|
|
21
|
+
root: ['root', direction, labelPosition?.replaceAll(/-(\w)/g, match => match[1].toUpperCase())],
|
|
22
22
|
minLabel: ['minLabel'],
|
|
23
23
|
maxLabel: ['maxLabel'],
|
|
24
24
|
item: ['item'],
|
|
@@ -28,4 +28,4 @@ const useUtilityClasses = props => {
|
|
|
28
28
|
return (0, _composeClasses.default)(slots, getLegendUtilityClass, classes);
|
|
29
29
|
};
|
|
30
30
|
exports.useUtilityClasses = useUtilityClasses;
|
|
31
|
-
const piecewiseColorLegendClasses = exports.piecewiseColorLegendClasses = (0, _generateUtilityClasses.default)('MuiPiecewiseColorLegendClasses', ['root', 'minLabel', 'maxLabel', 'item', 'vertical', 'horizontal', 'start', 'end', 'extremes', 'mark', 'label']);
|
|
31
|
+
const piecewiseColorLegendClasses = exports.piecewiseColorLegendClasses = (0, _generateUtilityClasses.default)('MuiPiecewiseColorLegendClasses', ['root', 'minLabel', 'maxLabel', 'item', 'vertical', 'horizontal', 'start', 'end', 'extremes', 'inlineStart', 'inlineEnd', 'mark', 'label']);
|
|
@@ -37,7 +37,8 @@ const ChartsSurfaceStyles = (0, _styles.styled)('svg', {
|
|
|
37
37
|
// This prevents default touch actions when using the svg on mobile devices.
|
|
38
38
|
// For example, prevent page scroll & zoom.
|
|
39
39
|
touchAction: 'pan-y',
|
|
40
|
-
userSelect: 'none'
|
|
40
|
+
userSelect: 'none',
|
|
41
|
+
gridArea: 'chart'
|
|
41
42
|
}));
|
|
42
43
|
|
|
43
44
|
/**
|
|
@@ -13,6 +13,10 @@ export interface ChartsWrapperProps {
|
|
|
13
13
|
* @default 'horizontal'
|
|
14
14
|
*/
|
|
15
15
|
legendDirection?: Direction;
|
|
16
|
+
/**
|
|
17
|
+
* If `true`, the legend is not rendered.
|
|
18
|
+
*/
|
|
19
|
+
hideLegend: boolean;
|
|
16
20
|
/**
|
|
17
21
|
* If `true`, the chart wrapper set `height: 100%`.
|
|
18
22
|
* @default `false` if the `height` prop is set. And `true` otherwise.
|
|
@@ -14,50 +14,76 @@ var _useChartRootRef = require("../hooks/useChartRootRef");
|
|
|
14
14
|
var _useStore = require("../internals/store/useStore");
|
|
15
15
|
var _useSelector = require("../internals/store/useSelector");
|
|
16
16
|
var _useChartDimensions = require("../internals/plugins/corePlugins/useChartDimensions");
|
|
17
|
+
var _Toolbar = require("../Toolbar");
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const
|
|
19
|
+
const getJustifyItems = position => {
|
|
20
|
+
if (position?.horizontal === 'start') {
|
|
21
|
+
return 'start';
|
|
22
|
+
}
|
|
23
|
+
if (position?.horizontal === 'end') {
|
|
24
|
+
return 'end';
|
|
25
|
+
}
|
|
26
|
+
return 'center';
|
|
27
|
+
};
|
|
28
|
+
const getAlignItems = position => {
|
|
29
|
+
if (position?.vertical === 'top') {
|
|
30
|
+
return 'flex-start';
|
|
31
|
+
}
|
|
32
|
+
if (position?.vertical === 'bottom') {
|
|
33
|
+
return 'flex-end';
|
|
34
|
+
}
|
|
35
|
+
return 'center';
|
|
36
|
+
};
|
|
37
|
+
const addToolbar = template => {
|
|
38
|
+
return `"toolbar"
|
|
39
|
+
${template}`;
|
|
40
|
+
};
|
|
41
|
+
const getGridTemplateAreas = (hideLegend, direction, position) => {
|
|
42
|
+
if (hideLegend) {
|
|
43
|
+
return `"chart"`;
|
|
44
|
+
}
|
|
19
45
|
if (direction === 'vertical') {
|
|
20
46
|
if (position?.horizontal === 'start') {
|
|
21
|
-
return
|
|
47
|
+
return `"legend chart"`;
|
|
22
48
|
}
|
|
23
|
-
return
|
|
49
|
+
return `"chart legend"`;
|
|
24
50
|
}
|
|
25
51
|
if (position?.vertical === 'bottom') {
|
|
26
|
-
return
|
|
52
|
+
return `"chart"
|
|
53
|
+
"legend"`;
|
|
27
54
|
}
|
|
28
|
-
return
|
|
55
|
+
return `"legend"
|
|
56
|
+
"chart"`;
|
|
29
57
|
};
|
|
30
|
-
const
|
|
58
|
+
const getTemplateColumns = (hideLegend, direction, position, width) => {
|
|
31
59
|
if (direction === 'vertical') {
|
|
32
|
-
if (
|
|
33
|
-
return '
|
|
34
|
-
}
|
|
35
|
-
if (position?.vertical === 'bottom') {
|
|
36
|
-
return 'flex-end';
|
|
60
|
+
if (hideLegend) {
|
|
61
|
+
return '1fr';
|
|
37
62
|
}
|
|
38
|
-
}
|
|
39
|
-
if (direction === 'horizontal') {
|
|
40
63
|
if (position?.horizontal === 'start') {
|
|
41
|
-
return '
|
|
64
|
+
return 'auto 1fr';
|
|
42
65
|
}
|
|
43
|
-
|
|
44
|
-
|
|
66
|
+
return `${width ? 'auto' : '1fr'} auto`;
|
|
67
|
+
}
|
|
68
|
+
return '100%';
|
|
69
|
+
};
|
|
70
|
+
const getTemplateRows = (hideLegend, direction) => {
|
|
71
|
+
if (direction === 'vertical') {
|
|
72
|
+
if (hideLegend) {
|
|
73
|
+
return 'auto';
|
|
45
74
|
}
|
|
75
|
+
return 'auto 1fr';
|
|
46
76
|
}
|
|
47
|
-
return '
|
|
77
|
+
return 'auto 1fr';
|
|
48
78
|
};
|
|
49
79
|
const Root = (0, _styles.styled)('div', {
|
|
50
80
|
name: 'MuiChartsWrapper',
|
|
51
81
|
slot: 'Root',
|
|
52
|
-
shouldForwardProp: prop => (0, _createStyled.shouldForwardProp)(prop) && prop !== 'extendVertically'
|
|
82
|
+
shouldForwardProp: prop => (0, _createStyled.shouldForwardProp)(prop) && prop !== 'extendVertically' && prop !== 'width'
|
|
53
83
|
})(({
|
|
54
|
-
ownerState
|
|
84
|
+
ownerState,
|
|
85
|
+
width
|
|
55
86
|
}) => ({
|
|
56
|
-
display: 'flex',
|
|
57
|
-
flexDirection: getDirection(ownerState.legendDirection, ownerState.legendPosition),
|
|
58
|
-
flex: 1,
|
|
59
|
-
justifyContent: 'center',
|
|
60
|
-
alignItems: getAlign(ownerState.legendDirection, ownerState.legendPosition),
|
|
61
87
|
variants: [{
|
|
62
88
|
props: {
|
|
63
89
|
extendVertically: true
|
|
@@ -65,7 +91,23 @@ const Root = (0, _styles.styled)('div', {
|
|
|
65
91
|
style: {
|
|
66
92
|
height: '100%'
|
|
67
93
|
}
|
|
68
|
-
}]
|
|
94
|
+
}],
|
|
95
|
+
flex: 1,
|
|
96
|
+
display: 'grid',
|
|
97
|
+
gridTemplateColumns: getTemplateColumns(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition, width),
|
|
98
|
+
gridTemplateRows: getTemplateRows(ownerState.hideLegend, ownerState.legendDirection),
|
|
99
|
+
[`&:has(.${_Toolbar.chartsToolbarClasses.root})`]: {
|
|
100
|
+
gridTemplateAreas: addToolbar(getGridTemplateAreas(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition))
|
|
101
|
+
},
|
|
102
|
+
[`&:not(:has(.${_Toolbar.chartsToolbarClasses.root}))`]: {
|
|
103
|
+
gridTemplateAreas: getGridTemplateAreas(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition)
|
|
104
|
+
},
|
|
105
|
+
justifyContent: 'center',
|
|
106
|
+
justifyItems: getJustifyItems(ownerState.legendPosition),
|
|
107
|
+
alignItems: getAlignItems(ownerState.legendPosition),
|
|
108
|
+
[`& > .${_Toolbar.chartsToolbarClasses.root}`]: {
|
|
109
|
+
justifySelf: 'center'
|
|
110
|
+
}
|
|
69
111
|
}));
|
|
70
112
|
|
|
71
113
|
/**
|
|
@@ -81,6 +123,7 @@ function ChartsWrapper(props) {
|
|
|
81
123
|
const chartRootRef = (0, _useChartRootRef.useChartRootRef)();
|
|
82
124
|
const store = (0, _useStore.useStore)();
|
|
83
125
|
const {
|
|
126
|
+
width: propsWidth,
|
|
84
127
|
height: propsHeight
|
|
85
128
|
} = (0, _useSelector.useSelector)(store, _useChartDimensions.selectorChartPropsSize);
|
|
86
129
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, {
|
|
@@ -88,6 +131,7 @@ function ChartsWrapper(props) {
|
|
|
88
131
|
ownerState: props,
|
|
89
132
|
sx: sx,
|
|
90
133
|
extendVertically: extendVertically ?? propsHeight === undefined,
|
|
134
|
+
width: propsWidth,
|
|
91
135
|
children: children
|
|
92
136
|
});
|
|
93
137
|
}
|
|
@@ -102,6 +146,10 @@ process.env.NODE_ENV !== "production" ? ChartsWrapper.propTypes = {
|
|
|
102
146
|
* @default `false` if the `height` prop is set. And `true` otherwise.
|
|
103
147
|
*/
|
|
104
148
|
extendVertically: _propTypes.default.bool,
|
|
149
|
+
/**
|
|
150
|
+
* If `true`, the legend is not rendered.
|
|
151
|
+
*/
|
|
152
|
+
hideLegend: _propTypes.default.bool.isRequired,
|
|
105
153
|
/**
|
|
106
154
|
* The direction of the legend.
|
|
107
155
|
* @default 'horizontal'
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
exports.ChartsGroupedXAxisTicks = ChartsGroupedXAxisTicks;
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
|
-
var
|
|
12
|
+
var _scaleGuards = require("../internals/scaleGuards");
|
|
13
13
|
var _useChartContext = require("../context/ChartProvider/useChartContext");
|
|
14
14
|
var _utilities = require("./utilities");
|
|
15
15
|
var _useTicksGrouped = require("../hooks/useTicksGrouped");
|
|
@@ -40,7 +40,7 @@ function ChartsGroupedXAxisTicks(inProps) {
|
|
|
40
40
|
TickLabel,
|
|
41
41
|
axisTickLabelProps
|
|
42
42
|
} = (0, _useAxisTicksProps.useAxisTicksProps)(inProps);
|
|
43
|
-
if (!(0,
|
|
43
|
+
if (!(0, _scaleGuards.isOrdinalScale)(xScale)) {
|
|
44
44
|
throw new Error('MUI X Charts: ChartsGroupedXAxis only supports the `band` and `point` scale types.');
|
|
45
45
|
}
|
|
46
46
|
const {
|
|
@@ -15,7 +15,7 @@ var _styles = require("@mui/material/styles");
|
|
|
15
15
|
var _ChartsSingleXAxisTicks = require("./ChartsSingleXAxisTicks");
|
|
16
16
|
var _ChartsGroupedXAxisTicks = require("./ChartsGroupedXAxisTicks");
|
|
17
17
|
var _ChartsText = require("../ChartsText");
|
|
18
|
-
var
|
|
18
|
+
var _scaleGuards = require("../internals/scaleGuards");
|
|
19
19
|
var _isInfinity = require("../internals/isInfinity");
|
|
20
20
|
var _utilities = require("./utilities");
|
|
21
21
|
var _hooks = require("../hooks");
|
|
@@ -87,8 +87,8 @@ function ChartsXAxisImpl(_ref) {
|
|
|
87
87
|
}
|
|
88
88
|
const labelHeight = label ? (0, _domUtils.getStringSize)(label, axisLabelProps.style).height : 0;
|
|
89
89
|
const domain = xScale.domain();
|
|
90
|
-
const
|
|
91
|
-
const skipTickRendering =
|
|
90
|
+
const isScaleOrdinal = (0, _scaleGuards.isOrdinalScale)(xScale);
|
|
91
|
+
const skipTickRendering = isScaleOrdinal ? domain.length === 0 : domain.some(_isInfinity.isInfinity);
|
|
92
92
|
let children = null;
|
|
93
93
|
if (!skipTickRendering) {
|
|
94
94
|
children = 'groups' in axis && Array.isArray(axis.groups) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGroupedXAxisTicks.ChartsGroupedXAxisTicks, (0, _extends2.default)({}, inProps)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSingleXAxisTicks.ChartsSingleXAxisTicks, (0, _extends2.default)({}, inProps, {
|
|
@@ -43,8 +43,12 @@ function getVisibleLabels(xTicks, {
|
|
|
43
43
|
return new Set(xTicks.filter((item, labelIndex) => {
|
|
44
44
|
const {
|
|
45
45
|
offset,
|
|
46
|
-
labelOffset
|
|
46
|
+
labelOffset,
|
|
47
|
+
formattedValue
|
|
47
48
|
} = item;
|
|
49
|
+
if (formattedValue === '') {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
48
52
|
const textPosition = offset + labelOffset;
|
|
49
53
|
if (labelIndex > 0 && direction * textPosition < direction * (previousTextLimit + tickLabelMinGap)) {
|
|
50
54
|
return false;
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
exports.ChartsGroupedYAxisTicks = ChartsGroupedYAxisTicks;
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
|
-
var
|
|
12
|
+
var _scaleGuards = require("../internals/scaleGuards");
|
|
13
13
|
var _useChartContext = require("../context/ChartProvider/useChartContext");
|
|
14
14
|
var _utilities = require("./utilities");
|
|
15
15
|
var _useTicksGrouped = require("../hooks/useTicksGrouped");
|
|
@@ -41,7 +41,7 @@ function ChartsGroupedYAxisTicks(inProps) {
|
|
|
41
41
|
TickLabel,
|
|
42
42
|
axisTickLabelProps
|
|
43
43
|
} = (0, _useAxisTicksProps.useAxisTicksProps)(inProps);
|
|
44
|
-
if (!(0,
|
|
44
|
+
if (!(0, _scaleGuards.isOrdinalScale)(yScale)) {
|
|
45
45
|
throw new Error('MUI X Charts: ChartsGroupedYAxis only supports the `band` and `point` scale types.');
|
|
46
46
|
}
|
|
47
47
|
const {
|
|
@@ -19,7 +19,7 @@ var _utilities = require("./utilities");
|
|
|
19
19
|
var _isInfinity = require("../internals/isInfinity");
|
|
20
20
|
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
21
21
|
var _useIsHydrated = require("../hooks/useIsHydrated");
|
|
22
|
-
var
|
|
22
|
+
var _scaleGuards = require("../internals/scaleGuards");
|
|
23
23
|
var _domUtils = require("../internals/domUtils");
|
|
24
24
|
var _AxisSharedComponents = require("../internals/components/AxisSharedComponents");
|
|
25
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -107,8 +107,8 @@ function ChartsYAxisImpl(_ref) {
|
|
|
107
107
|
};
|
|
108
108
|
const axisLabelHeight = label == null ? 0 : (0, _domUtils.getStringSize)(label, axisLabelProps.style).height;
|
|
109
109
|
const domain = yScale.domain();
|
|
110
|
-
const
|
|
111
|
-
const skipTickRendering =
|
|
110
|
+
const isScaleOrdinal = (0, _scaleGuards.isOrdinalScale)(yScale);
|
|
111
|
+
const skipTickRendering = isScaleOrdinal ? domain.length === 0 : domain.some(_isInfinity.isInfinity);
|
|
112
112
|
let children = null;
|
|
113
113
|
if (!skipTickRendering) {
|
|
114
114
|
children = 'groups' in axis && Array.isArray(axis.groups) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGroupedYAxisTicks.ChartsGroupedYAxisTicks, (0, _extends2.default)({}, inProps)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSingleYAxisTicks.ChartsSingleYAxisTicks, (0, _extends2.default)({}, inProps, {
|