@mui/x-charts 8.3.0 → 8.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 +3 -2
- package/CHANGELOG.md +206 -10
- package/ChartContainer/ChartContainer.js +1 -1
- package/ChartsAxis/axisClasses.d.ts +5 -0
- package/ChartsAxis/axisClasses.js +1 -1
- package/ChartsGrid/ChartsHorizontalGrid.js +2 -1
- package/ChartsGrid/ChartsVerticalGrid.js +2 -1
- package/ChartsLegend/ChartsLegend.js +1 -0
- package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
- package/ChartsSurface/ChartsSurface.js +1 -0
- package/ChartsXAxis/ChartsXAxis.js +9 -17
- package/ChartsYAxis/ChartsYAxis.js +6 -9
- package/Gauge/Gauge.js +1 -0
- package/Gauge/GaugeContainer.js +1 -0
- package/Gauge/GaugeProvider.js +1 -3
- package/LineChart/AnimatedLine.js +1 -0
- package/LineChart/LineChart.js +3 -2
- package/LineChart/LineHighlightPlot.js +1 -4
- package/LineChart/MarkPlot.js +1 -4
- package/PieChart/PieArc.js +1 -0
- package/PieChart/PieArcLabel.js +1 -0
- package/PieChart/PieChart.js +7 -6
- package/RadarChart/RadarChart.js +3 -2
- package/ScatterChart/Scatter.js +3 -11
- package/ScatterChart/ScatterChart.js +5 -4
- package/SparkLineChart/SparkLineChart.js +31 -26
- package/Toolbar/ToolbarButton.js +1 -0
- package/context/ChartProvider/ChartContext.js +1 -3
- package/esm/BarChart/BarChart.js +3 -2
- package/esm/ChartContainer/ChartContainer.js +1 -1
- package/esm/ChartsAxis/axisClasses.d.ts +5 -0
- package/esm/ChartsAxis/axisClasses.js +1 -1
- package/esm/ChartsGrid/ChartsHorizontalGrid.js +2 -1
- package/esm/ChartsGrid/ChartsVerticalGrid.js +2 -1
- package/esm/ChartsLegend/ChartsLegend.js +1 -0
- package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
- package/esm/ChartsSurface/ChartsSurface.js +1 -0
- package/esm/ChartsXAxis/ChartsXAxis.js +9 -17
- package/esm/ChartsYAxis/ChartsYAxis.js +6 -9
- package/esm/Gauge/Gauge.js +1 -0
- package/esm/Gauge/GaugeContainer.js +1 -0
- package/esm/Gauge/GaugeProvider.js +1 -3
- package/esm/LineChart/AnimatedLine.js +1 -0
- package/esm/LineChart/LineChart.js +3 -2
- package/esm/LineChart/LineHighlightPlot.js +1 -4
- package/esm/LineChart/MarkPlot.js +1 -4
- package/esm/PieChart/PieArc.js +1 -0
- package/esm/PieChart/PieArcLabel.js +1 -0
- package/esm/PieChart/PieChart.js +5 -4
- package/esm/RadarChart/RadarChart.js +3 -2
- package/esm/ScatterChart/Scatter.js +3 -11
- package/esm/ScatterChart/ScatterChart.js +5 -4
- package/esm/SparkLineChart/SparkLineChart.js +31 -26
- package/esm/Toolbar/ToolbarButton.js +1 -0
- package/esm/context/ChartProvider/ChartContext.js +1 -3
- package/esm/hooks/useTicks.d.ts +1 -4
- package/esm/hooks/useTicks.js +29 -28
- package/esm/index.js +1 -1
- package/esm/internals/constants.d.ts +1 -1
- package/esm/internals/constants.js +1 -1
- package/esm/internals/consumeSlots.js +2 -1
- package/esm/internals/consumeThemeProps.js +3 -1
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +3 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +8 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
- package/esm/internals/ticks.d.ts +6 -0
- package/esm/internals/ticks.js +22 -0
- package/hooks/useTicks.d.ts +1 -4
- package/hooks/useTicks.js +29 -29
- package/index.js +1 -1
- package/internals/constants.d.ts +1 -1
- package/internals/constants.js +2 -2
- package/internals/consumeSlots.js +2 -1
- package/internals/consumeThemeProps.js +3 -1
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +7 -8
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +8 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +3 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
- package/internals/ticks.d.ts +6 -0
- package/internals/ticks.js +29 -0
- package/package.json +3 -3
|
@@ -61,13 +61,14 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
61
61
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
62
62
|
"data-drawing-container": true,
|
|
63
63
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, (0, _extends2.default)({}, scatterPlotProps))
|
|
64
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}))]
|
|
64
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), children]
|
|
65
|
+
})), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({
|
|
66
|
+
trigger: "item"
|
|
67
|
+
}, props.slotProps?.tooltip))]
|
|
68
68
|
}))
|
|
69
69
|
}));
|
|
70
70
|
});
|
|
71
|
+
if (process.env.NODE_ENV !== "production") ScatterChart.displayName = "ScatterChart";
|
|
71
72
|
process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
72
73
|
// ----------------------------- Warning --------------------------------
|
|
73
74
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -15,7 +15,8 @@ var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
|
15
15
|
var _ChartsClipPath = require("../ChartsClipPath");
|
|
16
16
|
var _BarChart = require("../BarChart");
|
|
17
17
|
var _LineChart = require("../LineChart");
|
|
18
|
-
var
|
|
18
|
+
var _ChartDataProvider = require("../ChartDataProvider");
|
|
19
|
+
var _ChartsSurface = require("../ChartsSurface");
|
|
19
20
|
var _constants = require("../constants");
|
|
20
21
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
21
22
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
@@ -78,8 +79,7 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
|
|
|
78
79
|
}
|
|
79
80
|
return typeof color === 'function' ? mode => [color(mode)] : [color];
|
|
80
81
|
}, [color]);
|
|
81
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
82
|
-
ref: ref,
|
|
82
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartDataProvider.ChartDataProvider, {
|
|
83
83
|
series: [(0, _extends2.default)({
|
|
84
84
|
type: plotType,
|
|
85
85
|
data,
|
|
@@ -92,7 +92,6 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
|
|
|
92
92
|
width: width,
|
|
93
93
|
height: height,
|
|
94
94
|
margin: margin,
|
|
95
|
-
className: className,
|
|
96
95
|
xAxis: [(0, _extends2.default)({
|
|
97
96
|
id: _constants.DEFAULT_X_AXIS_KEY,
|
|
98
97
|
scaleType: plotType === 'bar' ? 'band' : 'point',
|
|
@@ -109,34 +108,40 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
|
|
|
109
108
|
position: 'none'
|
|
110
109
|
})],
|
|
111
110
|
colors: colors,
|
|
112
|
-
sx: sx,
|
|
113
111
|
disableAxisListener: (!showTooltip || slotProps?.tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
114
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
122
|
-
skipAnimation: true,
|
|
123
|
-
slots: slots,
|
|
124
|
-
slotProps: slotProps
|
|
125
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LinePlot, {
|
|
112
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({
|
|
113
|
+
className: className,
|
|
114
|
+
ref: ref,
|
|
115
|
+
sx: sx
|
|
116
|
+
}, other, {
|
|
117
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
118
|
+
clipPath: `url(#${clipPathId})`,
|
|
119
|
+
children: [plotType === 'bar' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, {
|
|
126
120
|
skipAnimation: true,
|
|
127
121
|
slots: slots,
|
|
128
122
|
slotProps: slotProps
|
|
123
|
+
}), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
124
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.AreaPlot, {
|
|
125
|
+
skipAnimation: true,
|
|
126
|
+
slots: slots,
|
|
127
|
+
slotProps: slotProps
|
|
128
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LinePlot, {
|
|
129
|
+
skipAnimation: true,
|
|
130
|
+
slots: slots,
|
|
131
|
+
slotProps: slotProps
|
|
132
|
+
})]
|
|
129
133
|
})]
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
})
|
|
138
|
-
})
|
|
134
|
+
}), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LineHighlightPlot, {
|
|
135
|
+
slots: slots,
|
|
136
|
+
slotProps: slotProps
|
|
137
|
+
}), disableClipping ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
|
|
138
|
+
id: clipPathId,
|
|
139
|
+
offset: clipPathOffset
|
|
140
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), children]
|
|
141
|
+
})), showTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip))]
|
|
142
|
+
});
|
|
139
143
|
});
|
|
144
|
+
if (process.env.NODE_ENV !== "production") SparkLineChart.displayName = "SparkLineChart";
|
|
140
145
|
process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
141
146
|
// ----------------------------- Warning --------------------------------
|
|
142
147
|
// | These PropTypes are generated from the TypeScript type definitions |
|
package/Toolbar/ToolbarButton.js
CHANGED
|
@@ -17,6 +17,7 @@ const ToolbarButton = exports.ToolbarButton = /*#__PURE__*/React.forwardRef(func
|
|
|
17
17
|
ref: ref
|
|
18
18
|
}, props));
|
|
19
19
|
});
|
|
20
|
+
if (process.env.NODE_ENV !== "production") ToolbarButton.displayName = "ToolbarButton";
|
|
20
21
|
process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
|
|
21
22
|
// ----------------------------- Warning --------------------------------
|
|
22
23
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -10,6 +10,4 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
* @ignore - internal component.
|
|
11
11
|
*/
|
|
12
12
|
const ChartContext = exports.ChartContext = /*#__PURE__*/React.createContext(null);
|
|
13
|
-
if (process.env.NODE_ENV !==
|
|
14
|
-
ChartContext.displayName = 'ChartContext';
|
|
15
|
-
}
|
|
13
|
+
if (process.env.NODE_ENV !== "production") ChartContext.displayName = "ChartContext";
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -57,11 +57,12 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(inProps, ref) {
|
|
|
57
57
|
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
58
58
|
children: [/*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
59
59
|
children: [/*#__PURE__*/_jsx(BarPlot, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
60
|
-
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)),
|
|
61
|
-
}))]
|
|
60
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
61
|
+
})), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
|
|
62
62
|
}))
|
|
63
63
|
}));
|
|
64
64
|
});
|
|
65
|
+
if (process.env.NODE_ENV !== "production") BarChart.displayName = "BarChart";
|
|
65
66
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
66
67
|
// ----------------------------- Warning --------------------------------
|
|
67
68
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -45,7 +45,7 @@ const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(pro
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
// @ts-ignore
|
|
48
|
-
|
|
48
|
+
if (process.env.NODE_ENV !== "production") ChartContainer.displayName = "ChartContainer";
|
|
49
49
|
process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
50
50
|
// ----------------------------- Warning --------------------------------
|
|
51
51
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -27,6 +27,11 @@ export interface ChartsAxisClasses {
|
|
|
27
27
|
left: string;
|
|
28
28
|
/** Styles applied to the right axis. */
|
|
29
29
|
right: string;
|
|
30
|
+
/**
|
|
31
|
+
* Styles applied to the root element for the axis with the given ID.
|
|
32
|
+
* Needs to be suffixed with the axis ID: `.${axisClasses.id}-${axisId}`.
|
|
33
|
+
*/
|
|
34
|
+
id: string;
|
|
30
35
|
}
|
|
31
36
|
export type ChartsAxisClassKey = keyof ChartsAxisClasses;
|
|
32
37
|
export declare function getAxisUtilityClass(slot: string): string;
|
|
@@ -3,4 +3,4 @@ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
|
3
3
|
export function getAxisUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiChartsAxis', slot);
|
|
5
5
|
}
|
|
6
|
-
export const axisClasses = generateUtilityClasses('MuiChartsAxis', ['root', 'line', 'tickContainer', 'tick', 'tickLabel', 'label', 'directionX', 'directionY', 'top', 'bottom', 'left', 'right']);
|
|
6
|
+
export const axisClasses = generateUtilityClasses('MuiChartsAxis', ['root', 'line', 'tickContainer', 'tick', 'tickLabel', 'label', 'directionX', 'directionY', 'top', 'bottom', 'left', 'right', 'id']);
|
|
@@ -100,6 +100,7 @@ const ChartsLegend = consumeSlots('MuiChartsLegend', 'legend', {
|
|
|
100
100
|
})
|
|
101
101
|
}));
|
|
102
102
|
}));
|
|
103
|
+
if (process.env.NODE_ENV !== "production") ChartsLegend.displayName = "ChartsLegend";
|
|
103
104
|
process.env.NODE_ENV !== "production" ? ChartsLegend.propTypes = {
|
|
104
105
|
// ----------------------------- Warning --------------------------------
|
|
105
106
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -9,9 +9,7 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
9
9
|
import { DEFAULT_LOCALE } from "../locales/enUS.js";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
export const ChartsLocalizationContext = /*#__PURE__*/React.createContext(null);
|
|
12
|
-
if (process.env.NODE_ENV !==
|
|
13
|
-
ChartsLocalizationContext.displayName = 'ChartsLocalizationContext';
|
|
14
|
-
}
|
|
12
|
+
if (process.env.NODE_ENV !== "production") ChartsLocalizationContext.displayName = "ChartsLocalizationContext";
|
|
15
13
|
/**
|
|
16
14
|
* Demos:
|
|
17
15
|
*
|
|
@@ -86,6 +86,7 @@ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(inPro
|
|
|
86
86
|
}), /*#__PURE__*/_jsx(ChartsAxesGradients, {}), hasIntrinsicSize && children]
|
|
87
87
|
}));
|
|
88
88
|
});
|
|
89
|
+
if (process.env.NODE_ENV !== "production") ChartsSurface.displayName = "ChartsSurface";
|
|
89
90
|
process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
|
|
90
91
|
// ----------------------------- Warning --------------------------------
|
|
91
92
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -31,10 +31,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
31
31
|
const useUtilityClasses = ownerState => {
|
|
32
32
|
const {
|
|
33
33
|
classes,
|
|
34
|
-
position
|
|
34
|
+
position,
|
|
35
|
+
id
|
|
35
36
|
} = ownerState;
|
|
36
37
|
const slots = {
|
|
37
|
-
root: ['root', 'directionX', position],
|
|
38
|
+
root: ['root', 'directionX', position, `id-${id}`],
|
|
38
39
|
line: ['line'],
|
|
39
40
|
tickContainer: ['tickContainer'],
|
|
40
41
|
tick: ['tick'],
|
|
@@ -56,7 +57,7 @@ function getVisibleLabels(xTicks, {
|
|
|
56
57
|
tickLabelMinGap,
|
|
57
58
|
reverse,
|
|
58
59
|
isMounted,
|
|
59
|
-
|
|
60
|
+
isXInside
|
|
60
61
|
}) {
|
|
61
62
|
const getTickLabelSize = tick => {
|
|
62
63
|
if (!isMounted || tick.formattedValue === undefined) {
|
|
@@ -91,7 +92,7 @@ function getVisibleLabels(xTicks, {
|
|
|
91
92
|
if (labelIndex > 0 && direction * textPosition < direction * (previousTextLimit + tickLabelMinGap)) {
|
|
92
93
|
return false;
|
|
93
94
|
}
|
|
94
|
-
if (!
|
|
95
|
+
if (!isXInside(textPosition)) {
|
|
95
96
|
return false;
|
|
96
97
|
}
|
|
97
98
|
|
|
@@ -250,7 +251,8 @@ function ChartsXAxis(inProps) {
|
|
|
250
251
|
valueFormatter,
|
|
251
252
|
tickInterval,
|
|
252
253
|
tickPlacement,
|
|
253
|
-
tickLabelPlacement
|
|
254
|
+
tickLabelPlacement,
|
|
255
|
+
direction: 'x'
|
|
254
256
|
});
|
|
255
257
|
const visibleLabels = getVisibleLabels(xTicks, {
|
|
256
258
|
tickLabelStyle: axisTickLabelProps.style,
|
|
@@ -258,12 +260,7 @@ function ChartsXAxis(inProps) {
|
|
|
258
260
|
tickLabelMinGap,
|
|
259
261
|
reverse,
|
|
260
262
|
isMounted,
|
|
261
|
-
|
|
262
|
-
x,
|
|
263
|
-
y: -1
|
|
264
|
-
}, {
|
|
265
|
-
direction: 'x'
|
|
266
|
-
})
|
|
263
|
+
isXInside: instance.isXInside
|
|
267
264
|
});
|
|
268
265
|
const axisLabelProps = useSlotProps({
|
|
269
266
|
elementType: Label,
|
|
@@ -311,12 +308,7 @@ function ChartsXAxis(inProps) {
|
|
|
311
308
|
} = item;
|
|
312
309
|
const xTickLabel = labelOffset ?? 0;
|
|
313
310
|
const yTickLabel = positionSign * (tickSize + TICK_LABEL_GAP);
|
|
314
|
-
const showTick = instance.
|
|
315
|
-
x: tickOffset,
|
|
316
|
-
y: -1
|
|
317
|
-
}, {
|
|
318
|
-
direction: 'x'
|
|
319
|
-
});
|
|
311
|
+
const showTick = instance.isXInside(tickOffset);
|
|
320
312
|
const tickLabel = tickLabels.get(item);
|
|
321
313
|
const showTickLabel = visibleLabels.has(item);
|
|
322
314
|
return /*#__PURE__*/_jsxs("g", {
|
|
@@ -28,10 +28,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
28
28
|
const useUtilityClasses = ownerState => {
|
|
29
29
|
const {
|
|
30
30
|
classes,
|
|
31
|
-
position
|
|
31
|
+
position,
|
|
32
|
+
id
|
|
32
33
|
} = ownerState;
|
|
33
34
|
const slots = {
|
|
34
|
-
root: ['root', 'directionY', position],
|
|
35
|
+
root: ['root', 'directionY', position, `id-${id}`],
|
|
35
36
|
line: ['line'],
|
|
36
37
|
tickContainer: ['tickContainer'],
|
|
37
38
|
tick: ['tick'],
|
|
@@ -156,7 +157,8 @@ function ChartsYAxis(inProps) {
|
|
|
156
157
|
valueFormatter,
|
|
157
158
|
tickPlacement,
|
|
158
159
|
tickLabelPlacement,
|
|
159
|
-
tickInterval
|
|
160
|
+
tickInterval,
|
|
161
|
+
direction: 'y'
|
|
160
162
|
});
|
|
161
163
|
const positionSign = position === 'right' ? 1 : -1;
|
|
162
164
|
const tickFontSize = typeof tickLabelStyle?.fontSize === 'number' ? tickLabelStyle.fontSize : 12;
|
|
@@ -235,12 +237,7 @@ function ChartsYAxis(inProps) {
|
|
|
235
237
|
const xTickLabel = positionSign * (tickSize + TICK_LABEL_GAP);
|
|
236
238
|
const yTickLabel = labelOffset;
|
|
237
239
|
const skipLabel = typeof tickLabelInterval === 'function' && !tickLabelInterval?.(value, index);
|
|
238
|
-
const showLabel = instance.
|
|
239
|
-
x: -1,
|
|
240
|
-
y: tickOffset
|
|
241
|
-
}, {
|
|
242
|
-
direction: 'y'
|
|
243
|
-
});
|
|
240
|
+
const showLabel = instance.isYInside(tickOffset);
|
|
244
241
|
const tickLabel = tickLabels.get(item);
|
|
245
242
|
if (!showLabel) {
|
|
246
243
|
return null;
|
package/esm/Gauge/Gauge.js
CHANGED
|
@@ -48,6 +48,7 @@ const Gauge = /*#__PURE__*/React.forwardRef(function Gauge(props, ref) {
|
|
|
48
48
|
}), children]
|
|
49
49
|
}));
|
|
50
50
|
});
|
|
51
|
+
if (process.env.NODE_ENV !== "production") Gauge.displayName = "Gauge";
|
|
51
52
|
process.env.NODE_ENV !== "production" ? Gauge.propTypes = {
|
|
52
53
|
// ----------------------------- Warning --------------------------------
|
|
53
54
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -78,6 +78,7 @@ const GaugeContainer = /*#__PURE__*/React.forwardRef(function GaugeContainer(pro
|
|
|
78
78
|
})
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
|
+
if (process.env.NODE_ENV !== "production") GaugeContainer.displayName = "GaugeContainer";
|
|
81
82
|
process.env.NODE_ENV !== "production" ? GaugeContainer.propTypes = {
|
|
82
83
|
// ----------------------------- Warning --------------------------------
|
|
83
84
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -21,9 +21,7 @@ export const GaugeContext = /*#__PURE__*/React.createContext({
|
|
|
21
21
|
maxRadius: 0,
|
|
22
22
|
valueAngle: null
|
|
23
23
|
});
|
|
24
|
-
if (process.env.NODE_ENV !==
|
|
25
|
-
GaugeContext.displayName = 'GaugeContext';
|
|
26
|
-
}
|
|
24
|
+
if (process.env.NODE_ENV !== "production") GaugeContext.displayName = "GaugeContext";
|
|
27
25
|
export function GaugeProvider(props) {
|
|
28
26
|
const {
|
|
29
27
|
value = null,
|
|
@@ -40,6 +40,7 @@ const AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props,
|
|
|
40
40
|
}, other, animateProps))
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
|
+
if (process.env.NODE_ENV !== "production") AnimatedLine.displayName = "AnimatedLine";
|
|
43
44
|
process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
|
|
44
45
|
// ----------------------------- Warning --------------------------------
|
|
45
46
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -65,11 +65,12 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
|
|
|
65
65
|
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
66
66
|
"data-drawing-container": true,
|
|
67
67
|
children: /*#__PURE__*/_jsx(MarkPlot, _extends({}, markPlotProps))
|
|
68
|
-
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)),
|
|
69
|
-
}))]
|
|
68
|
+
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
69
|
+
})), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
|
|
70
70
|
}))
|
|
71
71
|
}));
|
|
72
72
|
});
|
|
73
|
+
if (process.env.NODE_ENV !== "production") LineChart.displayName = "LineChart";
|
|
73
74
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
74
75
|
// ----------------------------- Warning --------------------------------
|
|
75
76
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -84,10 +84,7 @@ function LineHighlightPlot(props) {
|
|
|
84
84
|
const x = xScale(xData[highlightedIndex]);
|
|
85
85
|
const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
|
|
86
86
|
|
|
87
|
-
if (!instance.isPointInside({
|
|
88
|
-
x,
|
|
89
|
-
y
|
|
90
|
-
})) {
|
|
87
|
+
if (!instance.isPointInside(x, y)) {
|
|
91
88
|
return null;
|
|
92
89
|
}
|
|
93
90
|
const colorGetter = getColor(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
package/esm/PieChart/PieArc.js
CHANGED
|
@@ -97,6 +97,7 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
|
|
|
97
97
|
strokeLinejoin: "round"
|
|
98
98
|
}, other, interactionProps, animatedProps));
|
|
99
99
|
});
|
|
100
|
+
if (process.env.NODE_ENV !== "production") PieArc.displayName = "PieArc";
|
|
100
101
|
process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
101
102
|
// ----------------------------- Warning --------------------------------
|
|
102
103
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -92,6 +92,7 @@ const PieArcLabel = /*#__PURE__*/React.forwardRef(function PieArcLabel(props, re
|
|
|
92
92
|
children: formattedArcLabel
|
|
93
93
|
}));
|
|
94
94
|
});
|
|
95
|
+
if (process.env.NODE_ENV !== "production") PieArcLabel.displayName = "PieArcLabel";
|
|
95
96
|
process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
|
|
96
97
|
// ----------------------------- Warning --------------------------------
|
|
97
98
|
// | These PropTypes are generated from the TypeScript type definitions |
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -95,13 +95,14 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
95
95
|
loading: loading,
|
|
96
96
|
slots: slots,
|
|
97
97
|
slotProps: slotProps
|
|
98
|
-
}),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}))]
|
|
98
|
+
}), children]
|
|
99
|
+
})), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({
|
|
100
|
+
trigger: "item"
|
|
101
|
+
}, slotProps?.tooltip))]
|
|
102
102
|
})
|
|
103
103
|
}));
|
|
104
104
|
});
|
|
105
|
+
if (process.env.NODE_ENV !== "production") PieChart.displayName = "PieChart";
|
|
105
106
|
process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
106
107
|
// ----------------------------- Warning --------------------------------
|
|
107
108
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -36,11 +36,12 @@ const RadarChart = /*#__PURE__*/React.forwardRef(function RadarChart(inProps, re
|
|
|
36
36
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
37
37
|
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
38
38
|
ref: ref,
|
|
39
|
-
children: [/*#__PURE__*/_jsx(RadarGrid, _extends({}, radarGrid)), /*#__PURE__*/_jsx(RadarMetricLabels, {}), /*#__PURE__*/_jsx(RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/_jsx(RadarAxisHighlight, {}), /*#__PURE__*/_jsx(RadarSeriesMarks, {}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)),
|
|
40
|
-
}))]
|
|
39
|
+
children: [/*#__PURE__*/_jsx(RadarGrid, _extends({}, radarGrid)), /*#__PURE__*/_jsx(RadarMetricLabels, {}), /*#__PURE__*/_jsx(RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/_jsx(RadarAxisHighlight, {}), /*#__PURE__*/_jsx(RadarSeriesMarks, {}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), children]
|
|
40
|
+
})), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
|
|
41
41
|
}))
|
|
42
42
|
}));
|
|
43
43
|
});
|
|
44
|
+
if (process.env.NODE_ENV !== "production") RadarChart.displayName = "RadarChart";
|
|
44
45
|
process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
45
46
|
// ----------------------------- Warning --------------------------------
|
|
46
47
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -54,19 +54,11 @@ function Scatter(props) {
|
|
|
54
54
|
const scatterPoint = series.data[i];
|
|
55
55
|
const x = getXPosition(scatterPoint.x);
|
|
56
56
|
const y = getYPosition(scatterPoint.y);
|
|
57
|
-
const isInRange = instance.isPointInside(
|
|
58
|
-
x,
|
|
59
|
-
y
|
|
60
|
-
});
|
|
61
|
-
const pointCtx = {
|
|
62
|
-
type: 'scatter',
|
|
63
|
-
seriesId: series.id,
|
|
64
|
-
dataIndex: i
|
|
65
|
-
};
|
|
57
|
+
const isInRange = instance.isPointInside(x, y);
|
|
66
58
|
if (isInRange) {
|
|
67
59
|
const currentItem = {
|
|
68
|
-
seriesId:
|
|
69
|
-
dataIndex:
|
|
60
|
+
seriesId: series.id,
|
|
61
|
+
dataIndex: i
|
|
70
62
|
};
|
|
71
63
|
const isItemHighlighted = isHighlighted(currentItem);
|
|
72
64
|
temp.push({
|
|
@@ -54,13 +54,14 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(inProps
|
|
|
54
54
|
children: [/*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
|
55
55
|
"data-drawing-container": true,
|
|
56
56
|
children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
|
|
57
|
-
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}))]
|
|
57
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), children]
|
|
58
|
+
})), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({
|
|
59
|
+
trigger: "item"
|
|
60
|
+
}, props.slotProps?.tooltip))]
|
|
61
61
|
}))
|
|
62
62
|
}));
|
|
63
63
|
});
|
|
64
|
+
if (process.env.NODE_ENV !== "production") ScatterChart.displayName = "ScatterChart";
|
|
64
65
|
process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
65
66
|
// ----------------------------- Warning --------------------------------
|
|
66
67
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -9,7 +9,8 @@ import useId from '@mui/utils/useId';
|
|
|
9
9
|
import { ChartsClipPath } from "../ChartsClipPath/index.js";
|
|
10
10
|
import { BarPlot } from "../BarChart/index.js";
|
|
11
11
|
import { LinePlot, AreaPlot, LineHighlightPlot } from "../LineChart/index.js";
|
|
12
|
-
import {
|
|
12
|
+
import { ChartDataProvider } from "../ChartDataProvider/index.js";
|
|
13
|
+
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
13
14
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../constants/index.js";
|
|
14
15
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
15
16
|
import { ChartsAxisHighlight } from "../ChartsAxisHighlight/index.js";
|
|
@@ -71,8 +72,7 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
71
72
|
}
|
|
72
73
|
return typeof color === 'function' ? mode => [color(mode)] : [color];
|
|
73
74
|
}, [color]);
|
|
74
|
-
return /*#__PURE__*/_jsxs(
|
|
75
|
-
ref: ref,
|
|
75
|
+
return /*#__PURE__*/_jsxs(ChartDataProvider, {
|
|
76
76
|
series: [_extends({
|
|
77
77
|
type: plotType,
|
|
78
78
|
data,
|
|
@@ -85,7 +85,6 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
85
85
|
width: width,
|
|
86
86
|
height: height,
|
|
87
87
|
margin: margin,
|
|
88
|
-
className: className,
|
|
89
88
|
xAxis: [_extends({
|
|
90
89
|
id: DEFAULT_X_AXIS_KEY,
|
|
91
90
|
scaleType: plotType === 'bar' ? 'band' : 'point',
|
|
@@ -102,34 +101,40 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
102
101
|
position: 'none'
|
|
103
102
|
})],
|
|
104
103
|
colors: colors,
|
|
105
|
-
sx: sx,
|
|
106
104
|
disableAxisListener: (!showTooltip || slotProps?.tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
107
|
-
children: [/*#__PURE__*/_jsxs(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
children: [/*#__PURE__*/_jsx(
|
|
115
|
-
skipAnimation: true,
|
|
116
|
-
slots: slots,
|
|
117
|
-
slotProps: slotProps
|
|
118
|
-
}), /*#__PURE__*/_jsx(LinePlot, {
|
|
105
|
+
children: [/*#__PURE__*/_jsxs(ChartsSurface, _extends({
|
|
106
|
+
className: className,
|
|
107
|
+
ref: ref,
|
|
108
|
+
sx: sx
|
|
109
|
+
}, other, {
|
|
110
|
+
children: [/*#__PURE__*/_jsxs("g", {
|
|
111
|
+
clipPath: `url(#${clipPathId})`,
|
|
112
|
+
children: [plotType === 'bar' && /*#__PURE__*/_jsx(BarPlot, {
|
|
119
113
|
skipAnimation: true,
|
|
120
114
|
slots: slots,
|
|
121
115
|
slotProps: slotProps
|
|
116
|
+
}), plotType === 'line' && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
117
|
+
children: [/*#__PURE__*/_jsx(AreaPlot, {
|
|
118
|
+
skipAnimation: true,
|
|
119
|
+
slots: slots,
|
|
120
|
+
slotProps: slotProps
|
|
121
|
+
}), /*#__PURE__*/_jsx(LinePlot, {
|
|
122
|
+
skipAnimation: true,
|
|
123
|
+
slots: slots,
|
|
124
|
+
slotProps: slotProps
|
|
125
|
+
})]
|
|
122
126
|
})]
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
})
|
|
131
|
-
})
|
|
127
|
+
}), plotType === 'line' && /*#__PURE__*/_jsx(LineHighlightPlot, {
|
|
128
|
+
slots: slots,
|
|
129
|
+
slotProps: slotProps
|
|
130
|
+
}), disableClipping ? null : /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
131
|
+
id: clipPathId,
|
|
132
|
+
offset: clipPathOffset
|
|
133
|
+
}), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), children]
|
|
134
|
+
})), showTooltip && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
|
|
135
|
+
});
|
|
132
136
|
});
|
|
137
|
+
if (process.env.NODE_ENV !== "production") SparkLineChart.displayName = "SparkLineChart";
|
|
133
138
|
process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
134
139
|
// ----------------------------- Warning --------------------------------
|
|
135
140
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -9,6 +9,7 @@ const ToolbarButton = /*#__PURE__*/React.forwardRef(function ToolbarButton(props
|
|
|
9
9
|
ref: ref
|
|
10
10
|
}, props));
|
|
11
11
|
});
|
|
12
|
+
if (process.env.NODE_ENV !== "production") ToolbarButton.displayName = "ToolbarButton";
|
|
12
13
|
process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
|
|
13
14
|
// ----------------------------- Warning --------------------------------
|
|
14
15
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -3,6 +3,4 @@ import * as React from 'react';
|
|
|
3
3
|
* @ignore - internal component.
|
|
4
4
|
*/
|
|
5
5
|
export const ChartContext = /*#__PURE__*/React.createContext(null);
|
|
6
|
-
if (process.env.NODE_ENV !==
|
|
7
|
-
ChartContext.displayName = 'ChartContext';
|
|
8
|
-
}
|
|
6
|
+
if (process.env.NODE_ENV !== "production") ChartContext.displayName = "ChartContext";
|