@mui/x-charts 7.22.2 → 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 +7 -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 +142 -155
- package/ChartContainer/ChartContainer.d.ts +16 -33
- package/ChartContainer/ChartContainer.js +22 -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 -94
- 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 +7 -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 +17 -102
- package/README.md +2 -2
- package/ScatterChart/ScatterChart.d.ts +7 -7
- package/ScatterChart/ScatterChart.js +7 -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 +2 -2
- package/context/CartesianProvider/defaultizeAxis.d.ts +1 -1
- package/context/ChartDataProvider/ChartDataProvider.d.ts +41 -0
- package/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +46 -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 +12 -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/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/seriesType/bar.d.ts +1 -1
- package/models/seriesType/common.d.ts +0 -10
- 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 +7 -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 +22 -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 +7 -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 +17 -102
- package/modern/ScatterChart/ScatterChart.js +7 -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 +2 -2
- package/modern/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +46 -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/getSymbol.js +19 -3
- package/modern/internals/index.js +5 -5
- package/modern/internals/useStringInterpolator.js +1 -0
- package/node/BarChart/BarChart.js +7 -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 +21 -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 +7 -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 +17 -102
- package/node/ScatterChart/ScatterChart.js +7 -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 +2 -2
- package/node/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -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/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
|
@@ -73,12 +73,10 @@ function ChartsVoronoiHandler(props) {
|
|
|
73
73
|
const {
|
|
74
74
|
data,
|
|
75
75
|
xAxisId,
|
|
76
|
-
yAxisId
|
|
77
|
-
xAxisKey,
|
|
78
|
-
yAxisKey
|
|
76
|
+
yAxisId
|
|
79
77
|
} = series[seriesId];
|
|
80
|
-
const xScale = xAxis[xAxisId ??
|
|
81
|
-
const yScale = yAxis[yAxisId ??
|
|
78
|
+
const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
|
|
79
|
+
const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
|
|
82
80
|
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
83
81
|
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
84
82
|
const seriesPoints = data.flatMap(({
|
|
@@ -13,7 +13,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
15
15
|
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
16
|
-
var _useChartContainerDimensions = require("../
|
|
16
|
+
var _useChartContainerDimensions = require("../ChartContainer/useChartContainerDimensions");
|
|
17
17
|
var _ChartsSurface = require("../ChartsSurface");
|
|
18
18
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
19
19
|
var _GaugeProvider = require("./GaugeProvider");
|
|
@@ -49,17 +49,13 @@ const useAggregatedData = () => {
|
|
|
49
49
|
return [...groupIds].reverse() // Revert stacked area for a more pleasant animation
|
|
50
50
|
.map(seriesId => {
|
|
51
51
|
const {
|
|
52
|
-
xAxisId
|
|
53
|
-
yAxisId
|
|
54
|
-
xAxisKey = defaultXAxisId,
|
|
55
|
-
yAxisKey = defaultYAxisId,
|
|
52
|
+
xAxisId = defaultXAxisId,
|
|
53
|
+
yAxisId = defaultYAxisId,
|
|
56
54
|
stackedData,
|
|
57
55
|
data,
|
|
58
56
|
connectNulls,
|
|
59
57
|
baseline
|
|
60
58
|
} = series[seriesId];
|
|
61
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
62
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
63
59
|
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
64
60
|
const yScale = yAxis[yAxisId].scale;
|
|
65
61
|
const xData = xAxis[xAxisId].data;
|
|
@@ -13,7 +13,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _AreaPlot = require("./AreaPlot");
|
|
15
15
|
var _LinePlot = require("./LinePlot");
|
|
16
|
-
var
|
|
16
|
+
var _ChartContainer = require("../ChartContainer");
|
|
17
17
|
var _MarkPlot = require("./MarkPlot");
|
|
18
18
|
var _ChartsAxis = require("../ChartsAxis/ChartsAxis");
|
|
19
19
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
@@ -58,7 +58,7 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
|
|
|
58
58
|
tooltipProps,
|
|
59
59
|
children
|
|
60
60
|
} = (0, _useLineChartProps.useLineChartProps)(props);
|
|
61
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartContainer.ChartContainer, (0, _extends2.default)({
|
|
62
62
|
ref: ref
|
|
63
63
|
}, chartContainerProps, {
|
|
64
64
|
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, {
|
|
@@ -66,7 +66,7 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
|
|
|
66
66
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
67
67
|
"data-drawing-container": true,
|
|
68
68
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, (0, _extends2.default)({}, markPlotProps))
|
|
69
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, (0, _extends2.default)({}, lineHighlightPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltipProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
69
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, (0, _extends2.default)({}, lineHighlightPlotProps)), !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]
|
|
70
70
|
}));
|
|
71
71
|
});
|
|
72
72
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
@@ -126,6 +126,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
126
126
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
127
127
|
*/
|
|
128
128
|
height: _propTypes.default.number,
|
|
129
|
+
/**
|
|
130
|
+
* If `true`, the legend is not rendered.
|
|
131
|
+
*/
|
|
132
|
+
hideLegend: _propTypes.default.bool,
|
|
129
133
|
/**
|
|
130
134
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
131
135
|
*/
|
|
@@ -139,32 +143,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
139
143
|
* @default yAxisIds[0] The id of the first provided axis
|
|
140
144
|
*/
|
|
141
145
|
leftAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
142
|
-
/**
|
|
143
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
144
|
-
*/
|
|
145
|
-
legend: _propTypes.default.shape({
|
|
146
|
-
classes: _propTypes.default.object,
|
|
147
|
-
direction: _propTypes.default.oneOf(['column', 'row']),
|
|
148
|
-
hidden: _propTypes.default.bool,
|
|
149
|
-
itemGap: _propTypes.default.number,
|
|
150
|
-
itemMarkHeight: _propTypes.default.number,
|
|
151
|
-
itemMarkWidth: _propTypes.default.number,
|
|
152
|
-
labelStyle: _propTypes.default.object,
|
|
153
|
-
markGap: _propTypes.default.number,
|
|
154
|
-
onItemClick: _propTypes.default.func,
|
|
155
|
-
padding: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
156
|
-
bottom: _propTypes.default.number,
|
|
157
|
-
left: _propTypes.default.number,
|
|
158
|
-
right: _propTypes.default.number,
|
|
159
|
-
top: _propTypes.default.number
|
|
160
|
-
})]),
|
|
161
|
-
position: _propTypes.default.shape({
|
|
162
|
-
horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
|
|
163
|
-
vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
164
|
-
}),
|
|
165
|
-
slotProps: _propTypes.default.object,
|
|
166
|
-
slots: _propTypes.default.object
|
|
167
|
-
}),
|
|
168
146
|
/**
|
|
169
147
|
* If `true`, a loading overlay is displayed.
|
|
170
148
|
* @default false
|
|
@@ -69,16 +69,12 @@ function LineHighlightPlot(props) {
|
|
|
69
69
|
}) => {
|
|
70
70
|
return groupIds.flatMap(seriesId => {
|
|
71
71
|
const {
|
|
72
|
-
xAxisId
|
|
73
|
-
yAxisId
|
|
74
|
-
xAxisKey = defaultXAxisId,
|
|
75
|
-
yAxisKey = defaultYAxisId,
|
|
72
|
+
xAxisId = defaultXAxisId,
|
|
73
|
+
yAxisId = defaultYAxisId,
|
|
76
74
|
stackedData,
|
|
77
75
|
data,
|
|
78
76
|
disableHighlight
|
|
79
77
|
} = series[seriesId];
|
|
80
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
81
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
82
78
|
if (disableHighlight || data[highlightedIndex] == null) {
|
|
83
79
|
return null;
|
|
84
80
|
}
|
|
@@ -48,16 +48,12 @@ const useAggregatedData = () => {
|
|
|
48
48
|
}) => {
|
|
49
49
|
return groupIds.flatMap(seriesId => {
|
|
50
50
|
const {
|
|
51
|
-
xAxisId
|
|
52
|
-
yAxisId
|
|
53
|
-
xAxisKey = defaultXAxisId,
|
|
54
|
-
yAxisKey = defaultYAxisId,
|
|
51
|
+
xAxisId = defaultXAxisId,
|
|
52
|
+
yAxisId = defaultYAxisId,
|
|
55
53
|
stackedData,
|
|
56
54
|
data,
|
|
57
55
|
connectNulls
|
|
58
56
|
} = series[seriesId];
|
|
59
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
60
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
61
57
|
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
62
58
|
const yScale = yAxis[yAxisId].scale;
|
|
63
59
|
const xData = xAxis[xAxisId].data;
|
|
@@ -70,10 +70,8 @@ function MarkPlot(props) {
|
|
|
70
70
|
}) => {
|
|
71
71
|
return groupIds.map(seriesId => {
|
|
72
72
|
const {
|
|
73
|
-
xAxisId
|
|
74
|
-
yAxisId
|
|
75
|
-
xAxisKey = defaultXAxisId,
|
|
76
|
-
yAxisKey = defaultYAxisId,
|
|
73
|
+
xAxisId = defaultXAxisId,
|
|
74
|
+
yAxisId = defaultYAxisId,
|
|
77
75
|
stackedData,
|
|
78
76
|
data,
|
|
79
77
|
showMark = true
|
|
@@ -81,8 +79,6 @@ function MarkPlot(props) {
|
|
|
81
79
|
if (showMark === false) {
|
|
82
80
|
return null;
|
|
83
81
|
}
|
|
84
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
85
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
86
82
|
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
87
83
|
const yScale = yAxis[yAxisId].scale;
|
|
88
84
|
const xData = xAxis[xAxisId].data;
|
|
@@ -13,8 +13,11 @@ const getExtremumX = params => {
|
|
|
13
13
|
return [minX, maxX];
|
|
14
14
|
};
|
|
15
15
|
exports.getExtremumX = getExtremumX;
|
|
16
|
-
function getSeriesExtremums(getValues, stackedData, filter) {
|
|
16
|
+
function getSeriesExtremums(getValues, data, stackedData, filter) {
|
|
17
17
|
return stackedData.reduce((seriesAcc, stackedValue, index) => {
|
|
18
|
+
if (data[index] === null) {
|
|
19
|
+
return seriesAcc;
|
|
20
|
+
}
|
|
18
21
|
const [base, value] = getValues(stackedValue);
|
|
19
22
|
if (filter && (!filter({
|
|
20
23
|
y: base,
|
|
@@ -36,24 +39,25 @@ const getExtremumY = params => {
|
|
|
36
39
|
getFilters
|
|
37
40
|
} = params;
|
|
38
41
|
return Object.keys(series).filter(seriesId => {
|
|
39
|
-
const yAxisId = series[seriesId].yAxisId
|
|
42
|
+
const yAxisId = series[seriesId].yAxisId;
|
|
40
43
|
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
41
44
|
}).reduce((acc, seriesId) => {
|
|
42
45
|
const {
|
|
43
46
|
area,
|
|
44
|
-
stackedData
|
|
47
|
+
stackedData,
|
|
48
|
+
data
|
|
45
49
|
} = series[seriesId];
|
|
46
50
|
const isArea = area !== undefined;
|
|
47
51
|
const filter = getFilters?.({
|
|
48
52
|
currentAxisId: axis.id,
|
|
49
53
|
isDefaultAxis,
|
|
50
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
51
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
54
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
55
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
52
56
|
});
|
|
53
57
|
|
|
54
58
|
// Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
55
59
|
const getValues = isArea && axis.scaleType !== 'log' && typeof series[seriesId].baseline !== 'string' ? d => d : d => [d[1], d[1]];
|
|
56
|
-
const seriesExtremums = getSeriesExtremums(getValues, stackedData, filter);
|
|
60
|
+
const seriesExtremums = getSeriesExtremums(getValues, data, stackedData, filter);
|
|
57
61
|
const [seriesMin, seriesMax] = seriesExtremums;
|
|
58
62
|
return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
|
|
59
63
|
}, [Infinity, -Infinity]);
|
|
@@ -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", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "
|
|
13
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "tooltip", "onAxisClick", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "experimentalMarkRendering"];
|
|
14
14
|
/**
|
|
15
15
|
* A helper function that extracts LineChartProps from the input props
|
|
16
16
|
* and returns an object with props for the children components of LineChart.
|
|
@@ -36,7 +36,6 @@ const useLineChartProps = props => {
|
|
|
36
36
|
onMarkClick,
|
|
37
37
|
axisHighlight,
|
|
38
38
|
disableLineItemHighlight,
|
|
39
|
-
legend,
|
|
40
39
|
grid,
|
|
41
40
|
topAxis,
|
|
42
41
|
leftAxis,
|
|
@@ -130,10 +129,10 @@ const useLineChartProps = props => {
|
|
|
130
129
|
slots,
|
|
131
130
|
slotProps
|
|
132
131
|
};
|
|
133
|
-
const legendProps =
|
|
132
|
+
const legendProps = {
|
|
134
133
|
slots,
|
|
135
134
|
slotProps
|
|
136
|
-
}
|
|
135
|
+
};
|
|
137
136
|
const tooltipProps = (0, _extends2.default)({}, tooltip, {
|
|
138
137
|
slots,
|
|
139
138
|
slotProps
|
package/node/PieChart/PieArc.js
CHANGED
|
@@ -21,7 +21,7 @@ var _styles = require("@mui/material/styles");
|
|
|
21
21
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
22
22
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
-
const _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "id", "innerRadius", "isFaded", "isHighlighted", "onClick", "outerRadius", "paddingAngle", "startAngle"
|
|
24
|
+
const _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "id", "innerRadius", "isFaded", "isHighlighted", "onClick", "outerRadius", "paddingAngle", "startAngle"];
|
|
25
25
|
function getPieArcUtilityClass(slot) {
|
|
26
26
|
return (0, _generateUtilityClass.default)('MuiPieArc', slot);
|
|
27
27
|
}
|
|
@@ -102,15 +102,6 @@ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
|
102
102
|
// ----------------------------------------------------------------------
|
|
103
103
|
classes: _propTypes.default.object,
|
|
104
104
|
dataIndex: _propTypes.default.number.isRequired,
|
|
105
|
-
/**
|
|
106
|
-
* @deprecated Use the `isFaded` or `isHighlighted` props instead.
|
|
107
|
-
*/
|
|
108
|
-
highlightScope: _propTypes.default.shape({
|
|
109
|
-
fade: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
110
|
-
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
111
|
-
highlight: _propTypes.default.oneOf(['item', 'none', 'series']),
|
|
112
|
-
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
113
|
-
}),
|
|
114
105
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
115
106
|
isFaded: _propTypes.default.bool.isRequired,
|
|
116
107
|
isHighlighted: _propTypes.default.bool.isRequired
|
|
@@ -15,7 +15,6 @@ var _web = require("@react-spring/web");
|
|
|
15
15
|
var _PieArc = require("./PieArc");
|
|
16
16
|
var _transition = require("./dataTransform/transition");
|
|
17
17
|
var _useTransformData = require("./dataTransform/useTransformData");
|
|
18
|
-
var _context = require("../context");
|
|
19
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
19
|
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlighted", "faded", "data", "onItemClick", "skipAnimation"],
|
|
21
20
|
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "arcLabelRadius", "outerRadius", "cornerRadius"];
|
|
@@ -50,9 +49,6 @@ function PieArcPlot(props) {
|
|
|
50
49
|
const transition = (0, _web.useTransition)(transformedData, (0, _extends2.default)({}, _transition.defaultTransitionConfig, {
|
|
51
50
|
immediate: skipAnimation
|
|
52
51
|
}));
|
|
53
|
-
const {
|
|
54
|
-
highlightScope
|
|
55
|
-
} = (0, _context.useHighlighted)();
|
|
56
52
|
if (data.length === 0) {
|
|
57
53
|
return null;
|
|
58
54
|
}
|
|
@@ -79,7 +75,6 @@ function PieArcPlot(props) {
|
|
|
79
75
|
id: id,
|
|
80
76
|
color: item.color,
|
|
81
77
|
dataIndex: index,
|
|
82
|
-
highlightScope: highlightScope,
|
|
83
78
|
isFaded: item.isFaded,
|
|
84
79
|
isHighlighted: item.isHighlighted,
|
|
85
80
|
onClick: onItemClick && (event => {
|
|
@@ -13,16 +13,13 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
15
15
|
var _styles = require("@mui/material/styles");
|
|
16
|
-
var
|
|
17
|
-
var _ChartsAxis = require("../ChartsAxis/ChartsAxis");
|
|
18
|
-
var _constants = require("../constants");
|
|
16
|
+
var _ChartContainer = require("../ChartContainer");
|
|
19
17
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
20
18
|
var _ChartsLegend = require("../ChartsLegend");
|
|
21
|
-
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
22
19
|
var _PiePlot = require("./PiePlot");
|
|
23
20
|
var _ChartsOverlay = require("../ChartsOverlay");
|
|
24
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "sx", "tooltip", "
|
|
22
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "sx", "tooltip", "skipAnimation", "hideLegend", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
26
23
|
const defaultMargin = {
|
|
27
24
|
top: 5,
|
|
28
25
|
bottom: 5,
|
|
@@ -52,8 +49,6 @@ const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieCh
|
|
|
52
49
|
name: 'MuiPieChart'
|
|
53
50
|
});
|
|
54
51
|
const {
|
|
55
|
-
xAxis,
|
|
56
|
-
yAxis,
|
|
57
52
|
series,
|
|
58
53
|
width,
|
|
59
54
|
height,
|
|
@@ -63,16 +58,8 @@ const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieCh
|
|
|
63
58
|
tooltip = {
|
|
64
59
|
trigger: 'item'
|
|
65
60
|
},
|
|
66
|
-
axisHighlight = {
|
|
67
|
-
x: 'none',
|
|
68
|
-
y: 'none'
|
|
69
|
-
},
|
|
70
61
|
skipAnimation,
|
|
71
|
-
|
|
72
|
-
topAxis = null,
|
|
73
|
-
leftAxis = null,
|
|
74
|
-
rightAxis = null,
|
|
75
|
-
bottomAxis = null,
|
|
62
|
+
hideLegend,
|
|
76
63
|
children,
|
|
77
64
|
slots,
|
|
78
65
|
slotProps,
|
|
@@ -85,14 +72,7 @@ const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieCh
|
|
|
85
72
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
86
73
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
87
74
|
const margin = (0, _extends2.default)({}, isRtl ? defaultRTLMargin : defaultMargin, marginProps);
|
|
88
|
-
|
|
89
|
-
direction: 'column',
|
|
90
|
-
position: {
|
|
91
|
-
vertical: 'middle',
|
|
92
|
-
horizontal: isRtl ? 'left' : 'right'
|
|
93
|
-
}
|
|
94
|
-
}, legendProps);
|
|
95
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, (0, _extends2.default)({}, other, {
|
|
75
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartContainer.ChartContainer, (0, _extends2.default)({}, other, {
|
|
96
76
|
ref: ref,
|
|
97
77
|
series: series.map(s => (0, _extends2.default)({
|
|
98
78
|
type: 'pie'
|
|
@@ -100,27 +80,14 @@ const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieCh
|
|
|
100
80
|
width: width,
|
|
101
81
|
height: height,
|
|
102
82
|
margin: margin,
|
|
103
|
-
xAxis: xAxis ?? [{
|
|
104
|
-
id: _constants.DEFAULT_X_AXIS_KEY,
|
|
105
|
-
scaleType: 'point',
|
|
106
|
-
data: [...new Array(Math.max(...series.map(s => s.data.length)))].map((_, index) => index)
|
|
107
|
-
}],
|
|
108
|
-
yAxis: yAxis,
|
|
109
83
|
colors: colors,
|
|
110
84
|
sx: sx,
|
|
111
|
-
disableAxisListener:
|
|
85
|
+
disableAxisListener: true,
|
|
112
86
|
highlightedItem: highlightedItem,
|
|
113
87
|
onHighlightChange: onHighlightChange,
|
|
114
88
|
className: className,
|
|
115
89
|
skipAnimation: skipAnimation,
|
|
116
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
117
|
-
topAxis: topAxis,
|
|
118
|
-
leftAxis: leftAxis,
|
|
119
|
-
rightAxis: rightAxis,
|
|
120
|
-
bottomAxis: bottomAxis,
|
|
121
|
-
slots: slots,
|
|
122
|
-
slotProps: slotProps
|
|
123
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PiePlot.PiePlot, {
|
|
90
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PiePlot.PiePlot, {
|
|
124
91
|
slots: slots,
|
|
125
92
|
slotProps: slotProps,
|
|
126
93
|
onItemClick: onItemClick
|
|
@@ -128,10 +95,15 @@ const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieCh
|
|
|
128
95
|
loading: loading,
|
|
129
96
|
slots: slots,
|
|
130
97
|
slotProps: slotProps
|
|
131
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend,
|
|
98
|
+
}), !hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, {
|
|
99
|
+
direction: "column",
|
|
100
|
+
position: {
|
|
101
|
+
vertical: 'middle',
|
|
102
|
+
horizontal: isRtl ? 'left' : 'right'
|
|
103
|
+
},
|
|
132
104
|
slots: slots,
|
|
133
105
|
slotProps: slotProps
|
|
134
|
-
})
|
|
106
|
+
}), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip, {
|
|
135
107
|
slots: slots,
|
|
136
108
|
slotProps: slotProps
|
|
137
109
|
})), children]
|
|
@@ -142,21 +114,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
142
114
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
143
115
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
144
116
|
// ----------------------------------------------------------------------
|
|
145
|
-
/**
|
|
146
|
-
* The configuration of axes highlight.
|
|
147
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
148
|
-
* @default { x: 'none', y: 'none' }
|
|
149
|
-
*/
|
|
150
|
-
axisHighlight: _propTypes.default.shape({
|
|
151
|
-
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
152
|
-
y: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
153
|
-
}),
|
|
154
|
-
/**
|
|
155
|
-
* Indicate which axis to display the bottom of the charts.
|
|
156
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
157
|
-
* @default null
|
|
158
|
-
*/
|
|
159
|
-
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
160
117
|
children: _propTypes.default.node,
|
|
161
118
|
className: _propTypes.default.string,
|
|
162
119
|
/**
|
|
@@ -179,6 +136,10 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
179
136
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
180
137
|
*/
|
|
181
138
|
height: _propTypes.default.number,
|
|
139
|
+
/**
|
|
140
|
+
* If `true`, the legend is not rendered.
|
|
141
|
+
*/
|
|
142
|
+
hideLegend: _propTypes.default.bool,
|
|
182
143
|
/**
|
|
183
144
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
184
145
|
*/
|
|
@@ -186,40 +147,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
186
147
|
dataIndex: _propTypes.default.number,
|
|
187
148
|
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
188
149
|
}),
|
|
189
|
-
/**
|
|
190
|
-
* Indicate which axis to display the left of the charts.
|
|
191
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
192
|
-
* @default null
|
|
193
|
-
*/
|
|
194
|
-
leftAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
195
|
-
/**
|
|
196
|
-
* The props of the legend.
|
|
197
|
-
* @default { direction: 'column', position: { vertical: 'middle', horizontal: 'right' } }
|
|
198
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
199
|
-
*/
|
|
200
|
-
legend: _propTypes.default.shape({
|
|
201
|
-
classes: _propTypes.default.object,
|
|
202
|
-
direction: _propTypes.default.oneOf(['column', 'row']),
|
|
203
|
-
hidden: _propTypes.default.bool,
|
|
204
|
-
itemGap: _propTypes.default.number,
|
|
205
|
-
itemMarkHeight: _propTypes.default.number,
|
|
206
|
-
itemMarkWidth: _propTypes.default.number,
|
|
207
|
-
labelStyle: _propTypes.default.object,
|
|
208
|
-
markGap: _propTypes.default.number,
|
|
209
|
-
onItemClick: _propTypes.default.func,
|
|
210
|
-
padding: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
211
|
-
bottom: _propTypes.default.number,
|
|
212
|
-
left: _propTypes.default.number,
|
|
213
|
-
right: _propTypes.default.number,
|
|
214
|
-
top: _propTypes.default.number
|
|
215
|
-
})]),
|
|
216
|
-
position: _propTypes.default.shape({
|
|
217
|
-
horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
|
|
218
|
-
vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
219
|
-
}),
|
|
220
|
-
slotProps: _propTypes.default.object,
|
|
221
|
-
slots: _propTypes.default.object
|
|
222
|
-
}),
|
|
223
150
|
/**
|
|
224
151
|
* If `true`, a loading overlay is displayed.
|
|
225
152
|
* @default false
|
|
@@ -257,12 +184,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
257
184
|
* @default false
|
|
258
185
|
*/
|
|
259
186
|
resolveSizeBeforeRender: _propTypes.default.bool,
|
|
260
|
-
/**
|
|
261
|
-
* Indicate which axis to display the right of the charts.
|
|
262
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
263
|
-
* @default null
|
|
264
|
-
*/
|
|
265
|
-
rightAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
266
187
|
/**
|
|
267
188
|
* The series to display in the pie chart.
|
|
268
189
|
* An array of [[PieSeriesType]] objects.
|
|
@@ -298,12 +219,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
298
219
|
slots: _propTypes.default.object,
|
|
299
220
|
trigger: _propTypes.default.oneOf(['axis', 'item', 'none'])
|
|
300
221
|
}),
|
|
301
|
-
/**
|
|
302
|
-
* Indicate which axis to display the top of the charts.
|
|
303
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
304
|
-
* @default null
|
|
305
|
-
*/
|
|
306
|
-
topAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
307
222
|
viewBox: _propTypes.default.shape({
|
|
308
223
|
height: _propTypes.default.number,
|
|
309
224
|
width: _propTypes.default.number,
|
|
@@ -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 _ScatterPlot = require("./ScatterPlot");
|
|
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");
|
|
@@ -51,14 +51,14 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
51
51
|
tooltipProps,
|
|
52
52
|
children
|
|
53
53
|
} = (0, _useScatterChartProps.useScatterChartProps)(props);
|
|
54
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartContainer.ChartContainer, (0, _extends2.default)({
|
|
55
55
|
ref: ref
|
|
56
56
|
}, chartContainerProps, {
|
|
57
57
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ZAxisContextProvider.ZAxisContextProvider, (0, _extends2.default)({}, zAxisProps, {
|
|
58
58
|
children: [!props.disableVoronoi && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsVoronoiHandler.ChartsVoronoiHandler, (0, _extends2.default)({}, voronoiHandlerProps)), /*#__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", {
|
|
59
59
|
"data-drawing-container": true,
|
|
60
60
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, (0, _extends2.default)({}, scatterPlotProps))
|
|
61
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltipProps)), children]
|
|
61
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltipProps)), children]
|
|
62
62
|
}))
|
|
63
63
|
}));
|
|
64
64
|
});
|
|
@@ -116,6 +116,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
116
116
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
117
117
|
*/
|
|
118
118
|
height: _propTypes.default.number,
|
|
119
|
+
/**
|
|
120
|
+
* If `true`, the legend is not rendered.
|
|
121
|
+
*/
|
|
122
|
+
hideLegend: _propTypes.default.bool,
|
|
119
123
|
/**
|
|
120
124
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
121
125
|
*/
|
|
@@ -129,32 +133,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
129
133
|
* @default yAxisIds[0] The id of the first provided axis
|
|
130
134
|
*/
|
|
131
135
|
leftAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
132
|
-
/**
|
|
133
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
134
|
-
*/
|
|
135
|
-
legend: _propTypes.default.shape({
|
|
136
|
-
classes: _propTypes.default.object,
|
|
137
|
-
direction: _propTypes.default.oneOf(['column', 'row']),
|
|
138
|
-
hidden: _propTypes.default.bool,
|
|
139
|
-
itemGap: _propTypes.default.number,
|
|
140
|
-
itemMarkHeight: _propTypes.default.number,
|
|
141
|
-
itemMarkWidth: _propTypes.default.number,
|
|
142
|
-
labelStyle: _propTypes.default.object,
|
|
143
|
-
markGap: _propTypes.default.number,
|
|
144
|
-
onItemClick: _propTypes.default.func,
|
|
145
|
-
padding: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
146
|
-
bottom: _propTypes.default.number,
|
|
147
|
-
left: _propTypes.default.number,
|
|
148
|
-
right: _propTypes.default.number,
|
|
149
|
-
top: _propTypes.default.number
|
|
150
|
-
})]),
|
|
151
|
-
position: _propTypes.default.shape({
|
|
152
|
-
horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
|
|
153
|
-
vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
154
|
-
}),
|
|
155
|
-
slotProps: _propTypes.default.object,
|
|
156
|
-
slots: _propTypes.default.object
|
|
157
|
-
}),
|
|
158
136
|
/**
|
|
159
137
|
* If `true`, a loading overlay is displayed.
|
|
160
138
|
* @default false
|
|
@@ -59,18 +59,15 @@ function ScatterPlot(props) {
|
|
|
59
59
|
children: seriesOrder.map(seriesId => {
|
|
60
60
|
const {
|
|
61
61
|
id,
|
|
62
|
-
xAxisKey,
|
|
63
|
-
yAxisKey,
|
|
64
|
-
zAxisKey,
|
|
65
62
|
xAxisId,
|
|
66
63
|
yAxisId,
|
|
67
64
|
zAxisId,
|
|
68
65
|
markerSize,
|
|
69
66
|
color
|
|
70
67
|
} = series[seriesId];
|
|
71
|
-
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisId ??
|
|
72
|
-
const xScale = xAxis[xAxisId ??
|
|
73
|
-
const yScale = yAxis[yAxisId ??
|
|
68
|
+
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[zAxisId ?? defaultZAxisId]);
|
|
69
|
+
const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
|
|
70
|
+
const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
|
|
74
71
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ScatterItems, (0, _extends2.default)({
|
|
75
72
|
xScale: xScale,
|
|
76
73
|
yScale: yScale,
|
|
@@ -15,14 +15,14 @@ const getExtremumX = params => {
|
|
|
15
15
|
getFilters
|
|
16
16
|
} = params;
|
|
17
17
|
return Object.keys(series).filter(seriesId => {
|
|
18
|
-
const axisId = series[seriesId].xAxisId
|
|
18
|
+
const axisId = series[seriesId].xAxisId;
|
|
19
19
|
return axisId === axis.id || axisId === undefined && isDefaultAxis;
|
|
20
20
|
}).reduce((acc, seriesId) => {
|
|
21
21
|
const filter = getFilters?.({
|
|
22
22
|
currentAxisId: axis.id,
|
|
23
23
|
isDefaultAxis,
|
|
24
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
25
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
24
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
25
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
26
26
|
});
|
|
27
27
|
const seriesMinMax = series[seriesId].data?.reduce((accSeries, d, dataIndex) => {
|
|
28
28
|
if (filter && !filter(d, dataIndex)) {
|
|
@@ -42,14 +42,14 @@ const getExtremumY = params => {
|
|
|
42
42
|
getFilters
|
|
43
43
|
} = params;
|
|
44
44
|
return Object.keys(series).filter(seriesId => {
|
|
45
|
-
const axisId = series[seriesId].yAxisId
|
|
45
|
+
const axisId = series[seriesId].yAxisId;
|
|
46
46
|
return axisId === axis.id || axisId === undefined && isDefaultAxis;
|
|
47
47
|
}).reduce((acc, seriesId) => {
|
|
48
48
|
const filter = getFilters?.({
|
|
49
49
|
currentAxisId: axis.id,
|
|
50
50
|
isDefaultAxis,
|
|
51
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
52
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
51
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
52
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
53
53
|
});
|
|
54
54
|
const seriesMinMax = series[seriesId].data?.reduce((accSeries, d, dataIndex) => {
|
|
55
55
|
if (filter && !filter(d, dataIndex)) {
|