@mui/x-charts 7.3.0 → 7.3.2
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 +5 -3
- package/BarChart/BarChart.js +23 -102
- package/BarChart/BarElement.d.ts +63 -62
- package/BarChart/BarElement.js +1 -2
- package/BarChart/BarPlot.js +9 -9
- package/CHANGELOG.md +155 -7
- package/ChartContainer/ChartContainer.js +3 -1
- package/ChartsAxis/ChartsAxis.js +7 -99
- package/ChartsAxis/axisClasses.d.ts +1 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsClipPath/ChartsClipPath.js +1 -1
- package/ChartsGrid/ChartsGrid.js +1 -1
- package/ChartsLegend/ChartsLegend.js +1 -1
- package/ChartsLegend/DefaultChartsLegend.js +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/ChartsOverlay/ChartsLoadingOverlay.d.ts +3 -0
- package/ChartsOverlay/ChartsLoadingOverlay.js +43 -0
- package/ChartsOverlay/ChartsNoDataOverlay.d.ts +3 -0
- package/ChartsOverlay/ChartsNoDataOverlay.js +43 -0
- package/ChartsOverlay/ChartsOverlay.d.ts +35 -0
- package/ChartsOverlay/ChartsOverlay.js +41 -0
- package/ChartsOverlay/index.d.ts +3 -0
- package/ChartsOverlay/index.js +26 -0
- package/ChartsOverlay/package.json +6 -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/ChartsSurface.js +1 -1
- package/ChartsText/ChartsText.js +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +18 -5
- package/ChartsTooltip/ChartsItemTooltipContent.js +20 -4
- package/ChartsTooltip/ChartsTooltip.d.ts +2 -2
- package/ChartsTooltip/ChartsTooltip.js +3 -3
- package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -7
- package/ChartsTooltip/ChartsTooltipTable.js +8 -9
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -6
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -4
- package/ChartsTooltip/utils.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -1
- package/ChartsXAxis/ChartsXAxis.d.ts +1 -1
- package/ChartsXAxis/ChartsXAxis.js +8 -1
- package/ChartsYAxis/ChartsYAxis.d.ts +1 -1
- package/ChartsYAxis/ChartsYAxis.js +8 -1
- package/Gauge/Gauge.js +2 -2
- package/Gauge/GaugeContainer.js +2 -2
- package/Gauge/GaugeProvider.d.ts +2 -2
- package/Gauge/GaugeProvider.js +2 -2
- package/Gauge/GaugeReferenceArc.js +1 -1
- package/Gauge/GaugeValueArc.js +1 -1
- package/Gauge/GaugeValueText.js +1 -1
- package/Gauge/gaugeClasses.d.ts +2 -2
- package/Gauge/utils.d.ts +1 -1
- package/Gauge/utils.js +4 -4
- package/LineChart/AnimatedArea.d.ts +63 -62
- package/LineChart/AnimatedArea.js +1 -1
- package/LineChart/AnimatedLine.d.ts +63 -62
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AreaElement.d.ts +1 -1
- package/LineChart/AreaElement.js +1 -1
- package/LineChart/AreaPlot.js +1 -1
- package/LineChart/LineChart.d.ts +5 -3
- package/LineChart/LineChart.js +20 -99
- package/LineChart/LineElement.d.ts +1 -1
- package/LineChart/LineElement.js +1 -1
- package/LineChart/LineHighlightElement.js +1 -1
- package/LineChart/LineHighlightPlot.js +1 -1
- package/LineChart/LinePlot.js +1 -1
- package/LineChart/MarkElement.d.ts +1 -1
- package/LineChart/MarkElement.js +1 -1
- package/LineChart/MarkPlot.js +1 -1
- package/PieChart/PieArc.d.ts +2 -1
- package/PieChart/PieArc.js +1 -1
- package/PieChart/PieArcLabel.d.ts +2 -1
- package/PieChart/PieArcLabel.js +2 -2
- package/PieChart/PieArcLabelPlot.d.ts +1 -1
- package/PieChart/PieArcLabelPlot.js +4 -4
- package/PieChart/PieArcPlot.d.ts +1 -1
- package/PieChart/PieArcPlot.js +4 -4
- package/PieChart/PieChart.d.ts +5 -3
- package/PieChart/PieChart.js +23 -99
- package/PieChart/PiePlot.js +1 -1
- package/PieChart/dataTransform/transition.d.ts +1 -0
- package/PieChart/dataTransform/useTransformData.js +1 -1
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +3 -1
- package/ResponsiveChartContainer/useChartContainerDimensions.js +1 -1
- package/ScatterChart/Scatter.js +1 -1
- package/ScatterChart/ScatterChart.d.ts +6 -3
- package/ScatterChart/ScatterChart.js +74 -125
- package/ScatterChart/ScatterPlot.js +9 -2
- package/ScatterChart/getColor.d.ts +2 -1
- package/ScatterChart/getColor.js +18 -1
- package/SparkLineChart/SparkLineChart.js +1 -1
- package/context/CartesianContextProvider.d.ts +2 -1
- package/context/CartesianContextProvider.js +1 -1
- package/context/DrawingProvider.js +1 -1
- package/context/HighlightProvider.js +1 -1
- package/context/InteractionProvider.js +1 -1
- package/context/SeriesContextProvider.js +2 -2
- package/context/ZAxisContextProvider.d.ts +33 -0
- package/context/ZAxisContextProvider.js +98 -0
- package/context/index.d.ts +2 -0
- package/context/index.js +8 -1
- package/esm/BarChart/BarChart.js +23 -103
- package/esm/BarChart/BarElement.js +0 -1
- package/esm/BarChart/BarPlot.js +8 -8
- package/esm/ChartContainer/ChartContainer.js +3 -2
- package/esm/ChartsAxis/ChartsAxis.js +7 -100
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -2
- package/esm/ChartsGrid/ChartsGrid.js +1 -2
- package/esm/ChartsLegend/DefaultChartsLegend.js +1 -2
- package/esm/ChartsOverlay/ChartsLoadingOverlay.js +34 -0
- package/esm/ChartsOverlay/ChartsNoDataOverlay.js +34 -0
- package/esm/ChartsOverlay/ChartsOverlay.js +31 -0
- package/esm/ChartsOverlay/index.js +3 -0
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
- package/esm/ChartsSurface.js +1 -2
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +17 -4
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +19 -3
- package/esm/ChartsTooltip/ChartsTooltip.js +2 -2
- package/esm/ChartsTooltip/ChartsTooltipTable.js +8 -8
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -7
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -5
- package/esm/ChartsXAxis/ChartsXAxis.js +8 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +8 -2
- package/esm/Gauge/Gauge.js +2 -3
- package/esm/Gauge/GaugeContainer.js +1 -1
- package/esm/Gauge/GaugeProvider.js +1 -1
- package/esm/Gauge/utils.js +4 -4
- package/esm/LineChart/AnimatedArea.js +1 -2
- package/esm/LineChart/AnimatedLine.js +1 -2
- package/esm/LineChart/LineChart.js +20 -100
- package/esm/PieChart/PieArcLabel.js +1 -1
- package/esm/PieChart/PieArcLabelPlot.js +3 -3
- package/esm/PieChart/PieArcPlot.js +3 -3
- package/esm/PieChart/PieChart.js +23 -100
- package/esm/PieChart/PiePlot.js +1 -2
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/esm/ScatterChart/ScatterChart.js +74 -126
- package/esm/ScatterChart/ScatterPlot.js +8 -1
- package/esm/ScatterChart/getColor.js +18 -1
- package/esm/SparkLineChart/SparkLineChart.js +1 -2
- package/esm/context/SeriesContextProvider.js +1 -1
- package/esm/context/ZAxisContextProvider.js +89 -0
- package/esm/context/index.js +1 -1
- package/esm/hooks/useReducedMotion.js +1 -1
- package/esm/hooks/useScale.js +1 -1
- package/esm/hooks/useTicks.js +4 -0
- package/esm/internals/colorGetter.js +2 -2
- package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +6 -7
- package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -3
- package/esm/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +4 -5
- package/esm/internals/utils.js +1 -1
- package/esm/models/z-axis.js +1 -0
- package/hooks/useAxisEvents.js +1 -1
- package/hooks/useChartDimensions.js +1 -1
- package/hooks/useChartId.js +1 -1
- package/hooks/useDrawingArea.js +1 -1
- package/hooks/useInteractionItemProps.js +1 -1
- package/hooks/useMounted.js +1 -1
- package/hooks/useReducedMotion.d.ts +1 -1
- package/hooks/useReducedMotion.js +1 -1
- package/hooks/useScale.d.ts +4 -4
- package/hooks/useScale.js +2 -2
- package/hooks/useSeries.js +1 -1
- package/hooks/useSvgRef.js +1 -1
- package/hooks/useTicks.js +5 -1
- package/index.js +1 -1
- package/internals/colorGetter.d.ts +3 -1
- package/internals/colorGetter.js +2 -2
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +6 -6
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +4 -4
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +4 -4
- package/internals/defaultizeColor.d.ts +1 -0
- package/internals/useAnimatedPath.d.ts +1 -0
- package/internals/useAnimatedPath.js +1 -1
- package/internals/utils.d.ts +1 -1
- package/internals/utils.js +1 -1
- package/models/axis.d.ts +1 -1
- package/models/colorMapping.d.ts +3 -2
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/line.d.ts +1 -1
- package/models/seriesType/pie.d.ts +9 -4
- package/models/seriesType/scatter.d.ts +5 -0
- package/models/z-axis.d.ts +14 -0
- package/models/z-axis.js +5 -0
- package/modern/BarChart/BarChart.js +23 -103
- package/modern/BarChart/BarElement.js +0 -1
- package/modern/BarChart/BarPlot.js +8 -8
- package/modern/ChartContainer/ChartContainer.js +3 -2
- package/modern/ChartsAxis/ChartsAxis.js +7 -100
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -2
- package/modern/ChartsGrid/ChartsGrid.js +1 -2
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -2
- package/modern/ChartsOverlay/ChartsLoadingOverlay.js +34 -0
- package/modern/ChartsOverlay/ChartsNoDataOverlay.js +34 -0
- package/modern/ChartsOverlay/ChartsOverlay.js +31 -0
- package/modern/ChartsOverlay/index.js +3 -0
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
- package/modern/ChartsSurface.js +1 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +17 -4
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +19 -3
- package/modern/ChartsTooltip/ChartsTooltip.js +2 -2
- package/modern/ChartsTooltip/ChartsTooltipTable.js +8 -8
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -7
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -5
- package/modern/ChartsXAxis/ChartsXAxis.js +8 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +8 -2
- package/modern/Gauge/Gauge.js +2 -3
- package/modern/Gauge/GaugeContainer.js +1 -1
- package/modern/Gauge/GaugeProvider.js +1 -1
- package/modern/Gauge/utils.js +4 -4
- package/modern/LineChart/AnimatedArea.js +1 -2
- package/modern/LineChart/AnimatedLine.js +1 -2
- package/modern/LineChart/LineChart.js +20 -100
- package/modern/PieChart/PieArcLabel.js +1 -1
- package/modern/PieChart/PieArcLabelPlot.js +3 -3
- package/modern/PieChart/PieArcPlot.js +3 -3
- package/modern/PieChart/PieChart.js +23 -100
- package/modern/PieChart/PiePlot.js +1 -2
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/modern/ScatterChart/ScatterChart.js +74 -126
- package/modern/ScatterChart/ScatterPlot.js +8 -1
- package/modern/ScatterChart/getColor.js +18 -1
- package/modern/SparkLineChart/SparkLineChart.js +1 -2
- package/modern/context/SeriesContextProvider.js +1 -1
- package/modern/context/ZAxisContextProvider.js +89 -0
- package/modern/context/index.js +1 -1
- package/modern/hooks/useReducedMotion.js +1 -1
- package/modern/hooks/useScale.js +1 -1
- package/modern/hooks/useTicks.js +4 -0
- package/modern/index.js +1 -1
- package/modern/internals/colorGetter.js +2 -2
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +6 -7
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -3
- package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +4 -5
- package/modern/internals/utils.js +1 -1
- package/modern/models/z-axis.js +1 -0
- package/package.json +3 -5
|
@@ -12,8 +12,8 @@ import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
|
12
12
|
import { ChartsClipPath } from '../ChartsClipPath';
|
|
13
13
|
import { ChartsGrid } from '../ChartsGrid';
|
|
14
14
|
import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
|
|
15
|
-
import {
|
|
16
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { ChartsOverlay } from '../ChartsOverlay/ChartsOverlay';
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
/**
|
|
18
18
|
* Demos:
|
|
19
19
|
*
|
|
@@ -50,7 +50,8 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
50
50
|
onAxisClick,
|
|
51
51
|
children,
|
|
52
52
|
slots,
|
|
53
|
-
slotProps
|
|
53
|
+
slotProps,
|
|
54
|
+
loading
|
|
54
55
|
} = props;
|
|
55
56
|
const id = useId();
|
|
56
57
|
const clipPathId = `${id}-clip-path`;
|
|
@@ -91,14 +92,18 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
91
92
|
}), grid && /*#__PURE__*/_jsx(ChartsGrid, {
|
|
92
93
|
vertical: grid.vertical,
|
|
93
94
|
horizontal: grid.horizontal
|
|
94
|
-
}), /*#__PURE__*/
|
|
95
|
+
}), /*#__PURE__*/_jsxs("g", {
|
|
95
96
|
clipPath: `url(#${clipPathId})`,
|
|
96
|
-
children: /*#__PURE__*/_jsx(BarPlot, {
|
|
97
|
+
children: [/*#__PURE__*/_jsx(BarPlot, {
|
|
97
98
|
slots: slots,
|
|
98
99
|
slotProps: slotProps,
|
|
99
100
|
skipAnimation: skipAnimation,
|
|
100
101
|
onItemClick: onItemClick
|
|
101
|
-
})
|
|
102
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, {
|
|
103
|
+
loading: loading,
|
|
104
|
+
slots: slots,
|
|
105
|
+
slotProps: slotProps
|
|
106
|
+
})]
|
|
102
107
|
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
103
108
|
topAxis: topAxis,
|
|
104
109
|
leftAxis: leftAxis,
|
|
@@ -109,7 +114,7 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
109
114
|
}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
|
|
110
115
|
slots: slots,
|
|
111
116
|
slotProps: slotProps
|
|
112
|
-
})), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, defaultizedAxisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
|
|
117
|
+
})), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, defaultizedAxisHighlight)), !loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
|
|
113
118
|
slots: slots,
|
|
114
119
|
slotProps: slotProps
|
|
115
120
|
})), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
@@ -137,30 +142,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
137
142
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
138
143
|
* @default xAxisIds[0] The id of the first provided axis
|
|
139
144
|
*/
|
|
140
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.
|
|
141
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
142
|
-
classes: PropTypes.object,
|
|
143
|
-
disableLine: PropTypes.bool,
|
|
144
|
-
disableTicks: PropTypes.bool,
|
|
145
|
-
fill: PropTypes.string,
|
|
146
|
-
label: PropTypes.string,
|
|
147
|
-
labelFontSize: PropTypes.number,
|
|
148
|
-
labelStyle: PropTypes.object,
|
|
149
|
-
position: PropTypes.oneOf(['bottom', 'top']),
|
|
150
|
-
slotProps: PropTypes.object,
|
|
151
|
-
slots: PropTypes.object,
|
|
152
|
-
stroke: PropTypes.string,
|
|
153
|
-
tickFontSize: PropTypes.number,
|
|
154
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
155
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
156
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
157
|
-
tickLabelStyle: PropTypes.object,
|
|
158
|
-
tickMaxStep: PropTypes.number,
|
|
159
|
-
tickMinStep: PropTypes.number,
|
|
160
|
-
tickNumber: PropTypes.number,
|
|
161
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
162
|
-
tickSize: PropTypes.number
|
|
163
|
-
}), PropTypes.string]),
|
|
145
|
+
bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
164
146
|
children: PropTypes.node,
|
|
165
147
|
className: PropTypes.string,
|
|
166
148
|
/**
|
|
@@ -200,30 +182,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
200
182
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
201
183
|
* @default yAxisIds[0] The id of the first provided axis
|
|
202
184
|
*/
|
|
203
|
-
leftAxis: PropTypes.oneOfType([PropTypes.
|
|
204
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
205
|
-
classes: PropTypes.object,
|
|
206
|
-
disableLine: PropTypes.bool,
|
|
207
|
-
disableTicks: PropTypes.bool,
|
|
208
|
-
fill: PropTypes.string,
|
|
209
|
-
label: PropTypes.string,
|
|
210
|
-
labelFontSize: PropTypes.number,
|
|
211
|
-
labelStyle: PropTypes.object,
|
|
212
|
-
position: PropTypes.oneOf(['left', 'right']),
|
|
213
|
-
slotProps: PropTypes.object,
|
|
214
|
-
slots: PropTypes.object,
|
|
215
|
-
stroke: PropTypes.string,
|
|
216
|
-
tickFontSize: PropTypes.number,
|
|
217
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
218
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
219
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
220
|
-
tickLabelStyle: PropTypes.object,
|
|
221
|
-
tickMaxStep: PropTypes.number,
|
|
222
|
-
tickMinStep: PropTypes.number,
|
|
223
|
-
tickNumber: PropTypes.number,
|
|
224
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
225
|
-
tickSize: PropTypes.number
|
|
226
|
-
}), PropTypes.string]),
|
|
185
|
+
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
227
186
|
/**
|
|
228
187
|
* @deprecated Consider using `slotProps.legend` instead.
|
|
229
188
|
*/
|
|
@@ -238,6 +197,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
238
197
|
slotProps: PropTypes.object,
|
|
239
198
|
slots: PropTypes.object
|
|
240
199
|
}),
|
|
200
|
+
/**
|
|
201
|
+
* If `true`, a loading overlay is displayed.
|
|
202
|
+
*/
|
|
203
|
+
loading: PropTypes.bool,
|
|
241
204
|
/**
|
|
242
205
|
* The margin between the SVG and the drawing area.
|
|
243
206
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
@@ -268,32 +231,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
268
231
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
269
232
|
* @default null
|
|
270
233
|
*/
|
|
271
|
-
rightAxis: PropTypes.oneOfType([PropTypes.
|
|
272
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
273
|
-
classes: PropTypes.object,
|
|
274
|
-
disableLine: PropTypes.bool,
|
|
275
|
-
disableTicks: PropTypes.bool,
|
|
276
|
-
fill: PropTypes.string,
|
|
277
|
-
label: PropTypes.string,
|
|
278
|
-
labelFontSize: PropTypes.number,
|
|
279
|
-
labelStyle: PropTypes.object,
|
|
280
|
-
position: PropTypes.oneOf(['left', 'right']),
|
|
281
|
-
slotProps: PropTypes.object,
|
|
282
|
-
slots: PropTypes.object,
|
|
283
|
-
stroke: PropTypes.string,
|
|
284
|
-
tickFontSize: PropTypes.number,
|
|
285
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
286
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
287
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
288
|
-
tickLabelStyle: PropTypes.object,
|
|
289
|
-
tickMaxStep: PropTypes.number,
|
|
290
|
-
tickMinStep: PropTypes.number,
|
|
291
|
-
tickNumber: PropTypes.number,
|
|
292
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
293
|
-
tickSize: PropTypes.number
|
|
294
|
-
}), PropTypes.string]),
|
|
234
|
+
rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
295
235
|
/**
|
|
296
236
|
* The series to display in the bar chart.
|
|
237
|
+
* An array of [[BarSeriesType]] objects.
|
|
297
238
|
*/
|
|
298
239
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
299
240
|
/**
|
|
@@ -330,30 +271,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
330
271
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
331
272
|
* @default null
|
|
332
273
|
*/
|
|
333
|
-
topAxis: PropTypes.oneOfType([PropTypes.
|
|
334
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
335
|
-
classes: PropTypes.object,
|
|
336
|
-
disableLine: PropTypes.bool,
|
|
337
|
-
disableTicks: PropTypes.bool,
|
|
338
|
-
fill: PropTypes.string,
|
|
339
|
-
label: PropTypes.string,
|
|
340
|
-
labelFontSize: PropTypes.number,
|
|
341
|
-
labelStyle: PropTypes.object,
|
|
342
|
-
position: PropTypes.oneOf(['bottom', 'top']),
|
|
343
|
-
slotProps: PropTypes.object,
|
|
344
|
-
slots: PropTypes.object,
|
|
345
|
-
stroke: PropTypes.string,
|
|
346
|
-
tickFontSize: PropTypes.number,
|
|
347
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
348
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
349
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
350
|
-
tickLabelStyle: PropTypes.object,
|
|
351
|
-
tickMaxStep: PropTypes.number,
|
|
352
|
-
tickMinStep: PropTypes.number,
|
|
353
|
-
tickNumber: PropTypes.number,
|
|
354
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
355
|
-
tickSize: PropTypes.number
|
|
356
|
-
}), PropTypes.string]),
|
|
274
|
+
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
357
275
|
viewBox: PropTypes.shape({
|
|
358
276
|
height: PropTypes.number,
|
|
359
277
|
width: PropTypes.number,
|
|
@@ -367,6 +285,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
367
285
|
/**
|
|
368
286
|
* The configuration of the x-axes.
|
|
369
287
|
* If not provided, a default axis config is used.
|
|
288
|
+
* An array of [[AxisConfig]] objects.
|
|
370
289
|
*/
|
|
371
290
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
372
291
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -419,6 +338,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
419
338
|
/**
|
|
420
339
|
* The configuration of the y-axes.
|
|
421
340
|
* If not provided, a default axis config is used.
|
|
341
|
+
* An array of [[AxisConfig]] objects.
|
|
422
342
|
*/
|
|
423
343
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
424
344
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -35,7 +35,6 @@ export const BarElementPath = styled(animated.rect, {
|
|
|
35
35
|
ownerState
|
|
36
36
|
}) => ({
|
|
37
37
|
stroke: 'none',
|
|
38
|
-
shapeRendering: 'crispEdges',
|
|
39
38
|
fill: ownerState.isHighlighted ? d3Color(ownerState.color).brighter(0.5).formatHex() : ownerState.color,
|
|
40
39
|
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
|
|
41
40
|
opacity: ownerState.isFaded && 0.3 || 1
|
|
@@ -70,25 +70,25 @@ const useAggregatedData = () => {
|
|
|
70
70
|
let baseScaleConfig;
|
|
71
71
|
if (verticalLayout) {
|
|
72
72
|
if (!isBandScaleConfig(xAxisConfig)) {
|
|
73
|
-
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`}
|
|
73
|
+
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should be of type "band" to display the bar series of id "${seriesId}".`);
|
|
74
74
|
}
|
|
75
75
|
if (xAxis[xAxisKey].data === undefined) {
|
|
76
|
-
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`}
|
|
76
|
+
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property.`);
|
|
77
77
|
}
|
|
78
78
|
baseScaleConfig = xAxisConfig;
|
|
79
79
|
if (isBandScaleConfig(yAxisConfig) || isPointScaleConfig(yAxisConfig)) {
|
|
80
|
-
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`}
|
|
80
|
+
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} should be a continuous type to display the bar series of id "${seriesId}".`);
|
|
81
81
|
}
|
|
82
82
|
} else {
|
|
83
83
|
if (!isBandScaleConfig(yAxisConfig)) {
|
|
84
|
-
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`}
|
|
84
|
+
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} should be of type "band" to display the bar series of id "${seriesId}".`);
|
|
85
85
|
}
|
|
86
86
|
if (yAxis[yAxisKey].data === undefined) {
|
|
87
|
-
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`}
|
|
87
|
+
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} should have data property.`);
|
|
88
88
|
}
|
|
89
89
|
baseScaleConfig = yAxisConfig;
|
|
90
90
|
if (isBandScaleConfig(xAxisConfig) || isPointScaleConfig(xAxisConfig)) {
|
|
91
|
-
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`}
|
|
91
|
+
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should be a continuous type to display the bar series of id "${seriesId}".`);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
const xScale = xAxisConfig.scale;
|
|
@@ -109,8 +109,8 @@ const useAggregatedData = () => {
|
|
|
109
109
|
} = series[seriesId];
|
|
110
110
|
return stackedData.map((values, dataIndex) => {
|
|
111
111
|
const valueCoordinates = values.map(v => verticalLayout ? yScale(v) : xScale(v));
|
|
112
|
-
const minValueCoord = Math.min(...valueCoordinates);
|
|
113
|
-
const maxValueCoord = Math.max(...valueCoordinates);
|
|
112
|
+
const minValueCoord = Math.round(Math.min(...valueCoordinates));
|
|
113
|
+
const maxValueCoord = Math.round(Math.max(...valueCoordinates));
|
|
114
114
|
return {
|
|
115
115
|
seriesId,
|
|
116
116
|
dataIndex,
|
|
@@ -9,8 +9,7 @@ import { ChartsSurface } from '../ChartsSurface';
|
|
|
9
9
|
import { CartesianContextProvider } from '../context/CartesianContextProvider';
|
|
10
10
|
import { HighlightProvider } from '../context/HighlightProvider';
|
|
11
11
|
import { ChartsAxesGradients } from '../internals/components/ChartsAxesGradients';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
13
|
const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
|
|
15
14
|
const {
|
|
16
15
|
width,
|
|
@@ -122,6 +121,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
122
121
|
/**
|
|
123
122
|
* The configuration of the x-axes.
|
|
124
123
|
* If not provided, a default axis config is used.
|
|
124
|
+
* An array of [[AxisConfig]] objects.
|
|
125
125
|
*/
|
|
126
126
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
127
127
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -174,6 +174,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
174
174
|
/**
|
|
175
175
|
* The configuration of the y-axes.
|
|
176
176
|
* If not provided, a default axis config is used.
|
|
177
|
+
* An array of [[AxisConfig]] objects.
|
|
177
178
|
*/
|
|
178
179
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
179
180
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -4,8 +4,7 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
5
5
|
import { ChartsXAxis } from '../ChartsXAxis';
|
|
6
6
|
import { ChartsYAxis } from '../ChartsYAxis';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
8
|
const getAxisId = (propsValue, defaultAxisId) => {
|
|
10
9
|
if (propsValue == null) {
|
|
11
10
|
return null;
|
|
@@ -53,8 +52,8 @@ function ChartsAxis(props) {
|
|
|
53
52
|
// TODO: use for plotting line without ticks or any thing
|
|
54
53
|
// const drawingArea = React.useContext(DrawingContext);
|
|
55
54
|
|
|
56
|
-
const leftId = getAxisId(leftAxis === undefined ? yAxisIds[0] : leftAxis);
|
|
57
|
-
const bottomId = getAxisId(bottomAxis === undefined ? xAxisIds[0] : bottomAxis);
|
|
55
|
+
const leftId = getAxisId(leftAxis === undefined ? yAxisIds[0] : leftAxis, yAxisIds[0]);
|
|
56
|
+
const bottomId = getAxisId(bottomAxis === undefined ? xAxisIds[0] : bottomAxis, xAxisIds[0]);
|
|
58
57
|
const topId = getAxisId(topAxis, xAxisIds[0]);
|
|
59
58
|
const rightId = getAxisId(rightAxis, yAxisIds[0]);
|
|
60
59
|
if (topId !== null && !xAxis[topId]) {
|
|
@@ -99,88 +98,19 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
99
98
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
100
99
|
* @default xAxisIds[0] The id of the first provided axis
|
|
101
100
|
*/
|
|
102
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.
|
|
103
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
104
|
-
classes: PropTypes.object,
|
|
105
|
-
disableLine: PropTypes.bool,
|
|
106
|
-
disableTicks: PropTypes.bool,
|
|
107
|
-
fill: PropTypes.string,
|
|
108
|
-
label: PropTypes.string,
|
|
109
|
-
labelFontSize: PropTypes.number,
|
|
110
|
-
labelStyle: PropTypes.object,
|
|
111
|
-
position: PropTypes.oneOf(['bottom', 'top']),
|
|
112
|
-
slotProps: PropTypes.object,
|
|
113
|
-
slots: PropTypes.object,
|
|
114
|
-
stroke: PropTypes.string,
|
|
115
|
-
tickFontSize: PropTypes.number,
|
|
116
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
117
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
118
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
119
|
-
tickLabelStyle: PropTypes.object,
|
|
120
|
-
tickMaxStep: PropTypes.number,
|
|
121
|
-
tickMinStep: PropTypes.number,
|
|
122
|
-
tickNumber: PropTypes.number,
|
|
123
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
124
|
-
tickSize: PropTypes.number
|
|
125
|
-
}), PropTypes.string]),
|
|
101
|
+
bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
126
102
|
/**
|
|
127
103
|
* Indicate which axis to display the left of the charts.
|
|
128
104
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
129
105
|
* @default yAxisIds[0] The id of the first provided axis
|
|
130
106
|
*/
|
|
131
|
-
leftAxis: PropTypes.oneOfType([PropTypes.
|
|
132
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
133
|
-
classes: PropTypes.object,
|
|
134
|
-
disableLine: PropTypes.bool,
|
|
135
|
-
disableTicks: PropTypes.bool,
|
|
136
|
-
fill: PropTypes.string,
|
|
137
|
-
label: PropTypes.string,
|
|
138
|
-
labelFontSize: PropTypes.number,
|
|
139
|
-
labelStyle: PropTypes.object,
|
|
140
|
-
position: PropTypes.oneOf(['left', 'right']),
|
|
141
|
-
slotProps: PropTypes.object,
|
|
142
|
-
slots: PropTypes.object,
|
|
143
|
-
stroke: PropTypes.string,
|
|
144
|
-
tickFontSize: PropTypes.number,
|
|
145
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
146
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
147
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
148
|
-
tickLabelStyle: PropTypes.object,
|
|
149
|
-
tickMaxStep: PropTypes.number,
|
|
150
|
-
tickMinStep: PropTypes.number,
|
|
151
|
-
tickNumber: PropTypes.number,
|
|
152
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
153
|
-
tickSize: PropTypes.number
|
|
154
|
-
}), PropTypes.string]),
|
|
107
|
+
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
155
108
|
/**
|
|
156
109
|
* Indicate which axis to display the right of the charts.
|
|
157
110
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
158
111
|
* @default null
|
|
159
112
|
*/
|
|
160
|
-
rightAxis: PropTypes.oneOfType([PropTypes.
|
|
161
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
162
|
-
classes: PropTypes.object,
|
|
163
|
-
disableLine: PropTypes.bool,
|
|
164
|
-
disableTicks: PropTypes.bool,
|
|
165
|
-
fill: PropTypes.string,
|
|
166
|
-
label: PropTypes.string,
|
|
167
|
-
labelFontSize: PropTypes.number,
|
|
168
|
-
labelStyle: PropTypes.object,
|
|
169
|
-
position: PropTypes.oneOf(['left', 'right']),
|
|
170
|
-
slotProps: PropTypes.object,
|
|
171
|
-
slots: PropTypes.object,
|
|
172
|
-
stroke: PropTypes.string,
|
|
173
|
-
tickFontSize: PropTypes.number,
|
|
174
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
175
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
176
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
177
|
-
tickLabelStyle: PropTypes.object,
|
|
178
|
-
tickMaxStep: PropTypes.number,
|
|
179
|
-
tickMinStep: PropTypes.number,
|
|
180
|
-
tickNumber: PropTypes.number,
|
|
181
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
182
|
-
tickSize: PropTypes.number
|
|
183
|
-
}), PropTypes.string]),
|
|
113
|
+
rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
184
114
|
/**
|
|
185
115
|
* The props used for each component slot.
|
|
186
116
|
* @default {}
|
|
@@ -196,29 +126,6 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
196
126
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
197
127
|
* @default null
|
|
198
128
|
*/
|
|
199
|
-
topAxis: PropTypes.oneOfType([PropTypes.
|
|
200
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
201
|
-
classes: PropTypes.object,
|
|
202
|
-
disableLine: PropTypes.bool,
|
|
203
|
-
disableTicks: PropTypes.bool,
|
|
204
|
-
fill: PropTypes.string,
|
|
205
|
-
label: PropTypes.string,
|
|
206
|
-
labelFontSize: PropTypes.number,
|
|
207
|
-
labelStyle: PropTypes.object,
|
|
208
|
-
position: PropTypes.oneOf(['bottom', 'top']),
|
|
209
|
-
slotProps: PropTypes.object,
|
|
210
|
-
slots: PropTypes.object,
|
|
211
|
-
stroke: PropTypes.string,
|
|
212
|
-
tickFontSize: PropTypes.number,
|
|
213
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
214
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
215
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
216
|
-
tickLabelStyle: PropTypes.object,
|
|
217
|
-
tickMaxStep: PropTypes.number,
|
|
218
|
-
tickMinStep: PropTypes.number,
|
|
219
|
-
tickNumber: PropTypes.number,
|
|
220
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
221
|
-
tickSize: PropTypes.number
|
|
222
|
-
}), PropTypes.string])
|
|
129
|
+
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string])
|
|
223
130
|
} : void 0;
|
|
224
131
|
export { ChartsAxis };
|
|
@@ -9,8 +9,7 @@ import { InteractionContext } from '../context/InteractionProvider';
|
|
|
9
9
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
10
10
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
11
11
|
import { isBandScale } from '../internals/isBandScale';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
13
|
export function getAxisHighlightUtilityClass(slot) {
|
|
15
14
|
return generateUtilityClass('MuiChartsAxisHighlight', slot);
|
|
16
15
|
}
|
|
@@ -8,8 +8,7 @@ import { styled } from '@mui/material/styles';
|
|
|
8
8
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
9
9
|
import { useTicks } from '../hooks/useTicks';
|
|
10
10
|
import { getChartsGridUtilityClass, chartsGridClasses } from './chartsGridClasses';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
const GridRoot = styled('g', {
|
|
14
13
|
name: 'MuiChartsGrid',
|
|
15
14
|
slot: 'Root',
|
|
@@ -8,8 +8,7 @@ import { NoSsr } from '@mui/base/NoSsr';
|
|
|
8
8
|
import { useTheme, styled } from '@mui/material/styles';
|
|
9
9
|
import { ChartsText } from '../ChartsText';
|
|
10
10
|
import { getWordsByLines } from '../internals/getWordsByLines';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
export const ChartsLegendRoot = styled('g', {
|
|
14
13
|
name: 'MuiChartsLegend',
|
|
15
14
|
slot: 'Root',
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["message"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import { useDrawingArea } from '../hooks/useDrawingArea';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const StyledText = styled('text')(({
|
|
9
|
+
theme
|
|
10
|
+
}) => ({
|
|
11
|
+
stroke: 'none',
|
|
12
|
+
fill: theme.palette.text.primary,
|
|
13
|
+
shapeRendering: 'crispEdges',
|
|
14
|
+
textAnchor: 'middle',
|
|
15
|
+
dominantBaseline: 'middle'
|
|
16
|
+
}));
|
|
17
|
+
export function ChartsLoadingOverlay(props) {
|
|
18
|
+
const {
|
|
19
|
+
message
|
|
20
|
+
} = props,
|
|
21
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
|
+
const {
|
|
23
|
+
top,
|
|
24
|
+
left,
|
|
25
|
+
height,
|
|
26
|
+
width
|
|
27
|
+
} = useDrawingArea();
|
|
28
|
+
return /*#__PURE__*/_jsx(StyledText, _extends({
|
|
29
|
+
x: left + width / 2,
|
|
30
|
+
y: top + height / 2
|
|
31
|
+
}, other, {
|
|
32
|
+
children: message ?? 'Loading data ...'
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["message"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import { useDrawingArea } from '../hooks/useDrawingArea';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const StyledText = styled('text')(({
|
|
9
|
+
theme
|
|
10
|
+
}) => ({
|
|
11
|
+
stroke: 'none',
|
|
12
|
+
fill: theme.palette.text.primary,
|
|
13
|
+
shapeRendering: 'crispEdges',
|
|
14
|
+
textAnchor: 'middle',
|
|
15
|
+
dominantBaseline: 'middle'
|
|
16
|
+
}));
|
|
17
|
+
export function ChartsNoDataOverlay(props) {
|
|
18
|
+
const {
|
|
19
|
+
message
|
|
20
|
+
} = props,
|
|
21
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
|
+
const {
|
|
23
|
+
top,
|
|
24
|
+
left,
|
|
25
|
+
height,
|
|
26
|
+
width
|
|
27
|
+
} = useDrawingArea();
|
|
28
|
+
return /*#__PURE__*/_jsx(StyledText, _extends({
|
|
29
|
+
x: left + width / 2,
|
|
30
|
+
y: top + height / 2
|
|
31
|
+
}, other, {
|
|
32
|
+
children: message ?? 'No data to display'
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ChartsLoadingOverlay } from './ChartsLoadingOverlay';
|
|
4
|
+
import { useSeries } from '../hooks/useSeries';
|
|
5
|
+
import { ChartsNoDataOverlay } from './ChartsNoDataOverlay';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export function useNoData() {
|
|
8
|
+
const seriesPerType = useSeries();
|
|
9
|
+
return Object.values(seriesPerType).every(seriesOfGivenType => {
|
|
10
|
+
if (!seriesOfGivenType) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const {
|
|
14
|
+
series,
|
|
15
|
+
seriesOrder
|
|
16
|
+
} = seriesOfGivenType;
|
|
17
|
+
return seriesOrder.every(seriesId => series[seriesId].data.length === 0);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export function ChartsOverlay(props) {
|
|
21
|
+
const noData = useNoData();
|
|
22
|
+
if (props.loading) {
|
|
23
|
+
const LoadingOverlay = props.slots?.loadingOverlay ?? ChartsLoadingOverlay;
|
|
24
|
+
return /*#__PURE__*/_jsx(LoadingOverlay, _extends({}, props.slotProps?.loadingOverlay));
|
|
25
|
+
}
|
|
26
|
+
if (noData) {
|
|
27
|
+
const NoDataOverlay = props.slots?.noDataOverlay ?? ChartsNoDataOverlay;
|
|
28
|
+
return /*#__PURE__*/_jsx(NoDataOverlay, _extends({}, props.slotProps?.noDataOverlay));
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
@@ -52,7 +52,7 @@ process.env.NODE_ENV !== "production" ? ChartsReferenceLine.propTypes = {
|
|
|
52
52
|
*/
|
|
53
53
|
lineStyle: PropTypes.object,
|
|
54
54
|
/**
|
|
55
|
-
* Additional space
|
|
55
|
+
* Additional space around the label in px.
|
|
56
56
|
* Can be a number or an object `{ x, y }` to distinguish space with the reference line and space with axes.
|
|
57
57
|
* @default 5
|
|
58
58
|
*/
|
|
@@ -5,8 +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 { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
9
|
const getTextParams = ({
|
|
11
10
|
top,
|
|
12
11
|
height,
|
|
@@ -5,8 +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 { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
9
|
const getTextParams = ({
|
|
11
10
|
left,
|
|
12
11
|
width,
|
package/modern/ChartsSurface.js
CHANGED
|
@@ -5,8 +5,7 @@ import { styled } from '@mui/material/styles';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { useAxisEvents } from './hooks/useAxisEvents';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
9
|
const ChartChartsSurfaceStyles = styled('svg', {
|
|
11
10
|
name: 'MuiChartsSurface',
|
|
12
11
|
slot: 'Root'
|