@mui/x-charts 6.18.2 → 6.18.4
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/BarElement.d.ts +5 -1
- package/BarChart/BarElement.js +24 -1
- package/BarChart/BarPlot.js +7 -6
- package/BarChart/formatter.js +15 -3
- package/BarChart/index.d.ts +3 -2
- package/BarChart/index.js +31 -12
- package/CHANGELOG.md +192 -1
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsLegend/ChartsLegend.d.ts +1 -1
- package/ChartsLegend/ChartsLegend.js +3 -2
- package/ChartsLegend/index.d.ts +1 -0
- package/ChartsLegend/index.js +11 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/ChartsReferenceLine/common.d.ts +1 -1
- package/ChartsText/ChartsText.d.ts +17 -0
- package/{internals/components → ChartsText}/ChartsText.js +32 -17
- package/ChartsText/index.d.ts +3 -0
- package/ChartsText/index.js +12 -0
- package/ChartsText/package.json +6 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +5 -2
- package/ChartsTooltip/ChartsAxisTooltipContent.js +93 -73
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -2
- package/ChartsTooltip/ChartsItemTooltipContent.js +38 -57
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +7 -0
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +174 -0
- package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +8 -0
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +99 -0
- package/ChartsTooltip/index.d.ts +4 -0
- package/ChartsTooltip/index.js +44 -0
- package/ChartsXAxis/ChartsXAxis.js +3 -2
- package/ChartsYAxis/ChartsYAxis.js +7 -5
- package/LineChart/AreaPlot.js +3 -2
- package/LineChart/LineHighlightPlot.js +2 -1
- package/LineChart/LinePlot.js +3 -2
- package/LineChart/MarkPlot.js +2 -1
- package/LineChart/extremums.js +25 -8
- package/LineChart/formatter.js +14 -2
- package/LineChart/index.d.ts +5 -5
- package/LineChart/index.js +50 -41
- package/PieChart/PieArcLabelPlot.d.ts +7 -4
- package/PieChart/PieArcLabelPlot.js +88 -1
- package/PieChart/PieArcPlot.d.ts +7 -4
- package/PieChart/PieArcPlot.js +87 -1
- package/PieChart/PieChart.js +4 -4
- package/PieChart/PiePlot.js +20 -15
- package/PieChart/dataTransform/useTransformData.d.ts +2 -3
- package/PieChart/index.d.ts +6 -6
- package/PieChart/index.js +60 -46
- package/ResponsiveChartContainer/index.js +2 -2
- package/ScatterChart/Scatter.js +1 -1
- package/ScatterChart/index.d.ts +3 -3
- package/ScatterChart/index.js +31 -19
- package/context/CartesianContextProvider.js +2 -2
- package/context/SeriesContextProvider.js +1 -1
- package/esm/BarChart/BarElement.js +26 -2
- package/esm/BarChart/BarPlot.js +7 -5
- package/esm/BarChart/formatter.js +20 -4
- package/esm/BarChart/index.js +3 -2
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsLegend/ChartsLegend.js +2 -1
- package/esm/ChartsLegend/index.js +2 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/esm/{internals/components → ChartsText}/ChartsText.js +33 -16
- package/esm/ChartsText/index.js +1 -0
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +95 -75
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +40 -58
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +168 -0
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +92 -0
- package/esm/ChartsTooltip/index.js +5 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +7 -5
- package/esm/LineChart/AreaPlot.js +3 -2
- package/esm/LineChart/LineHighlightPlot.js +2 -1
- package/esm/LineChart/LinePlot.js +3 -2
- package/esm/LineChart/MarkPlot.js +2 -1
- package/esm/LineChart/extremums.js +25 -8
- package/esm/LineChart/formatter.js +16 -3
- package/esm/LineChart/index.js +5 -5
- package/esm/PieChart/PieArcLabelPlot.js +90 -2
- package/esm/PieChart/PieArcPlot.js +89 -2
- package/esm/PieChart/PieChart.js +4 -4
- package/esm/PieChart/PiePlot.js +20 -15
- package/esm/PieChart/index.js +6 -4
- package/esm/ResponsiveChartContainer/index.js +2 -2
- package/esm/ScatterChart/Scatter.js +1 -1
- package/esm/ScatterChart/index.js +3 -3
- package/esm/context/CartesianContextProvider.js +2 -2
- package/esm/context/SeriesContextProvider.js +1 -1
- package/esm/index.js +1 -0
- package/esm/internals/defaultizeValueFormatter.js +4 -3
- package/esm/internals/getWordsByLines.js +14 -0
- package/esm/internals/utils.js +40 -0
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/defaultizeColor.d.ts +4 -4
- package/internals/defaultizeValueFormatter.d.ts +3 -1
- package/internals/defaultizeValueFormatter.js +3 -3
- package/internals/{components/ChartsText.d.ts → getWordsByLines.d.ts} +2 -11
- package/internals/getWordsByLines.js +21 -0
- package/internals/utils.d.ts +13 -0
- package/internals/utils.js +42 -0
- package/legacy/BarChart/BarElement.js +26 -2
- package/legacy/BarChart/BarPlot.js +7 -5
- package/legacy/BarChart/formatter.js +23 -9
- package/legacy/BarChart/index.js +3 -2
- package/legacy/ChartsAxis/ChartsAxis.js +4 -4
- package/legacy/ChartsLegend/ChartsLegend.js +2 -1
- package/legacy/ChartsLegend/index.js +2 -1
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/legacy/{internals/components → ChartsText}/ChartsText.js +38 -22
- package/legacy/ChartsText/index.js +1 -0
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +95 -74
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +40 -55
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +167 -0
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +89 -0
- package/legacy/ChartsTooltip/index.js +5 -1
- package/legacy/ChartsXAxis/ChartsXAxis.js +2 -1
- package/legacy/ChartsYAxis/ChartsYAxis.js +7 -5
- package/legacy/LineChart/AreaPlot.js +3 -2
- package/legacy/LineChart/LineHighlightPlot.js +2 -1
- package/legacy/LineChart/LinePlot.js +3 -2
- package/legacy/LineChart/MarkPlot.js +2 -1
- package/legacy/LineChart/extremums.js +29 -14
- package/legacy/LineChart/formatter.js +19 -8
- package/legacy/LineChart/index.js +5 -5
- package/legacy/PieChart/PieArcLabelPlot.js +90 -2
- package/legacy/PieChart/PieArcPlot.js +89 -2
- package/legacy/PieChart/PieChart.js +4 -4
- package/legacy/PieChart/PiePlot.js +20 -15
- package/legacy/PieChart/index.js +6 -4
- package/legacy/ResponsiveChartContainer/index.js +2 -2
- package/legacy/ScatterChart/Scatter.js +1 -1
- package/legacy/ScatterChart/index.js +3 -3
- package/legacy/context/CartesianContextProvider.js +2 -2
- package/legacy/context/SeriesContextProvider.js +1 -1
- package/legacy/index.js +2 -1
- package/legacy/internals/defaultizeValueFormatter.js +4 -3
- package/legacy/internals/getWordsByLines.js +15 -0
- package/legacy/internals/utils.js +40 -0
- package/models/axis.d.ts +1 -1
- package/models/seriesType/config.d.ts +9 -4
- package/models/seriesType/pie.d.ts +29 -7
- package/models/seriesType/scatter.d.ts +1 -1
- package/modern/BarChart/BarElement.js +26 -2
- package/modern/BarChart/BarPlot.js +7 -5
- package/modern/BarChart/formatter.js +15 -3
- package/modern/BarChart/index.js +3 -2
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsLegend/ChartsLegend.js +2 -1
- package/modern/ChartsLegend/index.js +2 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/modern/{internals/components → ChartsText}/ChartsText.js +33 -16
- package/modern/ChartsText/index.js +1 -0
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +95 -74
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +40 -58
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +167 -0
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +92 -0
- package/modern/ChartsTooltip/index.js +5 -1
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -1
- package/modern/ChartsYAxis/ChartsYAxis.js +7 -5
- package/modern/LineChart/AreaPlot.js +3 -2
- package/modern/LineChart/LineHighlightPlot.js +2 -1
- package/modern/LineChart/LinePlot.js +3 -2
- package/modern/LineChart/MarkPlot.js +2 -1
- package/modern/LineChart/extremums.js +25 -8
- package/modern/LineChart/formatter.js +14 -2
- package/modern/LineChart/index.js +5 -5
- package/modern/PieChart/PieArcLabelPlot.js +90 -2
- package/modern/PieChart/PieArcPlot.js +89 -2
- package/modern/PieChart/PieChart.js +4 -4
- package/modern/PieChart/PiePlot.js +20 -15
- package/modern/PieChart/index.js +6 -4
- package/modern/ResponsiveChartContainer/index.js +2 -2
- package/modern/ScatterChart/Scatter.js +1 -1
- package/modern/ScatterChart/index.js +3 -3
- package/modern/context/CartesianContextProvider.js +2 -2
- package/modern/context/SeriesContextProvider.js +1 -1
- package/modern/index.js +2 -1
- package/modern/internals/defaultizeValueFormatter.js +3 -3
- package/modern/internals/getWordsByLines.js +14 -0
- package/modern/internals/utils.js +40 -0
- package/package.json +1 -1
|
@@ -11,9 +11,10 @@ import { DrawingContext } from '../context/DrawingProvider';
|
|
|
11
11
|
import useTicks from '../hooks/useTicks';
|
|
12
12
|
import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
|
|
13
13
|
import { AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
14
|
-
import { ChartsText
|
|
14
|
+
import { ChartsText } from '../ChartsText';
|
|
15
15
|
import { getMinXTranslation } from '../internals/geometry';
|
|
16
16
|
import { useMounted } from '../hooks/useMounted';
|
|
17
|
+
import { getWordsByLines } from '../internals/getWordsByLines';
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
20
|
const useUtilityClasses = ownerState => {
|
|
@@ -10,7 +10,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
10
10
|
import { DrawingContext } from '../context/DrawingProvider';
|
|
11
11
|
import useTicks from '../hooks/useTicks';
|
|
12
12
|
import { AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
13
|
-
import { ChartsText } from '../
|
|
13
|
+
import { ChartsText } from '../ChartsText';
|
|
14
14
|
import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -75,6 +75,8 @@ function ChartsYAxis(inProps) {
|
|
|
75
75
|
tickFontSize,
|
|
76
76
|
label,
|
|
77
77
|
labelFontSize,
|
|
78
|
+
labelStyle,
|
|
79
|
+
tickLabelStyle,
|
|
78
80
|
tickSize: tickSizeProp,
|
|
79
81
|
valueFormatter,
|
|
80
82
|
slots,
|
|
@@ -109,11 +111,11 @@ function ChartsYAxis(inProps) {
|
|
|
109
111
|
elementType: TickLabel,
|
|
110
112
|
externalSlotProps: slotProps == null ? void 0 : slotProps.axisTickLabel,
|
|
111
113
|
additionalProps: {
|
|
112
|
-
style: {
|
|
114
|
+
style: _extends({
|
|
113
115
|
fontSize: tickFontSize,
|
|
114
116
|
textAnchor: position === 'right' ? 'start' : 'end',
|
|
115
117
|
dominantBaseline: 'central'
|
|
116
|
-
},
|
|
118
|
+
}, tickLabelStyle),
|
|
117
119
|
className: classes.tickLabel
|
|
118
120
|
},
|
|
119
121
|
ownerState: {}
|
|
@@ -122,12 +124,12 @@ function ChartsYAxis(inProps) {
|
|
|
122
124
|
elementType: Label,
|
|
123
125
|
externalSlotProps: slotProps == null ? void 0 : slotProps.axisLabel,
|
|
124
126
|
additionalProps: {
|
|
125
|
-
style: {
|
|
127
|
+
style: _extends({
|
|
126
128
|
fontSize: labelFontSize,
|
|
127
129
|
angle: positionSign * 90,
|
|
128
130
|
textAnchor: 'middle',
|
|
129
131
|
dominantBaseline: 'auto'
|
|
130
|
-
}
|
|
132
|
+
}, labelStyle)
|
|
131
133
|
},
|
|
132
134
|
ownerState: {}
|
|
133
135
|
});
|
|
@@ -9,6 +9,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
9
9
|
import { AreaElement } from './AreaElement';
|
|
10
10
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
11
11
|
import getCurveFactory from '../internals/getCurve';
|
|
12
|
+
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
/**
|
|
14
15
|
* Demos:
|
|
@@ -62,10 +63,10 @@ function AreaPlot(props) {
|
|
|
62
63
|
const xData = xAxis[xAxisKey].data;
|
|
63
64
|
if (process.env.NODE_ENV !== 'production') {
|
|
64
65
|
if (xData === undefined) {
|
|
65
|
-
throw new Error(`
|
|
66
|
+
throw new Error(`MUI-X-Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
|
|
66
67
|
}
|
|
67
68
|
if (xData.length < stackedData.length) {
|
|
68
|
-
throw new Error(`MUI: data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items)`);
|
|
69
|
+
throw new Error(`MUI-X-Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items)`);
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
const areaPath = d3Area().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => d.y && yScale(d.y[0])).y1(d => d.y && yScale(d.y[1]));
|
|
@@ -8,6 +8,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
8
8
|
import { LineHighlightElement } from './LineHighlightElement';
|
|
9
9
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
10
10
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
11
|
+
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
/**
|
|
13
14
|
* Demos:
|
|
@@ -70,7 +71,7 @@ function LineHighlightPlot(props) {
|
|
|
70
71
|
const yScale = yAxis[yAxisKey].scale;
|
|
71
72
|
const xData = xAxis[xAxisKey].data;
|
|
72
73
|
if (xData === undefined) {
|
|
73
|
-
throw new Error(`
|
|
74
|
+
throw new Error(`MUI-X-Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
|
|
74
75
|
}
|
|
75
76
|
const x = xScale(xData[highlightedIndex]);
|
|
76
77
|
const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
|
|
@@ -9,6 +9,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
9
9
|
import { LineElement } from './LineElement';
|
|
10
10
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
11
11
|
import getCurveFactory from '../internals/getCurve';
|
|
12
|
+
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
/**
|
|
14
15
|
* Demos:
|
|
@@ -61,10 +62,10 @@ function LinePlot(props) {
|
|
|
61
62
|
const xData = xAxis[xAxisKey].data;
|
|
62
63
|
if (process.env.NODE_ENV !== 'production') {
|
|
63
64
|
if (xData === undefined) {
|
|
64
|
-
throw new Error(`
|
|
65
|
+
throw new Error(`MUI-X-Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot`);
|
|
65
66
|
}
|
|
66
67
|
if (xData.length < stackedData.length) {
|
|
67
|
-
throw new Error(`MUI: data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items)`);
|
|
68
|
+
throw new Error(`MUI-X-Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items)`);
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
const linePath = d3Line().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y(d => yScale(d.y[1]));
|
|
@@ -7,6 +7,7 @@ import { SeriesContext } from '../context/SeriesContextProvider';
|
|
|
7
7
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
8
8
|
import { MarkElement } from './MarkElement';
|
|
9
9
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
10
|
+
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
/**
|
|
12
13
|
* Demos:
|
|
@@ -76,7 +77,7 @@ function MarkPlot(props) {
|
|
|
76
77
|
return true;
|
|
77
78
|
};
|
|
78
79
|
if (xData === undefined) {
|
|
79
|
-
throw new Error(`
|
|
80
|
+
throw new Error(`MUI-X-Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot`);
|
|
80
81
|
}
|
|
81
82
|
return xData == null ? void 0 : xData.map((x, index) => {
|
|
82
83
|
const value = data[index] == null ? null : stackedData[index][1];
|
|
@@ -7,6 +7,18 @@ export const getExtremumX = params => {
|
|
|
7
7
|
const maxX = Math.max(...((_axis$data2 = axis.data) != null ? _axis$data2 : []));
|
|
8
8
|
return [minX, maxX];
|
|
9
9
|
};
|
|
10
|
+
function getSeriesExtremums(getValues, stackedData) {
|
|
11
|
+
if (stackedData.length === 0) {
|
|
12
|
+
return [null, null];
|
|
13
|
+
}
|
|
14
|
+
return stackedData.reduce((seriesAcc, stackedValue) => {
|
|
15
|
+
const [base, value] = getValues(stackedValue);
|
|
16
|
+
if (seriesAcc[0] === null) {
|
|
17
|
+
return [Math.min(base, value), Math.max(base, value)];
|
|
18
|
+
}
|
|
19
|
+
return [Math.min(base, value, seriesAcc[0]), Math.max(base, value, seriesAcc[1])];
|
|
20
|
+
}, getValues(stackedData[0]));
|
|
21
|
+
}
|
|
10
22
|
export const getExtremumY = params => {
|
|
11
23
|
const {
|
|
12
24
|
series,
|
|
@@ -14,16 +26,21 @@ export const getExtremumY = params => {
|
|
|
14
26
|
isDefaultAxis
|
|
15
27
|
} = params;
|
|
16
28
|
return Object.keys(series).filter(seriesId => series[seriesId].yAxisKey === axis.id || isDefaultAxis && series[seriesId].yAxisKey === undefined).reduce((acc, seriesId) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
29
|
+
const {
|
|
30
|
+
area,
|
|
31
|
+
stackedData
|
|
32
|
+
} = series[seriesId];
|
|
33
|
+
const isArea = area !== undefined;
|
|
34
|
+
const getValues = isArea ? d => d : d => [d[1], d[1]]; // Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
19
35
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
if (
|
|
25
|
-
return
|
|
36
|
+
const seriesExtremums = getSeriesExtremums(getValues, stackedData);
|
|
37
|
+
if (acc[0] === null) {
|
|
38
|
+
return seriesExtremums;
|
|
39
|
+
}
|
|
40
|
+
if (seriesExtremums[0] === null) {
|
|
41
|
+
return acc;
|
|
26
42
|
}
|
|
43
|
+
const [seriesMin, seriesMax] = seriesExtremums;
|
|
27
44
|
return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
|
|
28
45
|
}, [null, null]);
|
|
29
46
|
};
|
|
@@ -2,8 +2,11 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { stack as d3Stack } from 'd3-shape';
|
|
3
3
|
import { getStackingGroups } from '../internals/stackSeries';
|
|
4
4
|
import defaultizeValueFormatter from '../internals/defaultizeValueFormatter';
|
|
5
|
+
let warnedOnce = false;
|
|
6
|
+
|
|
5
7
|
// For now it's a copy past of bar charts formatter, but maybe will diverge later
|
|
6
8
|
const formatter = (params, dataset) => {
|
|
9
|
+
var _ref;
|
|
7
10
|
const {
|
|
8
11
|
seriesOrder,
|
|
9
12
|
series
|
|
@@ -11,7 +14,7 @@ const formatter = (params, dataset) => {
|
|
|
11
14
|
const stackingGroups = getStackingGroups(params);
|
|
12
15
|
|
|
13
16
|
// Create a data set with format adapted to d3
|
|
14
|
-
const d3Dataset = dataset != null ?
|
|
17
|
+
const d3Dataset = (_ref = dataset) != null ? _ref : [];
|
|
15
18
|
seriesOrder.forEach(id => {
|
|
16
19
|
const data = series[id].data;
|
|
17
20
|
if (data !== undefined) {
|
|
@@ -25,7 +28,7 @@ const formatter = (params, dataset) => {
|
|
|
25
28
|
}
|
|
26
29
|
});
|
|
27
30
|
} else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
|
|
28
|
-
throw new Error([`MUI: line series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
31
|
+
throw new Error([`MUI-X-Charts: line series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
29
32
|
}
|
|
30
33
|
});
|
|
31
34
|
const completedSeries = {};
|
|
@@ -48,7 +51,17 @@ const formatter = (params, dataset) => {
|
|
|
48
51
|
ids.forEach((id, index) => {
|
|
49
52
|
const dataKey = series[id].dataKey;
|
|
50
53
|
completedSeries[id] = _extends({}, series[id], {
|
|
51
|
-
data: dataKey ? dataset.map(
|
|
54
|
+
data: dataKey ? dataset.map(data => {
|
|
55
|
+
const value = data[dataKey];
|
|
56
|
+
if (typeof value !== 'number') {
|
|
57
|
+
if (process.env.NODE_ENV !== 'production' && !warnedOnce && value !== null) {
|
|
58
|
+
warnedOnce = true;
|
|
59
|
+
console.error([`MUI-X charts: your dataset key "${dataKey}" is used for plotting line, but contains nonnumerical elements.`, 'Line plots only support numbers and null values.']);
|
|
60
|
+
}
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
return value;
|
|
64
|
+
}) : series[id].data,
|
|
52
65
|
stackedData: stackedSeries[index].map(([a, b]) => [a, b])
|
|
53
66
|
});
|
|
54
67
|
});
|
package/esm/LineChart/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export * from './LineChart';
|
|
2
|
+
export * from './LinePlot';
|
|
3
|
+
export * from './AreaPlot';
|
|
4
|
+
export * from './MarkPlot';
|
|
5
|
+
export * from './LineHighlightPlot';
|
|
6
6
|
export * from './AreaElement';
|
|
7
7
|
export * from './LineElement';
|
|
8
8
|
export * from './MarkElement';
|
|
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
|
|
4
4
|
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
6
7
|
import { useTransition } from '@react-spring/web';
|
|
7
8
|
import { defaultLabelTransitionConfig } from './dataTransform/transition';
|
|
8
9
|
import { useTransformData } from './dataTransform/useTransformData';
|
|
@@ -23,7 +24,7 @@ function getItemLabel(arcLabel, arcLabelMinAngle, item) {
|
|
|
23
24
|
}
|
|
24
25
|
return arcLabel(item);
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
+
function PieArcLabelPlot(props) {
|
|
27
28
|
var _slots$pieArcLabel;
|
|
28
29
|
const {
|
|
29
30
|
slots,
|
|
@@ -89,4 +90,91 @@ export function PieArcLabelPlot(props) {
|
|
|
89
90
|
}, slotProps == null ? void 0 : slotProps.pieArcLabel));
|
|
90
91
|
})
|
|
91
92
|
}));
|
|
92
|
-
}
|
|
93
|
+
}
|
|
94
|
+
process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
95
|
+
// ----------------------------- Warning --------------------------------
|
|
96
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
97
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
98
|
+
// ----------------------------------------------------------------------
|
|
99
|
+
/**
|
|
100
|
+
* The label displayed into the arc.
|
|
101
|
+
*/
|
|
102
|
+
arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
|
|
103
|
+
/**
|
|
104
|
+
* The minimal angle required to display the arc label.
|
|
105
|
+
*/
|
|
106
|
+
arcLabelMinAngle: PropTypes.number,
|
|
107
|
+
/**
|
|
108
|
+
* The radius applied to arc corners (similar to border radius).
|
|
109
|
+
* @default 0
|
|
110
|
+
*/
|
|
111
|
+
cornerRadius: PropTypes.number,
|
|
112
|
+
data: PropTypes.arrayOf(PropTypes.shape({
|
|
113
|
+
color: PropTypes.string.isRequired,
|
|
114
|
+
endAngle: PropTypes.number.isRequired,
|
|
115
|
+
formattedValue: PropTypes.string.isRequired,
|
|
116
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
117
|
+
index: PropTypes.number.isRequired,
|
|
118
|
+
label: PropTypes.string,
|
|
119
|
+
padAngle: PropTypes.number.isRequired,
|
|
120
|
+
startAngle: PropTypes.number.isRequired,
|
|
121
|
+
value: PropTypes.number.isRequired
|
|
122
|
+
})).isRequired,
|
|
123
|
+
/**
|
|
124
|
+
* Override the arc attibutes when it is faded.
|
|
125
|
+
*/
|
|
126
|
+
faded: PropTypes.shape({
|
|
127
|
+
additionalRadius: PropTypes.number,
|
|
128
|
+
color: PropTypes.string,
|
|
129
|
+
cornerRadius: PropTypes.number,
|
|
130
|
+
innerRadius: PropTypes.number,
|
|
131
|
+
outerRadius: PropTypes.number,
|
|
132
|
+
paddingAngle: PropTypes.number
|
|
133
|
+
}),
|
|
134
|
+
/**
|
|
135
|
+
* Override the arc attibutes when it is highlighted.
|
|
136
|
+
*/
|
|
137
|
+
highlighted: PropTypes.shape({
|
|
138
|
+
additionalRadius: PropTypes.number,
|
|
139
|
+
color: PropTypes.string,
|
|
140
|
+
cornerRadius: PropTypes.number,
|
|
141
|
+
innerRadius: PropTypes.number,
|
|
142
|
+
outerRadius: PropTypes.number,
|
|
143
|
+
paddingAngle: PropTypes.number
|
|
144
|
+
}),
|
|
145
|
+
highlightScope: PropTypes.shape({
|
|
146
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
147
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
148
|
+
}),
|
|
149
|
+
id: PropTypes.string.isRequired,
|
|
150
|
+
/**
|
|
151
|
+
* The radius between circle center and the begining of the arc.
|
|
152
|
+
* @default 0
|
|
153
|
+
*/
|
|
154
|
+
innerRadius: PropTypes.number,
|
|
155
|
+
/**
|
|
156
|
+
* The radius between circle center and the end of the arc.
|
|
157
|
+
*/
|
|
158
|
+
outerRadius: PropTypes.number.isRequired,
|
|
159
|
+
/**
|
|
160
|
+
* The padding angle (deg) between two arcs.
|
|
161
|
+
* @default 0
|
|
162
|
+
*/
|
|
163
|
+
paddingAngle: PropTypes.number,
|
|
164
|
+
/**
|
|
165
|
+
* If `true`, animations are skiped.
|
|
166
|
+
* @default false
|
|
167
|
+
*/
|
|
168
|
+
skipAnimation: PropTypes.bool,
|
|
169
|
+
/**
|
|
170
|
+
* The props used for each component slot.
|
|
171
|
+
* @default {}
|
|
172
|
+
*/
|
|
173
|
+
slotProps: PropTypes.object,
|
|
174
|
+
/**
|
|
175
|
+
* Overridable component slots.
|
|
176
|
+
* @default {}
|
|
177
|
+
*/
|
|
178
|
+
slots: PropTypes.object
|
|
179
|
+
} : void 0;
|
|
180
|
+
export { PieArcLabelPlot };
|
|
@@ -3,12 +3,13 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "onClick", "skipAnimation"],
|
|
4
4
|
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
6
7
|
import { useTransition } from '@react-spring/web';
|
|
7
8
|
import { PieArc } from './PieArc';
|
|
8
9
|
import { defaultTransitionConfig } from './dataTransform/transition';
|
|
9
10
|
import { useTransformData } from './dataTransform/useTransformData';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
|
|
12
|
+
function PieArcPlot(props) {
|
|
12
13
|
var _slots$pieArc;
|
|
13
14
|
const {
|
|
14
15
|
slots,
|
|
@@ -81,4 +82,90 @@ export function PieArcPlot(props) {
|
|
|
81
82
|
}, slotProps == null ? void 0 : slotProps.pieArc));
|
|
82
83
|
})
|
|
83
84
|
}));
|
|
84
|
-
}
|
|
85
|
+
}
|
|
86
|
+
process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
87
|
+
// ----------------------------- Warning --------------------------------
|
|
88
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
89
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
90
|
+
// ----------------------------------------------------------------------
|
|
91
|
+
/**
|
|
92
|
+
* The radius applied to arc corners (similar to border radius).
|
|
93
|
+
* @default 0
|
|
94
|
+
*/
|
|
95
|
+
cornerRadius: PropTypes.number,
|
|
96
|
+
data: PropTypes.arrayOf(PropTypes.shape({
|
|
97
|
+
color: PropTypes.string.isRequired,
|
|
98
|
+
endAngle: PropTypes.number.isRequired,
|
|
99
|
+
formattedValue: PropTypes.string.isRequired,
|
|
100
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
101
|
+
index: PropTypes.number.isRequired,
|
|
102
|
+
label: PropTypes.string,
|
|
103
|
+
padAngle: PropTypes.number.isRequired,
|
|
104
|
+
startAngle: PropTypes.number.isRequired,
|
|
105
|
+
value: PropTypes.number.isRequired
|
|
106
|
+
})).isRequired,
|
|
107
|
+
/**
|
|
108
|
+
* Override the arc attibutes when it is faded.
|
|
109
|
+
*/
|
|
110
|
+
faded: PropTypes.shape({
|
|
111
|
+
additionalRadius: PropTypes.number,
|
|
112
|
+
color: PropTypes.string,
|
|
113
|
+
cornerRadius: PropTypes.number,
|
|
114
|
+
innerRadius: PropTypes.number,
|
|
115
|
+
outerRadius: PropTypes.number,
|
|
116
|
+
paddingAngle: PropTypes.number
|
|
117
|
+
}),
|
|
118
|
+
/**
|
|
119
|
+
* Override the arc attibutes when it is highlighted.
|
|
120
|
+
*/
|
|
121
|
+
highlighted: PropTypes.shape({
|
|
122
|
+
additionalRadius: PropTypes.number,
|
|
123
|
+
color: PropTypes.string,
|
|
124
|
+
cornerRadius: PropTypes.number,
|
|
125
|
+
innerRadius: PropTypes.number,
|
|
126
|
+
outerRadius: PropTypes.number,
|
|
127
|
+
paddingAngle: PropTypes.number
|
|
128
|
+
}),
|
|
129
|
+
highlightScope: PropTypes.shape({
|
|
130
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
131
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
132
|
+
}),
|
|
133
|
+
id: PropTypes.string.isRequired,
|
|
134
|
+
/**
|
|
135
|
+
* The radius between circle center and the begining of the arc.
|
|
136
|
+
* @default 0
|
|
137
|
+
*/
|
|
138
|
+
innerRadius: PropTypes.number,
|
|
139
|
+
/**
|
|
140
|
+
* Callback fired when a pie item is clicked.
|
|
141
|
+
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
142
|
+
* @param {PieItemIdentifier} pieItemIdentifier The pie item identifier.
|
|
143
|
+
* @param {DefaultizedPieValueType} item The pie item.
|
|
144
|
+
*/
|
|
145
|
+
onClick: PropTypes.func,
|
|
146
|
+
/**
|
|
147
|
+
* The radius between circle center and the end of the arc.
|
|
148
|
+
*/
|
|
149
|
+
outerRadius: PropTypes.number.isRequired,
|
|
150
|
+
/**
|
|
151
|
+
* The padding angle (deg) between two arcs.
|
|
152
|
+
* @default 0
|
|
153
|
+
*/
|
|
154
|
+
paddingAngle: PropTypes.number,
|
|
155
|
+
/**
|
|
156
|
+
* If `true`, animations are skiped.
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
skipAnimation: PropTypes.bool,
|
|
160
|
+
/**
|
|
161
|
+
* The props used for each component slot.
|
|
162
|
+
* @default {}
|
|
163
|
+
*/
|
|
164
|
+
slotProps: PropTypes.object,
|
|
165
|
+
/**
|
|
166
|
+
* Overridable component slots.
|
|
167
|
+
* @default {}
|
|
168
|
+
*/
|
|
169
|
+
slots: PropTypes.object
|
|
170
|
+
} : void 0;
|
|
171
|
+
export { PieArcPlot };
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -240,8 +240,8 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
240
240
|
arcLabelMinAngle: PropTypes.number,
|
|
241
241
|
color: PropTypes.string,
|
|
242
242
|
cornerRadius: PropTypes.number,
|
|
243
|
-
cx: PropTypes.number,
|
|
244
|
-
cy: PropTypes.number,
|
|
243
|
+
cx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
244
|
+
cy: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
245
245
|
data: PropTypes.arrayOf(PropTypes.shape({
|
|
246
246
|
color: PropTypes.string,
|
|
247
247
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -270,8 +270,8 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
270
270
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
271
271
|
}),
|
|
272
272
|
id: PropTypes.string,
|
|
273
|
-
innerRadius: PropTypes.number,
|
|
274
|
-
outerRadius: PropTypes.number,
|
|
273
|
+
innerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
274
|
+
outerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
275
275
|
paddingAngle: PropTypes.number,
|
|
276
276
|
sortingValues: PropTypes.oneOfType([PropTypes.oneOf(['asc', 'desc', 'none']), PropTypes.func]),
|
|
277
277
|
startAngle: PropTypes.number,
|
package/esm/PieChart/PiePlot.js
CHANGED
|
@@ -4,6 +4,7 @@ import { SeriesContext } from '../context/SeriesContextProvider';
|
|
|
4
4
|
import { DrawingContext } from '../context/DrawingProvider';
|
|
5
5
|
import { PieArcPlot } from './PieArcPlot';
|
|
6
6
|
import { PieArcLabelPlot } from './PieArcLabelPlot';
|
|
7
|
+
import { getPercentageValue } from '../internals/utils';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
/**
|
|
@@ -34,10 +35,6 @@ function PiePlot(props) {
|
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
36
37
|
const availableRadius = Math.min(width, height) / 2;
|
|
37
|
-
const center = {
|
|
38
|
-
x: left + width / 2,
|
|
39
|
-
y: top + height / 2
|
|
40
|
-
};
|
|
41
38
|
const {
|
|
42
39
|
series,
|
|
43
40
|
seriesOrder
|
|
@@ -45,22 +42,26 @@ function PiePlot(props) {
|
|
|
45
42
|
return /*#__PURE__*/_jsxs("g", {
|
|
46
43
|
children: [seriesOrder.map(seriesId => {
|
|
47
44
|
const {
|
|
48
|
-
innerRadius,
|
|
49
|
-
outerRadius,
|
|
45
|
+
innerRadius: innerRadiusParam,
|
|
46
|
+
outerRadius: outerRadiusParam,
|
|
50
47
|
cornerRadius,
|
|
51
48
|
paddingAngle,
|
|
52
49
|
data,
|
|
53
|
-
cx,
|
|
54
|
-
cy,
|
|
50
|
+
cx: cxParam,
|
|
51
|
+
cy: cyParam,
|
|
55
52
|
highlighted,
|
|
56
53
|
faded,
|
|
57
54
|
highlightScope
|
|
58
55
|
} = series[seriesId];
|
|
56
|
+
const outerRadius = getPercentageValue(outerRadiusParam != null ? outerRadiusParam : availableRadius, availableRadius);
|
|
57
|
+
const innerRadius = getPercentageValue(innerRadiusParam != null ? innerRadiusParam : 0, availableRadius);
|
|
58
|
+
const cx = getPercentageValue(cxParam != null ? cxParam : '50%', width);
|
|
59
|
+
const cy = getPercentageValue(cyParam != null ? cyParam : '50%', height);
|
|
59
60
|
return /*#__PURE__*/_jsx("g", {
|
|
60
|
-
transform: `translate(${
|
|
61
|
+
transform: `translate(${left + cx}, ${top + cy})`,
|
|
61
62
|
children: /*#__PURE__*/_jsx(PieArcPlot, {
|
|
62
63
|
innerRadius: innerRadius,
|
|
63
|
-
outerRadius: outerRadius
|
|
64
|
+
outerRadius: outerRadius,
|
|
64
65
|
cornerRadius: cornerRadius,
|
|
65
66
|
paddingAngle: paddingAngle,
|
|
66
67
|
id: seriesId,
|
|
@@ -76,19 +77,23 @@ function PiePlot(props) {
|
|
|
76
77
|
}, seriesId);
|
|
77
78
|
}), seriesOrder.map(seriesId => {
|
|
78
79
|
const {
|
|
79
|
-
innerRadius,
|
|
80
|
-
outerRadius,
|
|
80
|
+
innerRadius: innerRadiusParam,
|
|
81
|
+
outerRadius: outerRadiusParam,
|
|
81
82
|
cornerRadius,
|
|
82
83
|
paddingAngle,
|
|
83
84
|
arcLabel,
|
|
84
85
|
arcLabelMinAngle,
|
|
85
86
|
data,
|
|
86
|
-
cx,
|
|
87
|
-
cy,
|
|
87
|
+
cx: cxParam,
|
|
88
|
+
cy: cyParam,
|
|
88
89
|
highlightScope
|
|
89
90
|
} = series[seriesId];
|
|
91
|
+
const outerRadius = getPercentageValue(outerRadiusParam != null ? outerRadiusParam : availableRadius, availableRadius);
|
|
92
|
+
const innerRadius = getPercentageValue(innerRadiusParam != null ? innerRadiusParam : 0, availableRadius);
|
|
93
|
+
const cx = getPercentageValue(cxParam != null ? cxParam : '50%', width);
|
|
94
|
+
const cy = getPercentageValue(cyParam != null ? cyParam : '50%', height);
|
|
90
95
|
return /*#__PURE__*/_jsx("g", {
|
|
91
|
-
transform: `translate(${
|
|
96
|
+
transform: `translate(${left + cx}, ${top + cy})`,
|
|
92
97
|
children: /*#__PURE__*/_jsx(PieArcLabelPlot, {
|
|
93
98
|
innerRadius: innerRadius,
|
|
94
99
|
outerRadius: outerRadius != null ? outerRadius : availableRadius,
|
package/esm/PieChart/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export * from './PieChart';
|
|
2
|
+
export * from './PiePlot';
|
|
3
|
+
export * from './PieArcPlot';
|
|
4
|
+
export * from './PieArcLabelPlot';
|
|
5
|
+
export * from './PieArc';
|
|
6
|
+
export * from './PieArcLabel';
|
|
@@ -60,11 +60,11 @@ const useChartDimensions = (inWidth, inHeight) => {
|
|
|
60
60
|
}, [computeSize, inHeight, inWidth]);
|
|
61
61
|
if (process.env.NODE_ENV !== 'production') {
|
|
62
62
|
if (displayError.current && inWidth === undefined && width === 0) {
|
|
63
|
-
console.error(`MUI:
|
|
63
|
+
console.error(`MUI-X-Charts: ChartContainer does not have \`width\` prop, and its container has no \`width\` defined.`);
|
|
64
64
|
displayError.current = false;
|
|
65
65
|
}
|
|
66
66
|
if (displayError.current && inHeight === undefined && height === 0) {
|
|
67
|
-
console.error(`MUI:
|
|
67
|
+
console.error(`MUI-X-Charts: ChartContainer does not have \`height\` prop, and its container has no \`height\` defined.`);
|
|
68
68
|
displayError.current = false;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -78,7 +78,7 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
|
|
|
78
78
|
color: PropTypes.string.isRequired,
|
|
79
79
|
markerSize: PropTypes.number.isRequired,
|
|
80
80
|
series: PropTypes.shape({
|
|
81
|
-
color: PropTypes.string,
|
|
81
|
+
color: PropTypes.string.isRequired,
|
|
82
82
|
data: PropTypes.arrayOf(PropTypes.shape({
|
|
83
83
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
84
84
|
x: PropTypes.number.isRequired,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from './ScatterChart';
|
|
2
|
+
export * from './ScatterPlot';
|
|
3
|
+
export * from './Scatter';
|
|
@@ -52,7 +52,7 @@ function CartesianContextProvider({
|
|
|
52
52
|
return axisConfig;
|
|
53
53
|
}
|
|
54
54
|
if (dataset === undefined) {
|
|
55
|
-
throw Error('MUI: x-axis uses `dataKey` but no `dataset` is provided.');
|
|
55
|
+
throw Error('MUI-X-Charts: x-axis uses `dataKey` but no `dataset` is provided.');
|
|
56
56
|
}
|
|
57
57
|
return _extends({}, axisConfig, {
|
|
58
58
|
data: dataset.map(d => d[dataKey])
|
|
@@ -64,7 +64,7 @@ function CartesianContextProvider({
|
|
|
64
64
|
return axisConfig;
|
|
65
65
|
}
|
|
66
66
|
if (dataset === undefined) {
|
|
67
|
-
throw Error('MUI: y-axis uses `dataKey` but no `dataset` is provided.');
|
|
67
|
+
throw Error('MUI-X-Charts: y-axis uses `dataKey` but no `dataset` is provided.');
|
|
68
68
|
}
|
|
69
69
|
return _extends({}, axisConfig, {
|
|
70
70
|
data: dataset.map(d => d[dataKey])
|
|
@@ -40,7 +40,7 @@ const formatSeries = (series, colors, dataset) => {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
if (((_seriesGroups$type = seriesGroups[type]) == null ? void 0 : _seriesGroups$type.series[id]) !== undefined) {
|
|
43
|
-
throw new Error(`MUI: series' id "${id}" is not unique`);
|
|
43
|
+
throw new Error(`MUI-X-Charts: series' id "${id}" is not unique`);
|
|
44
44
|
}
|
|
45
45
|
seriesGroups[type].series[id] = _extends({
|
|
46
46
|
id
|
package/esm/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from './ChartsReferenceLine';
|
|
|
8
8
|
export * from './ChartsAxis';
|
|
9
9
|
export * from './ChartsXAxis';
|
|
10
10
|
export * from './ChartsYAxis';
|
|
11
|
+
export * from './ChartsText';
|
|
11
12
|
export * from './ChartsTooltip';
|
|
12
13
|
export * from './ChartsAxisHighlight';
|
|
13
14
|
export * from './BarChart';
|