@mui/x-charts 7.11.0 → 7.12.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 +0 -2
- package/BarChart/BarElement.d.ts +22 -21
- package/BarChart/BarElement.js +3 -3
- package/BarChart/BarLabel/BarLabel.d.ts +20 -20
- package/BarChart/BarLabel/BarLabelItem.d.ts +2 -1
- package/BarChart/BarLabel/BarLabelItem.js +2 -2
- package/BarChart/BarPlot.js +8 -8
- package/BarChart/checkScaleErrors.d.ts +4 -4
- package/BarChart/checkScaleErrors.js +11 -11
- package/BarChart/extremums.js +4 -1
- package/BarChart/formatter.js +3 -3
- package/CHANGELOG.md +194 -4
- package/ChartContainer/ChartContainer.d.ts +3 -3
- package/ChartContainer/ChartContainer.js +3 -5
- package/ChartContainer/useChartContainerProps.d.ts +50 -52
- package/ChartContainer/useChartContainerProps.js +2 -2
- package/ChartContainer/useDefaultizeAxis.d.ts +24 -25
- package/ChartContainer/usePluginsMerge.d.ts +1 -1
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsLegend/ChartsLegend.js +6 -6
- package/ChartsLegend/DefaultChartsLegend.d.ts +1 -1
- package/ChartsLegend/LegendPerItem.js +2 -2
- package/ChartsLegend/utils.d.ts +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/ChartsOverlay/ChartsOverlay.d.ts +3 -2
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
- package/ChartsTooltip/ChartsAxisTooltipContent.js +9 -5
- package/ChartsTooltip/ChartsItemTooltipContent.js +6 -6
- package/ChartsTooltip/ChartsTooltip.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltip.js +10 -10
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -3
- package/ChartsXAxis/ChartsXAxis.js +5 -5
- package/ChartsYAxis/ChartsYAxis.js +6 -6
- package/Gauge/GaugeReferenceArc.js +1 -1
- package/Gauge/GaugeValueArc.js +1 -1
- package/LineChart/AnimatedArea.d.ts +20 -20
- package/LineChart/AnimatedArea.js +1 -1
- package/LineChart/AnimatedLine.d.ts +20 -20
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AreaElement.d.ts +2 -1
- package/LineChart/AreaElement.js +2 -2
- package/LineChart/AreaPlot.js +11 -7
- package/LineChart/LineChart.js +4 -3
- package/LineChart/LineElement.d.ts +2 -1
- package/LineChart/LineElement.js +2 -2
- package/LineChart/LineHighlightPlot.d.ts +2 -1
- package/LineChart/LineHighlightPlot.js +9 -5
- package/LineChart/LinePlot.js +11 -7
- package/LineChart/MarkElement.js +1 -1
- package/LineChart/MarkPlot.js +9 -5
- package/LineChart/extremums.js +4 -1
- package/LineChart/formatter.js +3 -3
- package/PieChart/PieArc.js +2 -1
- package/PieChart/PieArcLabel.js +1 -1
- package/PieChart/PieChart.js +0 -2
- package/PieChart/formatter.js +1 -1
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/ResponsiveChartContainer/useChartContainerDimensions.js +2 -2
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +2 -2
- package/ScatterChart/ScatterChart.js +4 -3
- package/ScatterChart/ScatterPlot.js +6 -3
- package/ScatterChart/extremums.js +8 -2
- package/SparkLineChart/SparkLineChart.js +0 -2
- package/context/CartesianProvider/CartesianContext.d.ts +1 -1
- package/context/CartesianProvider/computeValue.d.ts +1 -1
- package/context/CartesianProvider/computeValue.js +1 -1
- package/context/CartesianProvider/defaultizeAxis.d.ts +24 -25
- package/context/CartesianProvider/getAxisExtremum.d.ts +1 -1
- package/context/CartesianProvider/normalizeAxis.js +1 -1
- package/context/DrawingProvider.d.ts +2 -1
- package/context/DrawingProvider.js +7 -1
- package/context/{SeriesContextProvider.d.ts → SeriesProvider/Series.types.d.ts} +4 -8
- package/context/SeriesProvider/Series.types.js +5 -0
- package/context/SeriesProvider/SeriesContext.d.ts +4 -0
- package/context/SeriesProvider/SeriesContext.js +16 -0
- package/context/SeriesProvider/SeriesProvider.d.ts +5 -0
- package/context/SeriesProvider/SeriesProvider.js +37 -0
- package/context/SeriesProvider/index.d.ts +12 -0
- package/context/SeriesProvider/index.js +49 -0
- package/context/SeriesProvider/processSeries.d.ts +17 -0
- package/context/SeriesProvider/processSeries.js +55 -0
- package/context/ZAxisContextProvider.d.ts +1 -1
- package/context/ZAxisContextProvider.js +1 -1
- package/esm/BarChart/BarChart.js +0 -2
- package/esm/BarChart/BarElement.js +2 -2
- package/esm/BarChart/BarLabel/BarLabelItem.js +1 -1
- package/esm/BarChart/BarPlot.js +8 -8
- package/esm/BarChart/checkScaleErrors.js +11 -11
- package/esm/BarChart/extremums.js +4 -1
- package/esm/BarChart/formatter.js +3 -3
- package/esm/ChartContainer/ChartContainer.js +3 -5
- package/esm/ChartContainer/useChartContainerProps.js +2 -2
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/esm/ChartsLegend/ChartsLegend.js +2 -2
- package/esm/ChartsLegend/LegendPerItem.js +1 -1
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +2 -3
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +2 -3
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +5 -5
- package/esm/ChartsTooltip/ChartsTooltip.js +3 -3
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -3
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
- package/esm/Gauge/GaugeReferenceArc.js +1 -1
- package/esm/Gauge/GaugeValueArc.js +1 -1
- package/esm/LineChart/AnimatedArea.js +1 -1
- package/esm/LineChart/AnimatedLine.js +1 -1
- package/esm/LineChart/AreaElement.js +1 -1
- package/esm/LineChart/AreaPlot.js +11 -7
- package/esm/LineChart/LineChart.js +4 -3
- package/esm/LineChart/LineElement.js +1 -1
- package/esm/LineChart/LineHighlightPlot.js +9 -5
- package/esm/LineChart/LinePlot.js +11 -7
- package/esm/LineChart/MarkElement.js +1 -1
- package/esm/LineChart/MarkPlot.js +9 -5
- package/esm/LineChart/extremums.js +4 -1
- package/esm/LineChart/formatter.js +3 -3
- package/esm/PieChart/PieArc.js +2 -1
- package/esm/PieChart/PieArcLabel.js +1 -1
- package/esm/PieChart/PieChart.js +0 -2
- package/esm/PieChart/formatter.js +1 -1
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +2 -2
- package/esm/ScatterChart/ScatterChart.js +4 -3
- package/esm/ScatterChart/ScatterPlot.js +6 -3
- package/esm/ScatterChart/extremums.js +8 -2
- package/esm/SparkLineChart/SparkLineChart.js +0 -2
- package/esm/context/CartesianProvider/computeValue.js +1 -1
- package/esm/context/CartesianProvider/normalizeAxis.js +1 -1
- package/esm/context/DrawingProvider.js +7 -1
- package/esm/context/SeriesProvider/Series.types.js +1 -0
- package/esm/context/SeriesProvider/SeriesContext.js +8 -0
- package/esm/context/SeriesProvider/SeriesProvider.js +30 -0
- package/esm/context/SeriesProvider/index.js +8 -0
- package/esm/context/{SeriesContextProvider.js → SeriesProvider/processSeries.js} +10 -35
- package/esm/context/ZAxisContextProvider.js +1 -1
- package/esm/hooks/useAxisEvents.js +12 -8
- package/esm/hooks/useReducedMotion.js +2 -2
- package/esm/hooks/useSeries.js +1 -1
- package/esm/internals/SlotComponentPropsFromProps.js +1 -0
- package/esm/internals/colorScale.js +1 -1
- package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
- package/esm/internals/geometry.js +1 -1
- package/esm/internals/getCurve.js +1 -1
- package/esm/internals/getPercentageValue.js +1 -1
- package/esm/internals/getScale.js +1 -1
- package/esm/internals/index.js +1 -1
- package/esm/internals/stackSeries.js +1 -1
- package/esm/internals/useAnimatedPath.js +1 -1
- package/esm/internals/warning.js +19 -11
- package/hooks/useAxisEvents.js +12 -8
- package/hooks/useReducedMotion.js +2 -2
- package/hooks/useSeries.d.ts +1 -1
- package/hooks/useSeries.js +2 -2
- package/hooks/useTicks.d.ts +1 -1
- package/index.js +1 -1
- package/internals/SlotComponentPropsFromProps.d.ts +1 -0
- package/internals/SlotComponentPropsFromProps.js +5 -0
- package/internals/colorScale.d.ts +3 -3
- package/internals/colorScale.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
- package/internals/defaultizeColor.d.ts +8 -1
- package/internals/geometry.js +1 -1
- package/internals/getCurve.d.ts +1 -1
- package/internals/getCurve.js +1 -1
- package/internals/getPercentageValue.js +1 -1
- package/internals/getScale.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +4 -4
- package/internals/isBandScale.d.ts +1 -1
- package/internals/stackSeries.d.ts +1 -1
- package/internals/stackSeries.js +1 -1
- package/internals/useAnimatedPath.js +1 -1
- package/internals/warning.d.ts +2 -1
- package/internals/warning.js +21 -12
- package/models/axis.d.ts +2 -2
- package/models/seriesType/common.d.ts +10 -0
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +5 -0
- package/models/z-axis.d.ts +1 -1
- package/modern/BarChart/BarChart.js +0 -2
- package/modern/BarChart/BarElement.js +2 -2
- package/modern/BarChart/BarLabel/BarLabelItem.js +1 -1
- package/modern/BarChart/BarPlot.js +8 -8
- package/modern/BarChart/checkScaleErrors.js +11 -11
- package/modern/BarChart/extremums.js +4 -1
- package/modern/BarChart/formatter.js +3 -3
- package/modern/ChartContainer/ChartContainer.js +3 -5
- package/modern/ChartContainer/useChartContainerProps.js +2 -2
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/modern/ChartsLegend/ChartsLegend.js +2 -2
- package/modern/ChartsLegend/LegendPerItem.js +1 -1
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +2 -3
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +2 -3
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +5 -5
- package/modern/ChartsTooltip/ChartsTooltip.js +3 -3
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -3
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
- package/modern/Gauge/GaugeReferenceArc.js +1 -1
- package/modern/Gauge/GaugeValueArc.js +1 -1
- package/modern/LineChart/AnimatedArea.js +1 -1
- package/modern/LineChart/AnimatedLine.js +1 -1
- package/modern/LineChart/AreaElement.js +1 -1
- package/modern/LineChart/AreaPlot.js +11 -7
- package/modern/LineChart/LineChart.js +4 -3
- package/modern/LineChart/LineElement.js +1 -1
- package/modern/LineChart/LineHighlightPlot.js +9 -5
- package/modern/LineChart/LinePlot.js +11 -7
- package/modern/LineChart/MarkElement.js +1 -1
- package/modern/LineChart/MarkPlot.js +9 -5
- package/modern/LineChart/extremums.js +4 -1
- package/modern/LineChart/formatter.js +3 -3
- package/modern/PieChart/PieArc.js +2 -1
- package/modern/PieChart/PieArcLabel.js +1 -1
- package/modern/PieChart/PieChart.js +0 -2
- package/modern/PieChart/formatter.js +1 -1
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +2 -2
- package/modern/ScatterChart/ScatterChart.js +4 -3
- package/modern/ScatterChart/ScatterPlot.js +6 -3
- package/modern/ScatterChart/extremums.js +8 -2
- package/modern/SparkLineChart/SparkLineChart.js +0 -2
- package/modern/context/CartesianProvider/computeValue.js +1 -1
- package/modern/context/CartesianProvider/normalizeAxis.js +1 -1
- package/modern/context/DrawingProvider.js +7 -1
- package/modern/context/SeriesProvider/Series.types.js +1 -0
- package/modern/context/SeriesProvider/SeriesContext.js +8 -0
- package/modern/context/SeriesProvider/SeriesProvider.js +30 -0
- package/modern/context/SeriesProvider/index.js +8 -0
- package/modern/context/{SeriesContextProvider.js → SeriesProvider/processSeries.js} +10 -35
- package/modern/context/ZAxisContextProvider.js +1 -1
- package/modern/hooks/useAxisEvents.js +12 -8
- package/modern/hooks/useReducedMotion.js +2 -2
- package/modern/hooks/useSeries.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/SlotComponentPropsFromProps.js +1 -0
- package/modern/internals/colorScale.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
- package/modern/internals/geometry.js +1 -1
- package/modern/internals/getCurve.js +1 -1
- package/modern/internals/getPercentageValue.js +1 -1
- package/modern/internals/getScale.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/internals/stackSeries.js +1 -1
- package/modern/internals/useAnimatedPath.js +1 -1
- package/modern/internals/warning.js +19 -11
- package/package.json +8 -25
- package/context/SeriesContextProvider.js +0 -81
|
@@ -10,10 +10,10 @@ function ChartsReferenceLine(props) {
|
|
|
10
10
|
y
|
|
11
11
|
} = props;
|
|
12
12
|
if (x !== undefined && y !== undefined) {
|
|
13
|
-
throw new Error('MUI X
|
|
13
|
+
throw new Error('MUI X: The ChartsReferenceLine cannot have both `x` and `y` props set.');
|
|
14
14
|
}
|
|
15
15
|
if (x === undefined && y === undefined) {
|
|
16
|
-
throw new Error('MUI X
|
|
16
|
+
throw new Error('MUI X: The ChartsReferenceLine should have a value in `x` or `y` prop.');
|
|
17
17
|
}
|
|
18
18
|
if (x !== undefined) {
|
|
19
19
|
return /*#__PURE__*/_jsx(ChartsXReferenceLine, _extends({}, props));
|
|
@@ -5,7 +5,7 @@ import { useDrawingArea, useXScale } from '../hooks';
|
|
|
5
5
|
import { ReferenceLineRoot } from './common';
|
|
6
6
|
import { ChartsText } from '../ChartsText';
|
|
7
7
|
import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
|
|
8
|
-
import {
|
|
8
|
+
import { warnOnce } from '../internals/warning';
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
const getTextParams = ({
|
|
11
11
|
top,
|
|
@@ -47,7 +47,6 @@ export function getXReferenceLineClasses(classes) {
|
|
|
47
47
|
label: ['label']
|
|
48
48
|
}, getReferenceLineUtilityClass, classes);
|
|
49
49
|
}
|
|
50
|
-
const valueError = buildWarning((value, id) => `MUI X Charts: the value ${value} does not exist in the data of x axis with id ${id}.`, 'error');
|
|
51
50
|
function ChartsXReferenceLine(props) {
|
|
52
51
|
const {
|
|
53
52
|
x,
|
|
@@ -67,7 +66,7 @@ function ChartsXReferenceLine(props) {
|
|
|
67
66
|
const xPosition = xAxisScale(x);
|
|
68
67
|
if (xPosition === undefined) {
|
|
69
68
|
if (process.env.NODE_ENV !== 'production') {
|
|
70
|
-
|
|
69
|
+
warnOnce(`MUI X: the value ${x} does not exist in the data of x axis with id ${axisId}.`, 'error');
|
|
71
70
|
}
|
|
72
71
|
return null;
|
|
73
72
|
}
|
|
@@ -5,7 +5,7 @@ import { useDrawingArea, useYScale } from '../hooks';
|
|
|
5
5
|
import { ReferenceLineRoot } from './common';
|
|
6
6
|
import { ChartsText } from '../ChartsText';
|
|
7
7
|
import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
|
|
8
|
-
import {
|
|
8
|
+
import { warnOnce } from '../internals/warning';
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
const getTextParams = ({
|
|
11
11
|
left,
|
|
@@ -47,7 +47,6 @@ export function getYReferenceLineClasses(classes) {
|
|
|
47
47
|
label: ['label']
|
|
48
48
|
}, getReferenceLineUtilityClass, classes);
|
|
49
49
|
}
|
|
50
|
-
const valueError = buildWarning((value, id) => `MUI X Charts: the value ${value} does not exist in the data of y axis with id ${id}.`, 'error');
|
|
51
50
|
function ChartsYReferenceLine(props) {
|
|
52
51
|
const {
|
|
53
52
|
y,
|
|
@@ -67,7 +66,7 @@ function ChartsYReferenceLine(props) {
|
|
|
67
66
|
const yPosition = yAxisScale(y);
|
|
68
67
|
if (yPosition === undefined) {
|
|
69
68
|
if (process.env.NODE_ENV !== 'production') {
|
|
70
|
-
|
|
69
|
+
warnOnce(`MUI X: the value ${y} does not exist in the data of y axis with id ${axisId}.`, 'error');
|
|
71
70
|
}
|
|
72
71
|
return null;
|
|
73
72
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
4
4
|
import { useCartesianContext } from '../context/CartesianProvider';
|
|
5
5
|
import { DefaultChartsAxisTooltipContent } from './DefaultChartsAxisTooltipContent';
|
|
6
6
|
import { ZAxisContext } from '../context/ZAxisContextProvider';
|
|
@@ -40,11 +40,15 @@ function ChartsAxisTooltipContent(props) {
|
|
|
40
40
|
Object.keys(series).filter(isCartesianSeriesType).forEach(seriesType => {
|
|
41
41
|
series[seriesType].seriesOrder.forEach(seriesId => {
|
|
42
42
|
const item = series[seriesType].series[seriesId];
|
|
43
|
-
const
|
|
43
|
+
const providedXAxisId = item.xAxisId ?? item.xAxisKey;
|
|
44
|
+
const providedYAxisId = item.yAxisId ?? item.yAxisKey;
|
|
45
|
+
const axisKey = isXaxis ? providedXAxisId : providedYAxisId;
|
|
44
46
|
if (axisKey === undefined || axisKey === USED_AXIS_ID) {
|
|
45
47
|
const seriesToAdd = series[seriesType].series[seriesId];
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
+
const xAxisId = providedXAxisId ?? xAxisIds[0];
|
|
49
|
+
const yAxisId = providedYAxisId ?? yAxisIds[0];
|
|
50
|
+
const zAxisId = seriesToAdd.zAxisId ?? seriesToAdd.zAxisKey ?? zAxisIds[0];
|
|
51
|
+
const getColor = colorProcessors[seriesType]?.(seriesToAdd, xAxis[xAxisId], yAxis[yAxisId], zAxisId && zAxis[zAxisId]) ?? (() => '');
|
|
48
52
|
rep.push(_extends({}, seriesToAdd, {
|
|
49
53
|
getColor
|
|
50
54
|
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
4
4
|
import { DefaultChartsItemTooltipContent } from './DefaultChartsItemTooltipContent';
|
|
5
5
|
import { useCartesianContext } from '../context/CartesianProvider';
|
|
6
6
|
import { ZAxisContext } from '../context/ZAxisContextProvider';
|
|
@@ -30,10 +30,10 @@ function ChartsItemTooltipContent(props) {
|
|
|
30
30
|
zAxisIds
|
|
31
31
|
} = React.useContext(ZAxisContext);
|
|
32
32
|
const colorProcessors = useColorProcessor();
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const getColor = colorProcessors[series.type]?.(series,
|
|
33
|
+
const xAxisId = series.xAxisId ?? series.xAxisKey ?? xAxisIds[0];
|
|
34
|
+
const yAxisId = series.yAxisId ?? series.yAxisKey ?? yAxisIds[0];
|
|
35
|
+
const zAxisId = series.zAxisId ?? series.zAxisKey ?? zAxisIds[0];
|
|
36
|
+
const getColor = colorProcessors[series.type]?.(series, xAxisId && xAxis[xAxisId], yAxisId && yAxis[yAxisId], zAxisId && zAxis[zAxisId]) ?? (() => '');
|
|
37
37
|
const Content = content ?? DefaultChartsItemTooltipContent;
|
|
38
38
|
const chartTooltipContentProps = useSlotProps({
|
|
39
39
|
elementType: Content,
|
|
@@ -3,9 +3,9 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import composeClasses from '@mui/utils/composeClasses';
|
|
5
5
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
6
|
+
import Popper from '@mui/material/Popper';
|
|
7
|
+
import NoSsr from '@mui/material/NoSsr';
|
|
8
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
9
9
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
10
10
|
import { generateVirtualElement, useMouseTracker, getTooltipHasData } from './utils';
|
|
11
11
|
import { ChartsItemTooltipContent } from './ChartsItemTooltipContent';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Delaunay } from 'd3-delaunay';
|
|
3
|
+
import { Delaunay } from '@mui/x-charts-vendor/d3-delaunay';
|
|
4
4
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
5
5
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
6
6
|
import { useCartesianContext } from '../context/CartesianProvider';
|
|
@@ -63,11 +63,13 @@ function ChartsVoronoiHandler(props) {
|
|
|
63
63
|
seriesOrder.forEach(seriesId => {
|
|
64
64
|
const {
|
|
65
65
|
data,
|
|
66
|
+
xAxisId,
|
|
67
|
+
yAxisId,
|
|
66
68
|
xAxisKey,
|
|
67
69
|
yAxisKey
|
|
68
70
|
} = series[seriesId];
|
|
69
|
-
const xScale = xAxis[xAxisKey ?? defaultXAxisId].scale;
|
|
70
|
-
const yScale = yAxis[yAxisKey ?? defaultYAxisId].scale;
|
|
71
|
+
const xScale = xAxis[xAxisId ?? xAxisKey ?? defaultXAxisId].scale;
|
|
72
|
+
const yScale = yAxis[yAxisId ?? yAxisKey ?? defaultYAxisId].scale;
|
|
71
73
|
const getXPosition = getValueToPositionMapper(xScale);
|
|
72
74
|
const getYPosition = getValueToPositionMapper(yScale);
|
|
73
75
|
const seriesPoints = data.flatMap(({
|
|
@@ -3,8 +3,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
const _excluded = ["scale", "tickNumber", "reverse"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
7
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
8
8
|
import { useThemeProps, useTheme } from '@mui/material/styles';
|
|
9
9
|
import { useCartesianContext } from '../context/CartesianProvider';
|
|
10
10
|
import { useTicks } from '../hooks/useTicks';
|
|
@@ -3,8 +3,8 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["scale", "tickNumber"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
7
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
8
8
|
import { useThemeProps, useTheme } from '@mui/material/styles';
|
|
9
9
|
import { useCartesianContext } from '../context/CartesianProvider';
|
|
10
10
|
import { useTicks } from '../hooks/useTicks';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { arc as d3Arc } from 'd3-shape';
|
|
3
|
+
import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
import { useGaugeState } from './GaugeProvider';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { arc as d3Arc } from 'd3-shape';
|
|
3
|
+
import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
import { useGaugeState } from './GaugeProvider';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -4,8 +4,8 @@ const _excluded = ["d", "skipAnimation", "ownerState"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
7
|
-
import { color as d3Color } from 'd3-color';
|
|
8
7
|
import { animated, useSpring } from '@react-spring/web';
|
|
8
|
+
import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
|
|
9
9
|
import { useAnimatedPath } from '../internals/useAnimatedPath';
|
|
10
10
|
import { cleanId } from '../internals/cleanId';
|
|
11
11
|
import { useChartId, useDrawingArea } from '../hooks';
|
|
@@ -4,7 +4,7 @@ const _excluded = ["d", "skipAnimation", "ownerState"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { animated, useSpring } from '@react-spring/web';
|
|
7
|
-
import { color as d3Color } from 'd3-color';
|
|
7
|
+
import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
9
|
import { useAnimatedPath } from '../internals/useAnimatedPath';
|
|
10
10
|
import { cleanId } from '../internals/cleanId';
|
|
@@ -4,7 +4,7 @@ const _excluded = ["id", "classes", "color", "gradientId", "slots", "slotProps",
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
-
import
|
|
7
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
8
8
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
9
9
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
10
10
|
import { useInteractionItemProps } from '../hooks/useInteractionItemProps';
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
const _excluded = ["slots", "slotProps", "onItemClick", "skipAnimation"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { area as d3Area } from 'd3-shape';
|
|
6
|
+
import { area as d3Area } from '@mui/x-charts-vendor/d3-shape';
|
|
7
7
|
import { useCartesianContext } from '../context/CartesianProvider';
|
|
8
8
|
import { AreaElement } from './AreaElement';
|
|
9
9
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
@@ -36,22 +36,26 @@ const useAggregatedData = () => {
|
|
|
36
36
|
return [...groupIds].reverse() // Revert stacked area for a more pleasant animation
|
|
37
37
|
.map(seriesId => {
|
|
38
38
|
const {
|
|
39
|
+
xAxisId: xAxisIdProp,
|
|
40
|
+
yAxisId: yAxisIdProp,
|
|
39
41
|
xAxisKey = defaultXAxisId,
|
|
40
42
|
yAxisKey = defaultYAxisId,
|
|
41
43
|
stackedData,
|
|
42
44
|
data,
|
|
43
45
|
connectNulls
|
|
44
46
|
} = series[seriesId];
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
47
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
48
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
49
|
+
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
50
|
+
const yScale = yAxis[yAxisId].scale;
|
|
51
|
+
const xData = xAxis[xAxisId].data;
|
|
52
|
+
const gradientUsed = yAxis[yAxisId].colorScale && [yAxisId, 'y'] || xAxis[xAxisId].colorScale && [xAxisId, 'x'] || undefined;
|
|
49
53
|
if (process.env.NODE_ENV !== 'production') {
|
|
50
54
|
if (xData === undefined) {
|
|
51
|
-
throw new Error(`MUI X
|
|
55
|
+
throw new Error(`MUI X: ${xAxisId === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
52
56
|
}
|
|
53
57
|
if (xData.length < stackedData.length) {
|
|
54
|
-
throw new Error(`MUI X
|
|
58
|
+
throw new Error(`MUI X: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
const areaPath = d3Area().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => {
|
|
@@ -49,7 +49,10 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
49
49
|
}, chartContainerProps, {
|
|
50
50
|
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), props.grid && /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
51
51
|
children: [/*#__PURE__*/_jsx(AreaPlot, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlot, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
52
|
-
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(
|
|
52
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
53
|
+
"data-drawing-container": true,
|
|
54
|
+
children: /*#__PURE__*/_jsx(MarkPlot, _extends({}, markPlotProps))
|
|
55
|
+
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
53
56
|
}));
|
|
54
57
|
});
|
|
55
58
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
@@ -237,7 +240,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
237
240
|
* An array of [[AxisConfig]] objects.
|
|
238
241
|
*/
|
|
239
242
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
240
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
241
243
|
classes: PropTypes.object,
|
|
242
244
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
243
245
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -290,7 +292,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
290
292
|
* An array of [[AxisConfig]] objects.
|
|
291
293
|
*/
|
|
292
294
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
293
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
294
295
|
classes: PropTypes.object,
|
|
295
296
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
296
297
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -4,7 +4,7 @@ const _excluded = ["id", "classes", "color", "gradientId", "slots", "slotProps",
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
-
import
|
|
7
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
8
8
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
9
9
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
10
10
|
import { useInteractionItemProps } from '../hooks/useInteractionItemProps';
|
|
@@ -60,20 +60,24 @@ function LineHighlightPlot(props) {
|
|
|
60
60
|
}) => {
|
|
61
61
|
return groupIds.flatMap(seriesId => {
|
|
62
62
|
const {
|
|
63
|
+
xAxisId: xAxisIdProp,
|
|
64
|
+
yAxisId: yAxisIdProp,
|
|
63
65
|
xAxisKey = defaultXAxisId,
|
|
64
66
|
yAxisKey = defaultYAxisId,
|
|
65
67
|
stackedData,
|
|
66
68
|
data,
|
|
67
69
|
disableHighlight
|
|
68
70
|
} = series[seriesId];
|
|
71
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
72
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
69
73
|
if (disableHighlight || data[highlightedIndex] == null) {
|
|
70
74
|
return null;
|
|
71
75
|
}
|
|
72
|
-
const xScale = getValueToPositionMapper(xAxis[
|
|
73
|
-
const yScale = yAxis[
|
|
74
|
-
const xData = xAxis[
|
|
76
|
+
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
77
|
+
const yScale = yAxis[yAxisId].scale;
|
|
78
|
+
const xData = xAxis[xAxisId].data;
|
|
75
79
|
if (xData === undefined) {
|
|
76
|
-
throw new Error(`MUI X
|
|
80
|
+
throw new Error(`MUI X: ${xAxisId === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
77
81
|
}
|
|
78
82
|
const x = xScale(xData[highlightedIndex]);
|
|
79
83
|
const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
|
|
@@ -84,7 +88,7 @@ function LineHighlightPlot(props) {
|
|
|
84
88
|
})) {
|
|
85
89
|
return null;
|
|
86
90
|
}
|
|
87
|
-
const colorGetter = getColor(series[seriesId], xAxis[
|
|
91
|
+
const colorGetter = getColor(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
88
92
|
return /*#__PURE__*/_jsx(Element, _extends({
|
|
89
93
|
id: seriesId,
|
|
90
94
|
color: colorGetter(highlightedIndex),
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { line as d3Line } from 'd3-shape';
|
|
6
|
+
import { line as d3Line } from '@mui/x-charts-vendor/d3-shape';
|
|
7
7
|
import { useCartesianContext } from '../context/CartesianProvider';
|
|
8
8
|
import { LineElement } from './LineElement';
|
|
9
9
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
@@ -35,22 +35,26 @@ const useAggregatedData = () => {
|
|
|
35
35
|
}) => {
|
|
36
36
|
return groupIds.flatMap(seriesId => {
|
|
37
37
|
const {
|
|
38
|
+
xAxisId: xAxisIdProp,
|
|
39
|
+
yAxisId: yAxisIdProp,
|
|
38
40
|
xAxisKey = defaultXAxisId,
|
|
39
41
|
yAxisKey = defaultYAxisId,
|
|
40
42
|
stackedData,
|
|
41
43
|
data,
|
|
42
44
|
connectNulls
|
|
43
45
|
} = series[seriesId];
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
46
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
47
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
48
|
+
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
49
|
+
const yScale = yAxis[yAxisId].scale;
|
|
50
|
+
const xData = xAxis[xAxisId].data;
|
|
51
|
+
const gradientUsed = yAxis[yAxisId].colorScale && [yAxisId, 'y'] || xAxis[xAxisId].colorScale && [xAxisId, 'x'] || undefined;
|
|
48
52
|
if (process.env.NODE_ENV !== 'production') {
|
|
49
53
|
if (xData === undefined) {
|
|
50
|
-
throw new Error(`MUI X
|
|
54
|
+
throw new Error(`MUI X: ${xAxisId === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
51
55
|
}
|
|
52
56
|
if (xData.length < stackedData.length) {
|
|
53
|
-
throw new Error(`MUI X
|
|
57
|
+
throw new Error(`MUI X: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
const linePath = d3Line().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y(d => yScale(d.y[1]));
|
|
@@ -7,7 +7,7 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
7
7
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
9
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
10
|
-
import { symbol as d3Symbol, symbolsFill as d3SymbolsFill } from 'd3-shape';
|
|
10
|
+
import { symbol as d3Symbol, symbolsFill as d3SymbolsFill } from '@mui/x-charts-vendor/d3-shape';
|
|
11
11
|
import { animated, to, useSpring } from '@react-spring/web';
|
|
12
12
|
import { getSymbol } from '../internals/getSymbol';
|
|
13
13
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
@@ -57,6 +57,8 @@ function MarkPlot(props) {
|
|
|
57
57
|
}) => {
|
|
58
58
|
return groupIds.map(seriesId => {
|
|
59
59
|
const {
|
|
60
|
+
xAxisId: xAxisIdProp,
|
|
61
|
+
yAxisId: yAxisIdProp,
|
|
60
62
|
xAxisKey = defaultXAxisId,
|
|
61
63
|
yAxisKey = defaultYAxisId,
|
|
62
64
|
stackedData,
|
|
@@ -66,15 +68,17 @@ function MarkPlot(props) {
|
|
|
66
68
|
if (showMark === false) {
|
|
67
69
|
return null;
|
|
68
70
|
}
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
71
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
72
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
73
|
+
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
74
|
+
const yScale = yAxis[yAxisId].scale;
|
|
75
|
+
const xData = xAxis[xAxisId].data;
|
|
72
76
|
if (xData === undefined) {
|
|
73
|
-
throw new Error(`MUI X
|
|
77
|
+
throw new Error(`MUI X: ${xAxisId === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
74
78
|
}
|
|
75
79
|
const clipId = cleanId(`${chartId}-${seriesId}-line-clip`); // We assume that if displaying line mark, the line will also be rendered
|
|
76
80
|
|
|
77
|
-
const colorGetter = getColor(series[seriesId], xAxis[
|
|
81
|
+
const colorGetter = getColor(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
78
82
|
return /*#__PURE__*/_jsx("g", {
|
|
79
83
|
clipPath: `url(#${clipId})`,
|
|
80
84
|
children: xData?.map((x, index) => {
|
|
@@ -24,7 +24,10 @@ export const getExtremumY = params => {
|
|
|
24
24
|
axis,
|
|
25
25
|
isDefaultAxis
|
|
26
26
|
} = params;
|
|
27
|
-
return Object.keys(series).filter(seriesId =>
|
|
27
|
+
return Object.keys(series).filter(seriesId => {
|
|
28
|
+
const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey;
|
|
29
|
+
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
30
|
+
}).reduce((acc, seriesId) => {
|
|
28
31
|
const {
|
|
29
32
|
area,
|
|
30
33
|
stackedData
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { stack as d3Stack } from 'd3-shape';
|
|
2
|
+
import { stack as d3Stack } from '@mui/x-charts-vendor/d3-shape';
|
|
3
3
|
import { getStackingGroups } from '../internals/stackSeries';
|
|
4
4
|
import { defaultizeValueFormatter } from '../internals/defaultizeValueFormatter';
|
|
5
5
|
let warnedOnce = false;
|
|
@@ -31,7 +31,7 @@ const formatter = (params, dataset) => {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
} else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
|
|
34
|
-
throw new Error([`MUI X
|
|
34
|
+
throw new Error([`MUI X: line series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
const completedSeries = {};
|
|
@@ -56,7 +56,7 @@ const formatter = (params, dataset) => {
|
|
|
56
56
|
if (typeof value !== 'number') {
|
|
57
57
|
if (process.env.NODE_ENV !== 'production' && !warnedOnce && value !== null) {
|
|
58
58
|
warnedOnce = true;
|
|
59
|
-
console.error([`MUI X
|
|
59
|
+
console.error([`MUI X: Your dataset key "${dataKey}" is used for plotting line, but contains nonnumerical elements.`, 'Line plots only support numbers and null values.']);
|
|
60
60
|
}
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "id", "innerRadius", "isFaded", "isHighlighted", "onClick", "outerRadius", "paddingAngle", "startAngle", "highlightScope"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { arc as d3Arc } from 'd3-shape';
|
|
6
|
+
import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
|
|
7
7
|
import { animated, to } from '@react-spring/web';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
9
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
@@ -73,6 +73,7 @@ function PieArc(props) {
|
|
|
73
73
|
innerRadius: iR,
|
|
74
74
|
outerRadius: oR
|
|
75
75
|
})),
|
|
76
|
+
visibility: to([startAngle, endAngle], (sA, eA) => sA === eA ? 'hidden' : 'visible'),
|
|
76
77
|
onClick: onClick,
|
|
77
78
|
cursor: onClick ? 'pointer' : 'unset',
|
|
78
79
|
ownerState: ownerState,
|
|
@@ -4,7 +4,7 @@ const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingA
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { animated, to } from '@react-spring/web';
|
|
7
|
-
import { arc as d3Arc } from 'd3-shape';
|
|
7
|
+
import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
9
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
10
10
|
import { styled } from '@mui/material/styles';
|
|
@@ -284,7 +284,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
284
284
|
* An array of [[AxisConfig]] objects.
|
|
285
285
|
*/
|
|
286
286
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
287
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
288
287
|
classes: PropTypes.object,
|
|
289
288
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
290
289
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -337,7 +336,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
337
336
|
* An array of [[AxisConfig]] objects.
|
|
338
337
|
*/
|
|
339
338
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
340
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
341
339
|
classes: PropTypes.object,
|
|
342
340
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
343
341
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { pie as d3Pie } from 'd3-shape';
|
|
2
|
+
import { pie as d3Pie } from '@mui/x-charts-vendor/d3-shape';
|
|
3
3
|
import { getLabel } from '../internals/getLabel';
|
|
4
4
|
const getSortingComparator = (comparator = 'none') => {
|
|
5
5
|
if (typeof comparator === 'function') {
|
|
@@ -96,7 +96,6 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
96
96
|
* An array of [[AxisConfig]] objects.
|
|
97
97
|
*/
|
|
98
98
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
99
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
100
99
|
classes: PropTypes.object,
|
|
101
100
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
102
101
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -149,7 +148,6 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
149
148
|
* An array of [[AxisConfig]] objects.
|
|
150
149
|
*/
|
|
151
150
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
152
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
153
151
|
classes: PropTypes.object,
|
|
154
152
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
155
153
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -54,11 +54,11 @@ export const useChartContainerDimensions = (inWidth, inHeight) => {
|
|
|
54
54
|
}, [computeSize, inHeight, inWidth]);
|
|
55
55
|
if (process.env.NODE_ENV !== 'production') {
|
|
56
56
|
if (displayError.current && inWidth === undefined && width === 0) {
|
|
57
|
-
console.error(`MUI X
|
|
57
|
+
console.error(`MUI X: ChartContainer does not have \`width\` prop, and its container has no \`width\` defined.`);
|
|
58
58
|
displayError.current = false;
|
|
59
59
|
}
|
|
60
60
|
if (displayError.current && inHeight === undefined && height === 0) {
|
|
61
|
-
console.error(`MUI X
|
|
61
|
+
console.error(`MUI X: ChartContainer does not have \`height\` prop, and its container has no \`height\` defined.`);
|
|
62
62
|
displayError.current = false;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -41,7 +41,10 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props,
|
|
|
41
41
|
ref: ref
|
|
42
42
|
}, chartContainerProps, {
|
|
43
43
|
children: /*#__PURE__*/_jsxs(ZAxisContextProvider, _extends({}, zAxisProps, {
|
|
44
|
-
children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), props.grid && /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx(
|
|
44
|
+
children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), props.grid && /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
|
45
|
+
"data-drawing-container": true,
|
|
46
|
+
children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
|
|
47
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), children]
|
|
45
48
|
}))
|
|
46
49
|
}));
|
|
47
50
|
});
|
|
@@ -218,7 +221,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
218
221
|
* An array of [[AxisConfig]] objects.
|
|
219
222
|
*/
|
|
220
223
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
221
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
222
224
|
classes: PropTypes.object,
|
|
223
225
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
224
226
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -271,7 +273,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
271
273
|
* An array of [[AxisConfig]] objects.
|
|
272
274
|
*/
|
|
273
275
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
274
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
275
276
|
classes: PropTypes.object,
|
|
276
277
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
277
278
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -53,12 +53,15 @@ function ScatterPlot(props) {
|
|
|
53
53
|
xAxisKey,
|
|
54
54
|
yAxisKey,
|
|
55
55
|
zAxisKey,
|
|
56
|
+
xAxisId,
|
|
57
|
+
yAxisId,
|
|
58
|
+
zAxisId,
|
|
56
59
|
markerSize,
|
|
57
60
|
color
|
|
58
61
|
} = series[seriesId];
|
|
59
|
-
const colorGetter = getColor(series[seriesId], xAxis[xAxisKey ?? defaultXAxisId], yAxis[yAxisKey ?? defaultYAxisId], zAxis[zAxisKey ?? defaultZAxisId]);
|
|
60
|
-
const xScale = xAxis[xAxisKey ?? defaultXAxisId].scale;
|
|
61
|
-
const yScale = yAxis[yAxisKey ?? defaultYAxisId].scale;
|
|
62
|
+
const colorGetter = getColor(series[seriesId], xAxis[xAxisId ?? xAxisKey ?? defaultXAxisId], yAxis[yAxisId ?? yAxisKey ?? defaultYAxisId], zAxis[zAxisId ?? zAxisKey ?? defaultZAxisId]);
|
|
63
|
+
const xScale = xAxis[xAxisId ?? xAxisKey ?? defaultXAxisId].scale;
|
|
64
|
+
const yScale = yAxis[yAxisId ?? yAxisKey ?? defaultYAxisId].scale;
|
|
62
65
|
return /*#__PURE__*/_jsx(ScatterItems, _extends({
|
|
63
66
|
xScale: xScale,
|
|
64
67
|
yScale: yScale,
|