@mui/x-charts 7.22.1 → 8.0.0-alpha.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.d.ts +7 -7
- package/BarChart/BarChart.js +9 -29
- package/BarChart/BarElement.d.ts +1 -1
- package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
- package/BarChart/BarPlot.js +12 -4
- package/BarChart/extremums.js +3 -3
- package/BarChart/useBarChartProps.d.ts +2 -2
- package/BarChart/useBarChartProps.js +3 -4
- package/CHANGELOG.md +143 -92
- package/ChartContainer/ChartContainer.d.ts +16 -33
- package/ChartContainer/ChartContainer.js +24 -41
- package/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.d.ts +2 -2
- package/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.d.ts +1 -1
- package/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/ChartContainer/useChartContainerProps.d.ts +11 -86
- package/ChartContainer/useChartContainerProps.js +42 -58
- package/ChartsLegend/ChartsLegend.js +0 -3
- package/ChartsLegend/DefaultChartsLegend.d.ts +0 -5
- package/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/ChartsLegend/LegendPerItem.d.ts +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/ChartsOverlay/ChartsOverlay.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/ChartsTooltip/ChartsTooltip.js +45 -6
- package/ChartsTooltip/useAxisTooltip.js +3 -3
- package/ChartsTooltip/useItemTooltip.js +3 -3
- package/ChartsTooltip/utils.d.ts +5 -13
- package/ChartsTooltip/utils.js +45 -42
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/Gauge/GaugeContainer.js +1 -1
- package/LineChart/AreaElement.d.ts +1 -1
- package/LineChart/AreaPlot.js +2 -6
- package/LineChart/LineChart.d.ts +7 -7
- package/LineChart/LineChart.js +9 -29
- package/LineChart/LineElement.d.ts +1 -1
- package/LineChart/LineHighlightPlot.d.ts +1 -1
- package/LineChart/LineHighlightPlot.js +2 -6
- package/LineChart/LinePlot.js +2 -6
- package/LineChart/MarkPlot.js +2 -6
- package/LineChart/extremums.js +10 -6
- package/LineChart/useLineChartProps.d.ts +2 -2
- package/LineChart/useLineChartProps.js +3 -4
- package/PieChart/PieArc.d.ts +0 -5
- package/PieChart/PieArc.js +1 -10
- package/PieChart/PieArcPlot.js +0 -5
- package/PieChart/PieChart.d.ts +9 -32
- package/PieChart/PieChart.js +19 -102
- package/README.md +2 -2
- package/ScatterChart/ScatterChart.d.ts +7 -7
- package/ScatterChart/ScatterChart.js +9 -29
- package/ScatterChart/ScatterPlot.js +3 -6
- package/ScatterChart/extremums.js +6 -6
- package/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/ScatterChart/useScatterChartProps.js +3 -4
- package/SparkLineChart/SparkLineChart.d.ts +4 -4
- package/SparkLineChart/SparkLineChart.js +4 -2
- package/context/CartesianProvider/defaultizeAxis.d.ts +5 -1
- package/context/ChartDataProvider/ChartDataProvider.d.ts +41 -0
- package/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +48 -27
- package/context/ChartDataProvider/index.d.ts +1 -0
- package/context/ChartDataProvider/index.js +1 -0
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +97 -0
- package/context/ChartDataProvider/useChartDataProviderProps.js +86 -0
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.d.ts +16 -12
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/context/HighlightedProvider/HighlightedContext.d.ts +0 -8
- package/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/context/PluginProvider/ExtremumGetter.types.d.ts +2 -2
- package/context/ZAxisContextProvider.d.ts +1 -1
- package/index.d.ts +1 -2
- package/index.js +2 -3
- package/internals/computeAxisValue.js +13 -5
- package/internals/defaultizeColor.d.ts +1 -8
- package/internals/getSymbol.js +19 -3
- package/internals/index.d.ts +5 -5
- package/internals/index.js +5 -5
- package/internals/useStringInterpolator.js +1 -0
- package/models/axis.d.ts +10 -0
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/common.d.ts +2 -12
- package/models/seriesType/config.d.ts +1 -1
- package/models/seriesType/line.d.ts +1 -1
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +1 -6
- package/modern/BarChart/BarChart.js +9 -29
- package/modern/BarChart/BarPlot.js +12 -4
- package/modern/BarChart/extremums.js +3 -3
- package/modern/BarChart/useBarChartProps.js +3 -4
- package/modern/ChartContainer/ChartContainer.js +24 -41
- package/modern/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/modern/ChartContainer/useChartContainerProps.js +42 -58
- package/modern/ChartsLegend/ChartsLegend.js +0 -3
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/modern/ChartsTooltip/ChartsTooltip.js +45 -6
- package/modern/ChartsTooltip/useAxisTooltip.js +3 -3
- package/modern/ChartsTooltip/useItemTooltip.js +3 -3
- package/modern/ChartsTooltip/utils.js +45 -42
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/modern/Gauge/GaugeContainer.js +1 -1
- package/modern/LineChart/AreaPlot.js +2 -6
- package/modern/LineChart/LineChart.js +9 -29
- package/modern/LineChart/LineHighlightPlot.js +2 -6
- package/modern/LineChart/LinePlot.js +2 -6
- package/modern/LineChart/MarkPlot.js +2 -6
- package/modern/LineChart/extremums.js +10 -6
- package/modern/LineChart/useLineChartProps.js +3 -4
- package/modern/PieChart/PieArc.js +1 -10
- package/modern/PieChart/PieArcPlot.js +0 -5
- package/modern/PieChart/PieChart.js +19 -102
- package/modern/ScatterChart/ScatterChart.js +9 -29
- package/modern/ScatterChart/ScatterPlot.js +3 -6
- package/modern/ScatterChart/extremums.js +6 -6
- package/modern/ScatterChart/useScatterChartProps.js +3 -4
- package/modern/SparkLineChart/SparkLineChart.js +4 -2
- package/modern/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +48 -27
- package/modern/context/ChartDataProvider/index.js +1 -0
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +86 -0
- package/modern/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/modern/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/modern/index.js +2 -3
- package/modern/internals/computeAxisValue.js +13 -5
- package/modern/internals/getSymbol.js +19 -3
- package/modern/internals/index.js +5 -5
- package/modern/internals/useStringInterpolator.js +1 -0
- package/node/BarChart/BarChart.js +9 -29
- package/node/BarChart/BarPlot.js +11 -3
- package/node/BarChart/extremums.js +3 -3
- package/node/BarChart/useBarChartProps.js +3 -4
- package/node/ChartContainer/ChartContainer.js +23 -40
- package/node/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/node/ChartContainer/useChartContainerProps.js +42 -59
- package/node/ChartsLegend/ChartsLegend.js +0 -3
- package/node/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/node/ChartsTooltip/ChartsTooltip.js +44 -5
- package/node/ChartsTooltip/useAxisTooltip.js +3 -3
- package/node/ChartsTooltip/useItemTooltip.js +3 -3
- package/node/ChartsTooltip/utils.js +46 -44
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/node/Gauge/GaugeContainer.js +1 -1
- package/node/LineChart/AreaPlot.js +2 -6
- package/node/LineChart/LineChart.js +9 -29
- package/node/LineChart/LineHighlightPlot.js +2 -6
- package/node/LineChart/LinePlot.js +2 -6
- package/node/LineChart/MarkPlot.js +2 -6
- package/node/LineChart/extremums.js +10 -6
- package/node/LineChart/useLineChartProps.js +3 -4
- package/node/PieChart/PieArc.js +1 -10
- package/node/PieChart/PieArcPlot.js +0 -5
- package/node/PieChart/PieChart.js +19 -102
- package/node/ScatterChart/ScatterChart.js +9 -29
- package/node/ScatterChart/ScatterPlot.js +3 -6
- package/node/ScatterChart/extremums.js +6 -6
- package/node/ScatterChart/useScatterChartProps.js +3 -4
- package/node/SparkLineChart/SparkLineChart.js +4 -2
- package/node/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +47 -26
- package/node/context/ChartDataProvider/index.js +16 -0
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +94 -0
- package/node/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/node/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/node/index.js +5 -16
- package/node/internals/computeAxisValue.js +13 -5
- package/node/internals/getSymbol.js +19 -3
- package/node/internals/index.js +37 -29
- package/node/internals/useStringInterpolator.js +2 -0
- package/package.json +4 -4
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -24
- package/ResponsiveChartContainer/index.d.ts +0 -1
- package/ResponsiveChartContainer/index.js +0 -1
- package/ResponsiveChartContainer/package.json +0 -6
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +0 -19
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/internals/SlotComponentPropsFromProps.d.ts +0 -1
- package/internals/SlotComponentPropsFromProps.js +0 -1
- package/models/helpers.d.ts +0 -3
- package/models/helpers.js +0 -1
- package/modern/ResponsiveChartContainer/index.js +0 -1
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/modern/internals/SlotComponentPropsFromProps.js +0 -1
- package/modern/models/helpers.js +0 -1
- package/node/ResponsiveChartContainer/index.js +0 -16
- package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -77
- package/node/internals/SlotComponentPropsFromProps.js +0 -5
- package/node/models/helpers.js +0 -5
- /package/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
- /package/modern/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
- /package/node/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["highlighted", "faded"];
|
|
6
3
|
import * as React from 'react';
|
|
7
4
|
import PropTypes from 'prop-types';
|
|
8
5
|
import useControlled from '@mui/utils/useControlled';
|
|
@@ -11,18 +8,6 @@ import { createIsFaded } from "./createIsFaded.js";
|
|
|
11
8
|
import { createIsHighlighted } from "./createIsHighlighted.js";
|
|
12
9
|
import { useSeries } from "../../hooks/useSeries.js";
|
|
13
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const mergeDeprecatedOptions = options => {
|
|
15
|
-
const _ref = options ?? {},
|
|
16
|
-
{
|
|
17
|
-
highlighted,
|
|
18
|
-
faded
|
|
19
|
-
} = _ref,
|
|
20
|
-
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21
|
-
return _extends({
|
|
22
|
-
highlight: highlighted,
|
|
23
|
-
fade: faded
|
|
24
|
-
}, other);
|
|
25
|
-
};
|
|
26
11
|
function HighlightedProvider({
|
|
27
12
|
children,
|
|
28
13
|
highlightedItem: highlightedItemProps,
|
|
@@ -41,7 +26,7 @@ function HighlightedProvider({
|
|
|
41
26
|
const seriesData = series[seriesType];
|
|
42
27
|
Object.keys(seriesData?.series ?? {}).forEach(seriesId => {
|
|
43
28
|
const seriesItem = seriesData?.series[seriesId];
|
|
44
|
-
map.set(seriesId,
|
|
29
|
+
map.set(seriesId, seriesItem?.highlightScope);
|
|
45
30
|
});
|
|
46
31
|
});
|
|
47
32
|
return map;
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts
|
|
2
|
+
* @mui/x-charts v8.0.0-alpha.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -28,6 +28,5 @@ export * from "./PieChart/index.js";
|
|
|
28
28
|
export * from "./ScatterChart/index.js";
|
|
29
29
|
export * from "./SparkLineChart/index.js";
|
|
30
30
|
export * from "./Gauge/index.js";
|
|
31
|
-
export * from "./ChartContainer/index.js";
|
|
32
31
|
export * from "./ChartsSurface/index.js";
|
|
33
|
-
export * from "./
|
|
32
|
+
export * from "./ChartContainer/index.js";
|
|
@@ -98,22 +98,30 @@ export function computeAxisValue({
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
const scaleType = axis.scaleType ?? 'linear';
|
|
101
|
+
const domainLimit = axis.domainLimit ?? 'nice';
|
|
101
102
|
const axisExtremums = [axis.min ?? minData, axis.max ?? maxData];
|
|
103
|
+
if (typeof domainLimit === 'function') {
|
|
104
|
+
const {
|
|
105
|
+
min,
|
|
106
|
+
max
|
|
107
|
+
} = domainLimit(minData, maxData);
|
|
108
|
+
axisExtremums[0] = min;
|
|
109
|
+
axisExtremums[1] = max;
|
|
110
|
+
}
|
|
102
111
|
const rawTickNumber = getTickNumber(_extends({}, axis, {
|
|
103
112
|
range,
|
|
104
113
|
domain: axisExtremums
|
|
105
114
|
}));
|
|
106
115
|
const tickNumber = rawTickNumber / ((zoomRange[1] - zoomRange[0]) / 100);
|
|
107
116
|
const zoomedRange = zoomScaleRange(range, zoomRange);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
const [minDomain, maxDomain] = scale.domain();
|
|
117
|
+
const scale = getScale(scaleType, axisExtremums, zoomedRange);
|
|
118
|
+
const finalScale = domainLimit === 'nice' ? scale.nice(rawTickNumber) : scale;
|
|
119
|
+
const [minDomain, maxDomain] = finalScale.domain();
|
|
112
120
|
const domain = [axis.min ?? minDomain, axis.max ?? maxDomain];
|
|
113
121
|
completeAxis[axis.id] = _extends({}, axis, {
|
|
114
122
|
data,
|
|
115
123
|
scaleType: scaleType,
|
|
116
|
-
scale:
|
|
124
|
+
scale: finalScale.domain(domain),
|
|
117
125
|
tickNumber,
|
|
118
126
|
colorScale: axis.colorMap && getColorScale(axis.colorMap)
|
|
119
127
|
});
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
// Returns the index of a defined shape
|
|
2
1
|
export function getSymbol(shape) {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
// prettier-ignore
|
|
3
|
+
switch (shape) {
|
|
4
|
+
case 'circle':
|
|
5
|
+
return 0;
|
|
6
|
+
case 'cross':
|
|
7
|
+
return 1;
|
|
8
|
+
case 'diamond':
|
|
9
|
+
return 2;
|
|
10
|
+
case 'square':
|
|
11
|
+
return 3;
|
|
12
|
+
case 'star':
|
|
13
|
+
return 4;
|
|
14
|
+
case 'triangle':
|
|
15
|
+
return 5;
|
|
16
|
+
case 'wye':
|
|
17
|
+
return 6;
|
|
18
|
+
default:
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
5
21
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Components
|
|
2
2
|
export * from "./components/ChartsAxesGradients/index.js";
|
|
3
|
-
export * from "../
|
|
4
|
-
export * from "../
|
|
3
|
+
export * from "../ChartContainer/useChartContainerDimensions.js";
|
|
4
|
+
export * from "../ChartContainer/ResizableContainer.js";
|
|
5
5
|
|
|
6
6
|
// hooks
|
|
7
7
|
export { useSeries } from "../hooks/useSeries.js";
|
|
@@ -10,8 +10,8 @@ export { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
|
10
10
|
export { useScatterChartProps } from "../ScatterChart/useScatterChartProps.js";
|
|
11
11
|
export { useLineChartProps } from "../LineChart/useLineChartProps.js";
|
|
12
12
|
export { useBarChartProps } from "../BarChart/useBarChartProps.js";
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export * from "../ChartContainer/useChartContainerProps.js";
|
|
14
|
+
export * from "../context/ChartDataProvider/useChartDataProviderProps.js";
|
|
15
15
|
|
|
16
16
|
// utils
|
|
17
17
|
export * from "./defaultizeValueFormatter.js";
|
|
@@ -33,10 +33,10 @@ export * from "../context/ZAxisContextProvider.js";
|
|
|
33
33
|
export * from "../context/PluginProvider/index.js";
|
|
34
34
|
export * from "../context/AnimationProvider/index.js";
|
|
35
35
|
export { getAxisExtremum } from "../context/CartesianProvider/getAxisExtremum.js";
|
|
36
|
+
export * from "../context/ChartDataProvider/index.js";
|
|
36
37
|
|
|
37
38
|
// series configuration
|
|
38
39
|
export * from "../models/seriesType/config.js";
|
|
39
40
|
export * from "../models/seriesType/common.js";
|
|
40
|
-
export * from "../models/helpers.js";
|
|
41
41
|
export * from "../models/z-axis.js";
|
|
42
42
|
export * from "../models/axis.js";
|
|
@@ -12,7 +12,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _BarPlot = require("./BarPlot");
|
|
15
|
-
var
|
|
15
|
+
var _ChartContainer = require("../ChartContainer");
|
|
16
16
|
var _ChartsAxis = require("../ChartsAxis");
|
|
17
17
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
18
18
|
var _ChartsLegend = require("../ChartsLegend");
|
|
@@ -53,12 +53,12 @@ const BarChart = exports.BarChart = /*#__PURE__*/React.forwardRef(function BarCh
|
|
|
53
53
|
tooltipProps,
|
|
54
54
|
children
|
|
55
55
|
} = (0, _useBarChartProps.useBarChartProps)(props);
|
|
56
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartContainer.ChartContainer, (0, _extends2.default)({
|
|
57
57
|
ref: ref
|
|
58
58
|
}, chartContainerProps, {
|
|
59
59
|
children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), /*#__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)(_BarPlot.BarPlot, (0, _extends2.default)({}, barPlotProps)), /*#__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)(_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]
|
|
61
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), !props.hideLegend && /*#__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
62
|
}));
|
|
63
63
|
});
|
|
64
64
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
@@ -123,6 +123,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
123
123
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
124
124
|
*/
|
|
125
125
|
height: _propTypes.default.number,
|
|
126
|
+
/**
|
|
127
|
+
* If `true`, the legend is not rendered.
|
|
128
|
+
*/
|
|
129
|
+
hideLegend: _propTypes.default.bool,
|
|
126
130
|
/**
|
|
127
131
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
128
132
|
*/
|
|
@@ -141,32 +145,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
141
145
|
* @default yAxisIds[0] The id of the first provided axis
|
|
142
146
|
*/
|
|
143
147
|
leftAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
144
|
-
/**
|
|
145
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
146
|
-
*/
|
|
147
|
-
legend: _propTypes.default.shape({
|
|
148
|
-
classes: _propTypes.default.object,
|
|
149
|
-
direction: _propTypes.default.oneOf(['column', 'row']),
|
|
150
|
-
hidden: _propTypes.default.bool,
|
|
151
|
-
itemGap: _propTypes.default.number,
|
|
152
|
-
itemMarkHeight: _propTypes.default.number,
|
|
153
|
-
itemMarkWidth: _propTypes.default.number,
|
|
154
|
-
labelStyle: _propTypes.default.object,
|
|
155
|
-
markGap: _propTypes.default.number,
|
|
156
|
-
onItemClick: _propTypes.default.func,
|
|
157
|
-
padding: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
158
|
-
bottom: _propTypes.default.number,
|
|
159
|
-
left: _propTypes.default.number,
|
|
160
|
-
right: _propTypes.default.number,
|
|
161
|
-
top: _propTypes.default.number
|
|
162
|
-
})]),
|
|
163
|
-
position: _propTypes.default.shape({
|
|
164
|
-
horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
|
|
165
|
-
vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
166
|
-
}),
|
|
167
|
-
slotProps: _propTypes.default.object,
|
|
168
|
-
slots: _propTypes.default.object
|
|
169
|
-
}),
|
|
170
148
|
/**
|
|
171
149
|
* If `true`, a loading overlay is displayed.
|
|
172
150
|
* @default false
|
|
@@ -295,6 +273,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
295
273
|
dataKey: _propTypes.default.string,
|
|
296
274
|
disableLine: _propTypes.default.bool,
|
|
297
275
|
disableTicks: _propTypes.default.bool,
|
|
276
|
+
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
298
277
|
fill: _propTypes.default.string,
|
|
299
278
|
hideTooltip: _propTypes.default.bool,
|
|
300
279
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -348,6 +327,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
348
327
|
dataKey: _propTypes.default.string,
|
|
349
328
|
disableLine: _propTypes.default.bool,
|
|
350
329
|
disableTicks: _propTypes.default.bool,
|
|
330
|
+
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
351
331
|
fill: _propTypes.default.string,
|
|
352
332
|
hideTooltip: _propTypes.default.bool,
|
|
353
333
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
package/node/BarChart/BarPlot.js
CHANGED
|
@@ -57,6 +57,7 @@ const useAggregatedData = () => {
|
|
|
57
57
|
seriesOrder: []
|
|
58
58
|
};
|
|
59
59
|
const axisData = (0, _CartesianProvider.useCartesianContext)();
|
|
60
|
+
const drawingArea = (0, _hooks.useDrawingArea)();
|
|
60
61
|
const chartId = (0, _hooks.useChartId)();
|
|
61
62
|
const {
|
|
62
63
|
series,
|
|
@@ -74,9 +75,13 @@ const useAggregatedData = () => {
|
|
|
74
75
|
const data = stackingGroups.flatMap(({
|
|
75
76
|
ids: groupIds
|
|
76
77
|
}, groupIndex) => {
|
|
78
|
+
const xMin = drawingArea.left;
|
|
79
|
+
const xMax = drawingArea.left + drawingArea.width;
|
|
80
|
+
const yMin = drawingArea.top;
|
|
81
|
+
const yMax = drawingArea.top + drawingArea.height;
|
|
77
82
|
return groupIds.flatMap(seriesId => {
|
|
78
|
-
const xAxisId = series[seriesId].xAxisId ??
|
|
79
|
-
const yAxisId = series[seriesId].yAxisId ??
|
|
83
|
+
const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
|
|
84
|
+
const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
|
|
80
85
|
const xAxisConfig = xAxis[xAxisId];
|
|
81
86
|
const yAxisConfig = yAxis[yAxisId];
|
|
82
87
|
const verticalLayout = series[seriesId].layout === 'vertical';
|
|
@@ -117,6 +122,9 @@ const useAggregatedData = () => {
|
|
|
117
122
|
value: series[seriesId].data[dataIndex],
|
|
118
123
|
maskId: `${chartId}_${stackId || seriesId}_${groupIndex}_${dataIndex}`
|
|
119
124
|
};
|
|
125
|
+
if (result.x > xMax || result.x + result.width < xMin || result.y > yMax || result.y + result.height < yMin) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
120
128
|
if (!masks[result.maskId]) {
|
|
121
129
|
masks[result.maskId] = {
|
|
122
130
|
id: result.maskId,
|
|
@@ -139,7 +147,7 @@ const useAggregatedData = () => {
|
|
|
139
147
|
mask.hasNegative = mask.hasNegative || (result.value ?? 0) < 0;
|
|
140
148
|
mask.hasPositive = mask.hasPositive || (result.value ?? 0) > 0;
|
|
141
149
|
return result;
|
|
142
|
-
});
|
|
150
|
+
}).filter(rectangle => rectangle !== null);
|
|
143
151
|
});
|
|
144
152
|
});
|
|
145
153
|
return {
|
|
@@ -42,7 +42,7 @@ const getValueExtremum = direction => params => {
|
|
|
42
42
|
isDefaultAxis
|
|
43
43
|
} = params;
|
|
44
44
|
return Object.keys(series).filter(seriesId => {
|
|
45
|
-
const yAxisId = series[seriesId].yAxisId
|
|
45
|
+
const yAxisId = series[seriesId].yAxisId;
|
|
46
46
|
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
47
47
|
}).reduce((acc, seriesId) => {
|
|
48
48
|
const {
|
|
@@ -51,8 +51,8 @@ const getValueExtremum = direction => params => {
|
|
|
51
51
|
const filter = getFilters?.({
|
|
52
52
|
currentAxisId: axis.id,
|
|
53
53
|
isDefaultAxis,
|
|
54
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
55
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
54
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
55
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
56
56
|
});
|
|
57
57
|
const [seriesMin, seriesMax] = stackedData?.reduce((seriesAcc, values, index) => {
|
|
58
58
|
if (filter && (!filter(createResult(values[0], direction), index) || !filter(createResult(values[1], direction), index))) {
|
|
@@ -10,7 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
12
12
|
var _constants = require("../constants");
|
|
13
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "tooltip", "onAxisClick", "axisHighlight", "
|
|
13
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "tooltip", "onAxisClick", "axisHighlight", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend"];
|
|
14
14
|
/**
|
|
15
15
|
* A helper function that extracts BarChartProps from the input props
|
|
16
16
|
* and returns an object with props for the children components of BarChart.
|
|
@@ -32,7 +32,6 @@ const useBarChartProps = props => {
|
|
|
32
32
|
tooltip,
|
|
33
33
|
onAxisClick,
|
|
34
34
|
axisHighlight,
|
|
35
|
-
legend,
|
|
36
35
|
grid,
|
|
37
36
|
topAxis,
|
|
38
37
|
leftAxis,
|
|
@@ -123,10 +122,10 @@ const useBarChartProps = props => {
|
|
|
123
122
|
} : {
|
|
124
123
|
x: 'band'
|
|
125
124
|
}, axisHighlight);
|
|
126
|
-
const legendProps =
|
|
125
|
+
const legendProps = {
|
|
127
126
|
slots,
|
|
128
127
|
slotProps
|
|
129
|
-
}
|
|
128
|
+
};
|
|
130
129
|
const tooltipProps = (0, _extends2.default)({}, tooltip, {
|
|
131
130
|
slots,
|
|
132
131
|
slotProps
|
|
@@ -10,47 +10,18 @@ exports.ChartContainer = void 0;
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _InteractionProvider = require("../context/InteractionProvider");
|
|
16
|
-
var _ChartsSurface = require("../ChartsSurface");
|
|
17
|
-
var _CartesianProvider = require("../context/CartesianProvider");
|
|
18
|
-
var _ChartsAxesGradients = require("../internals/components/ChartsAxesGradients");
|
|
19
|
-
var _context = require("../context");
|
|
20
|
-
var _PluginProvider = require("../context/PluginProvider");
|
|
13
|
+
var _ChartDataProvider = require("../context/ChartDataProvider");
|
|
14
|
+
var _ResizableContainer = require("./ResizableContainer");
|
|
21
15
|
var _useChartContainerProps = require("./useChartContainerProps");
|
|
22
|
-
var _AnimationProvider = require("../context/AnimationProvider");
|
|
23
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
17
|
const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
|
|
25
18
|
const {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
cartesianProviderProps,
|
|
30
|
-
zAxisContextProps,
|
|
31
|
-
highlightedProviderProps,
|
|
32
|
-
chartsSurfaceProps,
|
|
33
|
-
pluginProviderProps,
|
|
34
|
-
animationProviderProps
|
|
19
|
+
hasIntrinsicSize,
|
|
20
|
+
chartDataProviderProps,
|
|
21
|
+
resizableChartContainerProps
|
|
35
22
|
} = (0, _useChartContainerProps.useChartContainerProps)(props, ref);
|
|
36
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
37
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
38
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SeriesProvider.SeriesProvider, (0, _extends2.default)({}, seriesProviderProps, {
|
|
39
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartesianProvider.CartesianProvider, (0, _extends2.default)({}, cartesianProviderProps, {
|
|
40
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ZAxisContextProvider, (0, _extends2.default)({}, zAxisContextProps, {
|
|
41
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InteractionProvider.InteractionProvider, {
|
|
42
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.HighlightedProvider, (0, _extends2.default)({}, highlightedProviderProps, {
|
|
43
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
44
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxesGradients.ChartsAxesGradients, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AnimationProvider.AnimationProvider, (0, _extends2.default)({}, animationProviderProps, {
|
|
45
|
-
children: children
|
|
46
|
-
}))]
|
|
47
|
-
}))
|
|
48
|
-
}))
|
|
49
|
-
})
|
|
50
|
-
}))
|
|
51
|
-
}))
|
|
52
|
-
}))
|
|
53
|
-
}))
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResizableContainer.ResizableContainer, (0, _extends2.default)({}, resizableChartContainerProps, {
|
|
24
|
+
children: hasIntrinsicSize ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps)) : null
|
|
54
25
|
}));
|
|
55
26
|
});
|
|
56
27
|
process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
@@ -77,9 +48,9 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
77
48
|
*/
|
|
78
49
|
disableAxisListener: _propTypes.default.bool,
|
|
79
50
|
/**
|
|
80
|
-
* The height of the chart in px.
|
|
51
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
81
52
|
*/
|
|
82
|
-
height: _propTypes.default.number
|
|
53
|
+
height: _propTypes.default.number,
|
|
83
54
|
/**
|
|
84
55
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
85
56
|
*/
|
|
@@ -110,6 +81,16 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
110
81
|
* If not provided, the container supports line, bar, scatter and pie charts.
|
|
111
82
|
*/
|
|
112
83
|
plugins: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
84
|
+
/**
|
|
85
|
+
* The chart will try to wait for the parent container to resolve its size
|
|
86
|
+
* before it renders for the first time.
|
|
87
|
+
*
|
|
88
|
+
* This can be useful in some scenarios where the chart appear to grow after
|
|
89
|
+
* the first render, like when used inside a grid.
|
|
90
|
+
*
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
resolveSizeBeforeRender: _propTypes.default.bool,
|
|
113
94
|
/**
|
|
114
95
|
* The array of series to display.
|
|
115
96
|
* Each type of series has its own specificity.
|
|
@@ -130,9 +111,9 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
130
111
|
y: _propTypes.default.number
|
|
131
112
|
}),
|
|
132
113
|
/**
|
|
133
|
-
* The width of the chart in px.
|
|
114
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
134
115
|
*/
|
|
135
|
-
width: _propTypes.default.number
|
|
116
|
+
width: _propTypes.default.number,
|
|
136
117
|
/**
|
|
137
118
|
* The configuration of the x-axes.
|
|
138
119
|
* If not provided, a default axis config is used.
|
|
@@ -159,6 +140,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
159
140
|
dataKey: _propTypes.default.string,
|
|
160
141
|
disableLine: _propTypes.default.bool,
|
|
161
142
|
disableTicks: _propTypes.default.bool,
|
|
143
|
+
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
162
144
|
fill: _propTypes.default.string,
|
|
163
145
|
hideTooltip: _propTypes.default.bool,
|
|
164
146
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -212,6 +194,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
212
194
|
dataKey: _propTypes.default.string,
|
|
213
195
|
disableLine: _propTypes.default.bool,
|
|
214
196
|
disableTicks: _propTypes.default.bool,
|
|
197
|
+
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
215
198
|
fill: _propTypes.default.string,
|
|
216
199
|
hideTooltip: _propTypes.default.bool,
|
|
217
200
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
+
/* eslint-disable react-compiler/react-compiler */
|
|
4
5
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
6
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
7
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -11,6 +12,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
12
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
12
13
|
var _ownerWindow = _interopRequireDefault(require("@mui/utils/ownerWindow"));
|
|
13
14
|
const useChartContainerDimensions = (inWidth, inHeight, resolveSizeBeforeRender) => {
|
|
15
|
+
const hasInSize = inWidth !== undefined && inHeight !== undefined;
|
|
14
16
|
const stateRef = React.useRef({
|
|
15
17
|
displayError: false,
|
|
16
18
|
initialCompute: true,
|
|
@@ -47,7 +49,7 @@ const useChartContainerDimensions = (inWidth, inHeight, resolveSizeBeforeRender)
|
|
|
47
49
|
// https://github.com/mui/mui-x/issues/13477#issuecomment-2336634785
|
|
48
50
|
(0, _useEnhancedEffect.default)(() => {
|
|
49
51
|
// computeRun is used to avoid infinite loops.
|
|
50
|
-
if (!resolveSizeBeforeRender || !stateRef.current.initialCompute || stateRef.current.computeRun > 20) {
|
|
52
|
+
if (hasInSize || !resolveSizeBeforeRender || !stateRef.current.initialCompute || stateRef.current.computeRun > 20) {
|
|
51
53
|
return;
|
|
52
54
|
}
|
|
53
55
|
const computedSize = computeSize();
|
|
@@ -56,9 +58,9 @@ const useChartContainerDimensions = (inWidth, inHeight, resolveSizeBeforeRender)
|
|
|
56
58
|
} else if (stateRef.current.initialCompute) {
|
|
57
59
|
stateRef.current.initialCompute = false;
|
|
58
60
|
}
|
|
59
|
-
}, [width, height, computeSize, resolveSizeBeforeRender]);
|
|
61
|
+
}, [width, height, computeSize, resolveSizeBeforeRender, hasInSize]);
|
|
60
62
|
(0, _useEnhancedEffect.default)(() => {
|
|
61
|
-
if (
|
|
63
|
+
if (hasInSize) {
|
|
62
64
|
return () => {};
|
|
63
65
|
}
|
|
64
66
|
computeSize();
|
|
@@ -84,7 +86,7 @@ const useChartContainerDimensions = (inWidth, inHeight, resolveSizeBeforeRender)
|
|
|
84
86
|
observer.unobserve(elementToObserve);
|
|
85
87
|
}
|
|
86
88
|
};
|
|
87
|
-
}, [computeSize,
|
|
89
|
+
}, [computeSize, hasInSize]);
|
|
88
90
|
if (process.env.NODE_ENV !== 'production') {
|
|
89
91
|
if (stateRef.current.displayError && inWidth === undefined && width === 0) {
|
|
90
92
|
console.error(`MUI X: ChartContainer does not have \`width\` prop, and its container has no \`width\` defined.`);
|
|
@@ -2,93 +2,76 @@
|
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
5
|
Object.defineProperty(exports, "__esModule", {
|
|
7
6
|
value: true
|
|
8
7
|
});
|
|
9
8
|
exports.useChartContainerProps = void 0;
|
|
10
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _useDefaultizeAxis = require("./useDefaultizeAxis");
|
|
15
|
-
const _excluded = ["width", "height", "series", "margin", "xAxis", "yAxis", "zAxis", "colors", "dataset", "sx", "title", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "children", "skipAnimation"];
|
|
11
|
+
var _useChartContainerDimensions = require("./useChartContainerDimensions");
|
|
12
|
+
const _excluded = ["width", "height", "resolveSizeBeforeRender", "margin", "children", "series", "colors", "dataset", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "sx", "title", "viewBox", "xAxis", "yAxis", "zAxis", "skipAnimation"];
|
|
16
13
|
const useChartContainerProps = (props, ref) => {
|
|
17
14
|
const {
|
|
18
15
|
width,
|
|
19
16
|
height,
|
|
20
|
-
|
|
17
|
+
resolveSizeBeforeRender,
|
|
21
18
|
margin,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
zAxis,
|
|
19
|
+
children,
|
|
20
|
+
series,
|
|
25
21
|
colors,
|
|
26
22
|
dataset,
|
|
27
|
-
sx,
|
|
28
|
-
title,
|
|
29
23
|
desc,
|
|
30
24
|
disableAxisListener,
|
|
31
25
|
highlightedItem,
|
|
32
26
|
onHighlightChange,
|
|
33
27
|
plugins,
|
|
34
|
-
|
|
28
|
+
sx,
|
|
29
|
+
title,
|
|
30
|
+
viewBox,
|
|
31
|
+
xAxis,
|
|
32
|
+
yAxis,
|
|
33
|
+
zAxis,
|
|
35
34
|
skipAnimation
|
|
36
35
|
} = props,
|
|
37
36
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
const {
|
|
38
|
+
containerRef,
|
|
39
|
+
width: dWidth,
|
|
40
|
+
height: dHeight
|
|
41
|
+
} = (0, _useChartContainerDimensions.useChartContainerDimensions)(width, height, resolveSizeBeforeRender);
|
|
42
|
+
const resizableChartContainerProps = (0, _extends2.default)({}, other, {
|
|
43
|
+
ownerState: {
|
|
44
|
+
width,
|
|
45
|
+
height
|
|
46
|
+
},
|
|
47
|
+
ref: containerRef
|
|
48
|
+
});
|
|
49
|
+
const chartDataProviderProps = {
|
|
44
50
|
margin,
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
const animationProviderProps = {
|
|
48
|
-
skipAnimation
|
|
49
|
-
};
|
|
50
|
-
const pluginProviderProps = {
|
|
51
|
-
plugins
|
|
52
|
-
};
|
|
53
|
-
const seriesProviderProps = {
|
|
51
|
+
children,
|
|
54
52
|
series,
|
|
55
53
|
colors,
|
|
56
|
-
dataset
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
xAxis: defaultizedXAxis,
|
|
60
|
-
yAxis: defaultizedYAxis,
|
|
61
|
-
dataset
|
|
62
|
-
};
|
|
63
|
-
const zAxisContextProps = {
|
|
64
|
-
zAxis,
|
|
65
|
-
dataset
|
|
66
|
-
};
|
|
67
|
-
const highlightedProviderProps = {
|
|
54
|
+
dataset,
|
|
55
|
+
desc,
|
|
56
|
+
disableAxisListener,
|
|
68
57
|
highlightedItem,
|
|
69
|
-
onHighlightChange
|
|
70
|
-
|
|
71
|
-
const chartsSurfaceProps = (0, _extends2.default)({}, other, {
|
|
72
|
-
width,
|
|
73
|
-
height,
|
|
74
|
-
ref: chartSurfaceRef,
|
|
58
|
+
onHighlightChange,
|
|
59
|
+
plugins,
|
|
75
60
|
sx,
|
|
76
61
|
title,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
62
|
+
viewBox,
|
|
63
|
+
xAxis,
|
|
64
|
+
yAxis,
|
|
65
|
+
zAxis,
|
|
66
|
+
skipAnimation,
|
|
67
|
+
width: dWidth,
|
|
68
|
+
height: dHeight,
|
|
69
|
+
ref
|
|
70
|
+
};
|
|
80
71
|
return {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
cartesianProviderProps,
|
|
85
|
-
zAxisContextProps,
|
|
86
|
-
highlightedProviderProps,
|
|
87
|
-
chartsSurfaceProps,
|
|
88
|
-
pluginProviderProps,
|
|
89
|
-
animationProviderProps,
|
|
90
|
-
xAxis: defaultizedXAxis,
|
|
91
|
-
yAxis: defaultizedYAxis
|
|
72
|
+
hasIntrinsicSize: Boolean(dWidth && dHeight),
|
|
73
|
+
chartDataProviderProps,
|
|
74
|
+
resizableChartContainerProps
|
|
92
75
|
};
|
|
93
76
|
};
|
|
94
77
|
exports.useChartContainerProps = useChartContainerProps;
|
|
@@ -17,7 +17,6 @@ var _styles = require("@mui/material/styles");
|
|
|
17
17
|
var _utils = require("./utils");
|
|
18
18
|
var _chartsLegendClasses = require("./chartsLegendClasses");
|
|
19
19
|
var _DefaultChartsLegend = require("./DefaultChartsLegend");
|
|
20
|
-
var _hooks = require("../hooks");
|
|
21
20
|
var _useSeries = require("../hooks/useSeries");
|
|
22
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
22
|
const _excluded = ["slots", "slotProps"];
|
|
@@ -57,7 +56,6 @@ function ChartsLegend(inProps) {
|
|
|
57
56
|
const classes = useUtilityClasses((0, _extends2.default)({}, defaultizedProps, {
|
|
58
57
|
theme
|
|
59
58
|
}));
|
|
60
|
-
const drawingArea = (0, _hooks.useDrawingArea)();
|
|
61
59
|
const series = (0, _useSeries.useSeries)();
|
|
62
60
|
const seriesToDisplay = (0, _utils.getSeriesToDisplay)(series);
|
|
63
61
|
const ChartLegendRender = slots?.legend ?? _DefaultChartsLegend.DefaultChartsLegend;
|
|
@@ -66,7 +64,6 @@ function ChartsLegend(inProps) {
|
|
|
66
64
|
externalSlotProps: slotProps?.legend,
|
|
67
65
|
additionalProps: (0, _extends2.default)({}, other, {
|
|
68
66
|
classes,
|
|
69
|
-
drawingArea,
|
|
70
67
|
series,
|
|
71
68
|
seriesToDisplay
|
|
72
69
|
}),
|