@mui/x-charts 7.3.2 → 7.4.0
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 +7 -1
- package/BarChart/BarClipPath.d.ts +14 -0
- package/BarChart/BarClipPath.js +50 -0
- package/BarChart/BarPlot.d.ts +4 -0
- package/BarChart/BarPlot.js +102 -30
- package/BarChart/getRadius.d.ts +15 -0
- package/BarChart/getRadius.js +37 -0
- package/BarChart/types.d.ts +25 -0
- package/BarChart/types.js +5 -0
- package/CHANGELOG.md +67 -2
- package/ChartsGrid/ChartsGrid.js +22 -11
- package/esm/BarChart/BarChart.js +7 -1
- package/esm/BarChart/BarClipPath.js +42 -0
- package/esm/BarChart/BarPlot.js +103 -31
- package/esm/BarChart/getRadius.js +30 -0
- package/esm/BarChart/types.js +1 -0
- package/esm/ChartsGrid/ChartsGrid.js +23 -12
- package/index.js +1 -1
- package/modern/BarChart/BarChart.js +7 -1
- package/modern/BarChart/BarClipPath.js +42 -0
- package/modern/BarChart/BarPlot.js +103 -31
- package/modern/BarChart/getRadius.js +30 -0
- package/modern/BarChart/types.js +1 -0
- package/modern/ChartsGrid/ChartsGrid.js +23 -12
- package/modern/index.js +1 -1
- package/package.json +2 -2
- package/themeAugmentation/components.d.ts +4 -0
- package/themeAugmentation/overrides.d.ts +2 -0
- package/themeAugmentation/props.d.ts +2 -0
|
@@ -4,7 +4,7 @@ const _excluded = ["vertical", "horizontal"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
-
import { styled } from '@mui/material/styles';
|
|
7
|
+
import { styled, useThemeProps } from '@mui/material/styles';
|
|
8
8
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
9
9
|
import { useTicks } from '../hooks/useTicks';
|
|
10
10
|
import { getChartsGridUtilityClass, chartsGridClasses } from './chartsGridClasses';
|
|
@@ -12,15 +12,22 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
const GridRoot = styled('g', {
|
|
13
13
|
name: 'MuiChartsGrid',
|
|
14
14
|
slot: 'Root',
|
|
15
|
-
overridesResolver: (props, styles) =>
|
|
15
|
+
overridesResolver: (props, styles) => [{
|
|
16
|
+
[`&.${chartsGridClasses.verticalLine}`]: styles.verticalLine
|
|
17
|
+
}, {
|
|
18
|
+
[`&.${chartsGridClasses.horizontalLine}`]: styles.horizontalLine
|
|
19
|
+
}, styles.root]
|
|
20
|
+
})({});
|
|
21
|
+
const GridLine = styled('line', {
|
|
22
|
+
name: 'MuiChartsGrid',
|
|
23
|
+
slot: 'Line',
|
|
24
|
+
overridesResolver: (props, styles) => styles.line
|
|
16
25
|
})(({
|
|
17
26
|
theme
|
|
18
27
|
}) => ({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
strokeWidth: 1
|
|
23
|
-
}
|
|
28
|
+
stroke: (theme.vars || theme).palette.divider,
|
|
29
|
+
shapeRendering: 'crispEdges',
|
|
30
|
+
strokeWidth: 1
|
|
24
31
|
}));
|
|
25
32
|
const useUtilityClasses = ({
|
|
26
33
|
classes
|
|
@@ -42,18 +49,22 @@ const useUtilityClasses = ({
|
|
|
42
49
|
* - [ChartsGrid API](https://mui.com/x/api/charts/charts-axis/)
|
|
43
50
|
*/
|
|
44
51
|
function ChartsGrid(props) {
|
|
52
|
+
const themeProps = useThemeProps({
|
|
53
|
+
props,
|
|
54
|
+
name: 'MuiChartsGrid'
|
|
55
|
+
});
|
|
45
56
|
const {
|
|
46
57
|
vertical,
|
|
47
58
|
horizontal
|
|
48
|
-
} =
|
|
49
|
-
other = _objectWithoutPropertiesLoose(
|
|
59
|
+
} = themeProps,
|
|
60
|
+
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
50
61
|
const {
|
|
51
62
|
xAxis,
|
|
52
63
|
xAxisIds,
|
|
53
64
|
yAxis,
|
|
54
65
|
yAxisIds
|
|
55
66
|
} = React.useContext(CartesianContext);
|
|
56
|
-
const classes = useUtilityClasses(
|
|
67
|
+
const classes = useUtilityClasses(themeProps);
|
|
57
68
|
const horizontalAxisId = yAxisIds[0];
|
|
58
69
|
const verticalAxisId = xAxisIds[0];
|
|
59
70
|
const {
|
|
@@ -81,7 +92,7 @@ function ChartsGrid(props) {
|
|
|
81
92
|
children: [vertical && xTicks.map(({
|
|
82
93
|
formattedValue,
|
|
83
94
|
offset
|
|
84
|
-
}) => /*#__PURE__*/_jsx(
|
|
95
|
+
}) => /*#__PURE__*/_jsx(GridLine, {
|
|
85
96
|
y1: yScale.range()[0],
|
|
86
97
|
y2: yScale.range()[1],
|
|
87
98
|
x1: offset,
|
|
@@ -90,7 +101,7 @@ function ChartsGrid(props) {
|
|
|
90
101
|
}, `vertical-${formattedValue}`)), horizontal && yTicks.map(({
|
|
91
102
|
formattedValue,
|
|
92
103
|
offset
|
|
93
|
-
}) => /*#__PURE__*/_jsx(
|
|
104
|
+
}) => /*#__PURE__*/_jsx(GridLine, {
|
|
94
105
|
y1: offset,
|
|
95
106
|
y2: offset,
|
|
96
107
|
x1: xScale.range()[0],
|
package/modern/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "The community edition of the Charts components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@mui/utils": "^5.15.14",
|
|
36
36
|
"@react-spring/rafz": "^9.7.3",
|
|
37
37
|
"@react-spring/web": "^9.7.3",
|
|
38
|
-
"clsx": "^2.1.
|
|
38
|
+
"clsx": "^2.1.1",
|
|
39
39
|
"d3-color": "^3.1.0",
|
|
40
40
|
"d3-delaunay": "^6.0.4",
|
|
41
41
|
"d3-interpolate": "^3.0.1",
|
|
@@ -18,6 +18,10 @@ export interface ChartsComponents {
|
|
|
18
18
|
MuiChartsClipPath?: {
|
|
19
19
|
defaultProps?: ComponentsProps['MuiChartsClipPath'];
|
|
20
20
|
};
|
|
21
|
+
MuiChartsGrid?: {
|
|
22
|
+
defaultProps?: ComponentsProps['MuiChartsGrid'];
|
|
23
|
+
styleOverrides?: ComponentsOverrides['MuiChartsGrid'];
|
|
24
|
+
};
|
|
21
25
|
MuiChartsLegend?: {
|
|
22
26
|
defaultProps?: ComponentsProps['MuiChartsLegend'];
|
|
23
27
|
styleOverrides?: ComponentsOverrides['MuiChartsLegend'];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BarElementClassKey } from '../BarChart/BarElement';
|
|
2
2
|
import { ChartsAxisClassKey } from '../ChartsAxis';
|
|
3
3
|
import { ChartsAxisHighlightClassKey } from '../ChartsAxisHighlight';
|
|
4
|
+
import { ChartsGridClassKey } from '../ChartsGrid';
|
|
4
5
|
import { ChartsLegendClassKey } from '../ChartsLegend';
|
|
5
6
|
import { ChartsTooltipClassKey } from '../ChartsTooltip';
|
|
6
7
|
import { AreaElementClassKey, LineElementClassKey, MarkElementClassKey } from '../LineChart';
|
|
@@ -9,6 +10,7 @@ import { AreaElementClassKey, LineElementClassKey, MarkElementClassKey } from '.
|
|
|
9
10
|
export interface PickersComponentNameToClassKey {
|
|
10
11
|
MuiChartsAxis: ChartsAxisClassKey;
|
|
11
12
|
MuiChartsAxisHighlight: ChartsAxisHighlightClassKey;
|
|
13
|
+
MuiChartsGrid: ChartsGridClassKey;
|
|
12
14
|
MuiChartsLegend: ChartsLegendClassKey;
|
|
13
15
|
MuiChartsTooltip: ChartsTooltipClassKey;
|
|
14
16
|
|
|
@@ -3,6 +3,7 @@ import { BarElementProps } from '../BarChart/BarElement';
|
|
|
3
3
|
import { ChartsAxisProps } from '../ChartsAxis';
|
|
4
4
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
5
5
|
import { ChartsClipPathProps } from '../ChartsClipPath';
|
|
6
|
+
import { ChartsGridProps } from '../ChartsGrid';
|
|
6
7
|
import { ChartsLegendProps } from '../ChartsLegend';
|
|
7
8
|
import { ChartsSurfaceProps } from '../ChartsSurface';
|
|
8
9
|
import { ChartsTooltipProps } from '../ChartsTooltip';
|
|
@@ -18,6 +19,7 @@ export interface ChartsComponentsPropsList {
|
|
|
18
19
|
MuiChartsYAxis: ChartsYAxisProps;
|
|
19
20
|
MuiChartsAxisHighlight: ChartsAxisHighlightProps;
|
|
20
21
|
MuiChartsClipPath: ChartsClipPathProps;
|
|
22
|
+
MuiChartsGrid: ChartsGridProps;
|
|
21
23
|
MuiChartsLegend: ChartsLegendProps;
|
|
22
24
|
MuiChartsTooltip: ChartsTooltipProps;
|
|
23
25
|
MuiChartsSurface: ChartsSurfaceProps;
|