@mui/x-charts 7.10.0 → 7.11.1
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 +2 -2
- package/BarChart/BarElement.d.ts +2 -1
- package/BarChart/BarLabel/BarLabelItem.d.ts +2 -1
- 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 +2 -2
- package/BarChart/useBarChartProps.js +38 -33
- package/CHANGELOG.md +169 -0
- package/ChartContainer/ChartContainer.d.ts +28 -2
- package/ChartContainer/ChartContainer.js +25 -66
- package/ChartContainer/useChartContainerHooks.d.ts +1 -1
- package/ChartContainer/useChartContainerHooks.js +2 -2
- package/ChartContainer/useChartContainerProps.d.ts +86 -0
- package/ChartContainer/useChartContainerProps.js +95 -0
- package/ChartContainer/useDefaultizeAxis.d.ts +36 -0
- package/ChartContainer/useDefaultizeAxis.js +29 -0
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsLegend/ChartsLegend.d.ts +3 -12
- package/ChartsLegend/ContinuousColorLegend.d.ts +65 -0
- package/ChartsLegend/ContinuousColorLegend.js +398 -0
- package/ChartsLegend/DefaultChartsLegend.d.ts +7 -50
- package/ChartsLegend/DefaultChartsLegend.js +13 -198
- package/ChartsLegend/LegendPerItem.d.ts +61 -0
- package/ChartsLegend/LegendPerItem.js +151 -0
- package/ChartsLegend/PiecewiseColorLegend.d.ts +26 -0
- package/ChartsLegend/PiecewiseColorLegend.js +169 -0
- package/ChartsLegend/chartsLegend.types.d.ts +31 -0
- package/ChartsLegend/chartsLegend.types.js +5 -0
- package/ChartsLegend/index.d.ts +2 -0
- package/ChartsLegend/index.js +22 -0
- package/ChartsLegend/legend.types.d.ts +62 -0
- package/ChartsLegend/legend.types.js +5 -0
- package/ChartsLegend/legendItemsPlacement.d.ts +3 -0
- package/ChartsLegend/legendItemsPlacement.js +79 -0
- package/ChartsLegend/useAxis.d.ts +7 -0
- package/ChartsLegend/useAxis.js +47 -0
- package/ChartsLegend/utils.d.ts +1 -8
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/ChartsOverlay/ChartsOverlay.d.ts +3 -2
- package/ChartsReferenceLine/ChartsReferenceLine.d.ts +1 -1
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
- package/ChartsSurface.js +3 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +7 -3
- package/ChartsTooltip/ChartsItemTooltipContent.js +4 -4
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +30 -20
- package/ChartsXAxis/ChartsXAxis.js +1 -1
- package/ChartsYAxis/ChartsYAxis.js +15 -3
- package/Gauge/Gauge.d.ts +1 -4
- package/Gauge/Gauge.js +9 -6
- package/Gauge/GaugeContainer.js +8 -4
- package/Gauge/GaugeProvider.js +9 -9
- package/LineChart/AnimatedArea.js +2 -2
- package/LineChart/AnimatedLine.js +2 -2
- package/LineChart/AreaElement.d.ts +2 -1
- package/LineChart/AreaPlot.js +10 -6
- package/LineChart/LineChart.js +5 -2
- package/LineChart/LineElement.d.ts +2 -1
- package/LineChart/LineHighlightPlot.d.ts +2 -1
- package/LineChart/LineHighlightPlot.js +17 -5
- package/LineChart/LinePlot.js +10 -6
- package/LineChart/MarkElement.js +2 -2
- package/LineChart/MarkPlot.js +13 -25
- package/LineChart/extremums.js +4 -1
- package/LineChart/formatter.js +2 -2
- package/LineChart/useLineChartProps.js +38 -33
- package/PieChart/PieArc.js +1 -0
- package/PieChart/PieChart.d.ts +1 -4
- package/PieChart/PieChart.js +40 -34
- package/PieChart/PiePlot.js +6 -6
- package/PieChart/getPieCoordinates.js +3 -3
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -20
- package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +5 -1
- package/ResponsiveChartContainer/useChartContainerDimensions.js +8 -4
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +20 -0
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +73 -0
- package/ScatterChart/Scatter.js +6 -9
- package/ScatterChart/ScatterChart.js +4 -1
- package/ScatterChart/ScatterPlot.js +6 -3
- package/ScatterChart/extremums.js +8 -2
- package/ScatterChart/useScatterChartProps.js +35 -30
- package/SparkLineChart/SparkLineChart.js +27 -22
- package/context/CartesianProvider/CartesianContext.d.ts +1 -1
- package/context/CartesianProvider/CartesianProvider.d.ts +2 -3
- package/context/CartesianProvider/CartesianProvider.js +18 -7
- package/context/CartesianProvider/computeValue.d.ts +32 -9
- package/context/CartesianProvider/computeValue.js +20 -16
- package/context/CartesianProvider/defaultizeAxis.d.ts +36 -0
- package/context/CartesianProvider/defaultizeAxis.js +21 -0
- package/context/CartesianProvider/index.d.ts +0 -1
- package/context/CartesianProvider/index.js +1 -3
- package/context/CartesianProvider/normalizeAxis.d.ts +1 -1
- package/context/CartesianProvider/normalizeAxis.js +2 -2
- package/context/DrawingProvider.d.ts +12 -0
- package/context/DrawingProvider.js +15 -2
- package/context/HighlightedProvider/HighlightedProvider.js +2 -2
- package/context/SeriesContextProvider.js +1 -1
- package/context/ZAxisContextProvider.d.ts +1 -1
- package/context/ZAxisContextProvider.js +1 -1
- package/esm/BarChart/BarChart.js +2 -2
- 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 +2 -2
- package/esm/BarChart/useBarChartProps.js +38 -33
- package/esm/ChartContainer/ChartContainer.js +25 -66
- package/esm/ChartContainer/useChartContainerHooks.js +2 -2
- package/esm/ChartContainer/useChartContainerProps.js +87 -0
- package/esm/ChartContainer/useDefaultizeAxis.js +19 -0
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/esm/ChartsLegend/ContinuousColorLegend.js +390 -0
- package/esm/ChartsLegend/DefaultChartsLegend.js +14 -198
- package/esm/ChartsLegend/LegendPerItem.js +141 -0
- package/esm/ChartsLegend/PiecewiseColorLegend.js +161 -0
- package/esm/ChartsLegend/chartsLegend.types.js +1 -0
- package/esm/ChartsLegend/index.js +2 -0
- package/esm/ChartsLegend/legend.types.js +1 -0
- package/esm/ChartsLegend/legendItemsPlacement.js +72 -0
- package/esm/ChartsLegend/useAxis.js +39 -0
- 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/ChartsSurface.js +3 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +7 -3
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +4 -4
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +30 -20
- package/esm/ChartsXAxis/ChartsXAxis.js +1 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +15 -3
- package/esm/Gauge/Gauge.js +8 -5
- package/esm/Gauge/GaugeContainer.js +8 -4
- package/esm/Gauge/GaugeProvider.js +1 -1
- package/esm/LineChart/AnimatedArea.js +1 -1
- package/esm/LineChart/AnimatedLine.js +1 -1
- package/esm/LineChart/AreaPlot.js +10 -6
- package/esm/LineChart/LineChart.js +5 -2
- package/esm/LineChart/LineHighlightPlot.js +17 -5
- package/esm/LineChart/LinePlot.js +10 -6
- package/esm/LineChart/MarkElement.js +1 -1
- package/esm/LineChart/MarkPlot.js +12 -24
- package/esm/LineChart/extremums.js +4 -1
- package/esm/LineChart/formatter.js +2 -2
- package/esm/LineChart/useLineChartProps.js +38 -33
- package/esm/PieChart/PieArc.js +1 -0
- package/esm/PieChart/PieChart.js +39 -33
- package/esm/PieChart/PiePlot.js +1 -1
- package/esm/PieChart/getPieCoordinates.js +1 -1
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -20
- package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +8 -4
- package/esm/ResponsiveChartContainer/useResponsiveChartContainerProps.js +65 -0
- package/esm/ScatterChart/Scatter.js +6 -9
- package/esm/ScatterChart/ScatterChart.js +4 -1
- package/esm/ScatterChart/ScatterPlot.js +6 -3
- package/esm/ScatterChart/extremums.js +8 -2
- package/esm/ScatterChart/useScatterChartProps.js +35 -30
- package/esm/SparkLineChart/SparkLineChart.js +27 -22
- package/esm/context/CartesianProvider/CartesianProvider.js +18 -7
- package/esm/context/CartesianProvider/computeValue.js +20 -16
- package/esm/context/CartesianProvider/defaultizeAxis.js +13 -0
- package/esm/context/CartesianProvider/index.js +1 -3
- package/esm/context/CartesianProvider/normalizeAxis.js +2 -2
- package/esm/context/DrawingProvider.js +15 -2
- package/esm/context/HighlightedProvider/HighlightedProvider.js +2 -2
- package/esm/context/SeriesContextProvider.js +1 -1
- package/esm/context/ZAxisContextProvider.js +1 -1
- package/esm/hooks/useAxisEvents.js +14 -17
- package/esm/hooks/useDrawingArea.js +5 -3
- package/esm/hooks/useReducedMotion.js +4 -2
- package/esm/internals/SlotComponentPropsFromProps.js +1 -0
- package/esm/internals/cleanId.js +6 -0
- package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -2
- package/esm/internals/geometry.js +1 -1
- package/esm/internals/{utils.js → getPercentageValue.js} +1 -13
- package/esm/internals/getSymbol.js +5 -0
- package/esm/internals/index.js +3 -1
- package/esm/internals/isDefined.js +3 -0
- package/esm/internals/notNull.js +3 -0
- package/esm/internals/ts-generic.js +1 -0
- package/esm/internals/warning.js +19 -11
- package/hooks/useAxisEvents.js +14 -17
- package/hooks/useDrawingArea.js +5 -3
- package/hooks/useReducedMotion.js +4 -2
- package/index.js +1 -1
- package/internals/SlotComponentPropsFromProps.d.ts +1 -0
- package/internals/SlotComponentPropsFromProps.js +5 -0
- package/internals/cleanId.d.ts +4 -0
- package/internals/cleanId.js +12 -0
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.d.ts +6 -0
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -2
- package/internals/defaultizeColor.d.ts +7 -0
- package/internals/geometry.js +1 -1
- package/internals/getPercentageValue.d.ts +7 -0
- package/internals/{utils.js → getPercentageValue.js} +1 -15
- package/internals/getSymbol.d.ts +2 -0
- package/internals/getSymbol.js +11 -0
- package/internals/index.d.ts +3 -1
- package/internals/index.js +25 -5
- package/internals/isDefined.d.ts +1 -0
- package/internals/isDefined.js +9 -0
- package/internals/notNull.d.ts +1 -0
- package/internals/notNull.js +9 -0
- package/internals/ts-generic.d.ts +5 -0
- package/internals/ts-generic.js +5 -0
- package/internals/warning.d.ts +2 -1
- package/internals/warning.js +21 -12
- package/models/axis.d.ts +5 -2
- package/models/helpers.d.ts +1 -0
- package/models/seriesType/common.d.ts +10 -0
- package/models/seriesType/config.d.ts +2 -16
- package/models/seriesType/scatter.d.ts +5 -0
- package/modern/BarChart/BarChart.js +2 -2
- 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 +2 -2
- package/modern/BarChart/useBarChartProps.js +38 -33
- package/modern/ChartContainer/ChartContainer.js +25 -66
- package/modern/ChartContainer/useChartContainerHooks.js +2 -2
- package/modern/ChartContainer/useChartContainerProps.js +87 -0
- package/modern/ChartContainer/useDefaultizeAxis.js +19 -0
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/modern/ChartsLegend/ContinuousColorLegend.js +390 -0
- package/modern/ChartsLegend/DefaultChartsLegend.js +14 -198
- package/modern/ChartsLegend/LegendPerItem.js +141 -0
- package/modern/ChartsLegend/PiecewiseColorLegend.js +161 -0
- package/modern/ChartsLegend/chartsLegend.types.js +1 -0
- package/modern/ChartsLegend/index.js +2 -0
- package/modern/ChartsLegend/legend.types.js +1 -0
- package/modern/ChartsLegend/legendItemsPlacement.js +72 -0
- package/modern/ChartsLegend/useAxis.js +39 -0
- 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/ChartsSurface.js +3 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +7 -3
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +4 -4
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +30 -20
- package/modern/ChartsXAxis/ChartsXAxis.js +1 -1
- package/modern/ChartsYAxis/ChartsYAxis.js +15 -3
- package/modern/Gauge/Gauge.js +8 -5
- package/modern/Gauge/GaugeContainer.js +8 -4
- package/modern/Gauge/GaugeProvider.js +1 -1
- package/modern/LineChart/AnimatedArea.js +1 -1
- package/modern/LineChart/AnimatedLine.js +1 -1
- package/modern/LineChart/AreaPlot.js +10 -6
- package/modern/LineChart/LineChart.js +5 -2
- package/modern/LineChart/LineHighlightPlot.js +17 -5
- package/modern/LineChart/LinePlot.js +10 -6
- package/modern/LineChart/MarkElement.js +1 -1
- package/modern/LineChart/MarkPlot.js +12 -24
- package/modern/LineChart/extremums.js +4 -1
- package/modern/LineChart/formatter.js +2 -2
- package/modern/LineChart/useLineChartProps.js +38 -33
- package/modern/PieChart/PieArc.js +1 -0
- package/modern/PieChart/PieChart.js +39 -33
- package/modern/PieChart/PiePlot.js +1 -1
- package/modern/PieChart/getPieCoordinates.js +1 -1
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -20
- package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +8 -4
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +65 -0
- package/modern/ScatterChart/Scatter.js +6 -9
- package/modern/ScatterChart/ScatterChart.js +4 -1
- package/modern/ScatterChart/ScatterPlot.js +6 -3
- package/modern/ScatterChart/extremums.js +8 -2
- package/modern/ScatterChart/useScatterChartProps.js +35 -30
- package/modern/SparkLineChart/SparkLineChart.js +27 -22
- package/modern/context/CartesianProvider/CartesianProvider.js +18 -7
- package/modern/context/CartesianProvider/computeValue.js +20 -16
- package/modern/context/CartesianProvider/defaultizeAxis.js +13 -0
- package/modern/context/CartesianProvider/index.js +1 -3
- package/modern/context/CartesianProvider/normalizeAxis.js +2 -2
- package/modern/context/DrawingProvider.js +15 -2
- package/modern/context/HighlightedProvider/HighlightedProvider.js +2 -2
- package/modern/context/SeriesContextProvider.js +1 -1
- package/modern/context/ZAxisContextProvider.js +1 -1
- package/modern/hooks/useAxisEvents.js +14 -17
- package/modern/hooks/useDrawingArea.js +5 -3
- package/modern/hooks/useReducedMotion.js +4 -2
- package/modern/index.js +1 -1
- package/modern/internals/SlotComponentPropsFromProps.js +1 -0
- package/modern/internals/cleanId.js +6 -0
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -2
- package/modern/internals/geometry.js +1 -1
- package/modern/internals/{utils.js → getPercentageValue.js} +1 -13
- package/modern/internals/getSymbol.js +5 -0
- package/modern/internals/index.js +3 -1
- package/modern/internals/isDefined.js +3 -0
- package/modern/internals/notNull.js +3 -0
- package/modern/internals/ts-generic.js +1 -0
- package/modern/internals/warning.js +19 -11
- package/package.json +4 -4
- package/internals/utils.d.ts +0 -18
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "tooltip", "onAxisClick", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "legend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
2
4
|
import useId from '@mui/utils/useId';
|
|
3
5
|
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
4
6
|
/**
|
|
@@ -10,39 +12,41 @@ import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
|
10
12
|
*/
|
|
11
13
|
export const useLineChartProps = props => {
|
|
12
14
|
const {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
15
|
+
xAxis,
|
|
16
|
+
yAxis,
|
|
17
|
+
series,
|
|
18
|
+
width,
|
|
19
|
+
height,
|
|
20
|
+
margin,
|
|
21
|
+
colors,
|
|
22
|
+
dataset,
|
|
23
|
+
sx,
|
|
24
|
+
tooltip,
|
|
25
|
+
onAxisClick,
|
|
26
|
+
onAreaClick,
|
|
27
|
+
onLineClick,
|
|
28
|
+
onMarkClick,
|
|
29
|
+
axisHighlight,
|
|
30
|
+
disableLineItemHighlight,
|
|
31
|
+
legend,
|
|
32
|
+
grid,
|
|
33
|
+
topAxis,
|
|
34
|
+
leftAxis,
|
|
35
|
+
rightAxis,
|
|
36
|
+
bottomAxis,
|
|
37
|
+
children,
|
|
38
|
+
slots,
|
|
39
|
+
slotProps,
|
|
40
|
+
skipAnimation,
|
|
41
|
+
loading,
|
|
42
|
+
highlightedItem,
|
|
43
|
+
onHighlightChange,
|
|
44
|
+
className
|
|
45
|
+
} = props,
|
|
46
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
43
47
|
const id = useId();
|
|
44
48
|
const clipPathId = `${id}-clip-path`;
|
|
45
|
-
const chartContainerProps = {
|
|
49
|
+
const chartContainerProps = _extends({}, other, {
|
|
46
50
|
series: series.map(s => _extends({
|
|
47
51
|
disableHighlight: !!disableLineItemHighlight,
|
|
48
52
|
type: 'line'
|
|
@@ -63,8 +67,9 @@ export const useLineChartProps = props => {
|
|
|
63
67
|
sx,
|
|
64
68
|
highlightedItem,
|
|
65
69
|
onHighlightChange,
|
|
66
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick
|
|
67
|
-
|
|
70
|
+
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
71
|
+
className
|
|
72
|
+
});
|
|
68
73
|
const axisClickHandlerProps = {
|
|
69
74
|
onAxisClick
|
|
70
75
|
};
|
package/esm/PieChart/PieArc.js
CHANGED
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "sx", "tooltip", "axisHighlight", "skipAnimation", "legend", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import { ResponsiveChartContainer } from '../ResponsiveChartContainer';
|
|
@@ -34,37 +36,39 @@ const defaultRTLMargin = {
|
|
|
34
36
|
*
|
|
35
37
|
* - [PieChart API](https://mui.com/x/api/charts/pie-chart/)
|
|
36
38
|
*/
|
|
37
|
-
function PieChart(props) {
|
|
39
|
+
const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(props, ref) {
|
|
38
40
|
const {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
41
|
+
xAxis,
|
|
42
|
+
yAxis,
|
|
43
|
+
series,
|
|
44
|
+
width,
|
|
45
|
+
height,
|
|
46
|
+
margin: marginProps,
|
|
47
|
+
colors,
|
|
48
|
+
sx,
|
|
49
|
+
tooltip = {
|
|
50
|
+
trigger: 'item'
|
|
51
|
+
},
|
|
52
|
+
axisHighlight = {
|
|
53
|
+
x: 'none',
|
|
54
|
+
y: 'none'
|
|
55
|
+
},
|
|
56
|
+
skipAnimation,
|
|
57
|
+
legend: legendProps,
|
|
58
|
+
topAxis = null,
|
|
59
|
+
leftAxis = null,
|
|
60
|
+
rightAxis = null,
|
|
61
|
+
bottomAxis = null,
|
|
62
|
+
children,
|
|
63
|
+
slots,
|
|
64
|
+
slotProps,
|
|
65
|
+
onItemClick,
|
|
66
|
+
loading,
|
|
67
|
+
highlightedItem,
|
|
68
|
+
onHighlightChange,
|
|
69
|
+
className
|
|
70
|
+
} = props,
|
|
71
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
68
72
|
const isRTL = useIsRTL();
|
|
69
73
|
const margin = _extends({}, isRTL ? defaultRTLMargin : defaultMargin, marginProps);
|
|
70
74
|
const legend = _extends({
|
|
@@ -74,7 +78,8 @@ function PieChart(props) {
|
|
|
74
78
|
horizontal: isRTL ? 'left' : 'right'
|
|
75
79
|
}
|
|
76
80
|
}, legendProps);
|
|
77
|
-
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
|
|
81
|
+
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, _extends({}, other, {
|
|
82
|
+
ref: ref,
|
|
78
83
|
series: series.map(s => _extends({
|
|
79
84
|
type: 'pie'
|
|
80
85
|
}, s)),
|
|
@@ -92,6 +97,7 @@ function PieChart(props) {
|
|
|
92
97
|
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
93
98
|
highlightedItem: highlightedItem,
|
|
94
99
|
onHighlightChange: onHighlightChange,
|
|
100
|
+
className: className,
|
|
95
101
|
children: [/*#__PURE__*/_jsx(ChartsAxis, {
|
|
96
102
|
topAxis: topAxis,
|
|
97
103
|
leftAxis: leftAxis,
|
|
@@ -115,8 +121,8 @@ function PieChart(props) {
|
|
|
115
121
|
slots: slots,
|
|
116
122
|
slotProps: slotProps
|
|
117
123
|
})), children]
|
|
118
|
-
});
|
|
119
|
-
}
|
|
124
|
+
}));
|
|
125
|
+
});
|
|
120
126
|
process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
121
127
|
// ----------------------------- Warning --------------------------------
|
|
122
128
|
// | These PropTypes are generated from the TypeScript type definitions |
|
package/esm/PieChart/PiePlot.js
CHANGED
|
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { DrawingContext } from '../context/DrawingProvider';
|
|
4
4
|
import { PieArcPlot } from './PieArcPlot';
|
|
5
5
|
import { PieArcLabelPlot } from './PieArcLabelPlot';
|
|
6
|
-
import { getPercentageValue } from '../internals/
|
|
6
|
+
import { getPercentageValue } from '../internals/getPercentageValue';
|
|
7
7
|
import { getPieCoordinates } from './getPieCoordinates';
|
|
8
8
|
import { usePieSeries } from '../hooks/useSeries';
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["width", "height"];
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
6
4
|
import { ChartContainer } from '../ChartContainer';
|
|
7
|
-
import { useChartContainerDimensions } from './useChartContainerDimensions';
|
|
8
5
|
import { ResizableContainer } from './ResizableContainer';
|
|
6
|
+
import { useResponsiveChartContainerProps } from './useResponsiveChartContainerProps';
|
|
9
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
8
|
const ResponsiveChartContainer = /*#__PURE__*/React.forwardRef(function ResponsiveChartContainer(props, ref) {
|
|
11
9
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
ownerState: {
|
|
20
|
-
width: inWidth,
|
|
21
|
-
height: inHeight
|
|
22
|
-
},
|
|
23
|
-
children: width && height ? /*#__PURE__*/_jsx(ChartContainer, _extends({}, other, {
|
|
24
|
-
width: width,
|
|
25
|
-
height: height,
|
|
26
|
-
ref: ref
|
|
27
|
-
})) : null
|
|
28
|
-
});
|
|
10
|
+
hasIntrinsicSize,
|
|
11
|
+
chartContainerProps,
|
|
12
|
+
resizableChartContainerProps
|
|
13
|
+
} = useResponsiveChartContainerProps(props, ref);
|
|
14
|
+
return /*#__PURE__*/_jsx(ResizableContainer, _extends({}, resizableChartContainerProps, {
|
|
15
|
+
children: hasIntrinsicSize ? /*#__PURE__*/_jsx(ChartContainer, _extends({}, chartContainerProps)) : null
|
|
16
|
+
}));
|
|
29
17
|
});
|
|
30
18
|
process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
31
19
|
// ----------------------------- Warning --------------------------------
|
|
@@ -2,8 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
3
3
|
import ownerWindow from '@mui/utils/ownerWindow';
|
|
4
4
|
export const useChartContainerDimensions = (inWidth, inHeight) => {
|
|
5
|
-
const rootRef = React.useRef(null);
|
|
6
5
|
const displayError = React.useRef(false);
|
|
6
|
+
const rootRef = React.useRef(null);
|
|
7
7
|
const [width, setWidth] = React.useState(0);
|
|
8
8
|
const [height, setHeight] = React.useState(0);
|
|
9
9
|
|
|
@@ -54,13 +54,17 @@ 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
|
}
|
|
65
|
-
return
|
|
65
|
+
return {
|
|
66
|
+
containerRef: rootRef,
|
|
67
|
+
width: inWidth ?? width,
|
|
68
|
+
height: inHeight ?? height
|
|
69
|
+
};
|
|
66
70
|
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "sx", "title", "viewBox", "xAxis", "yAxis", "zAxis"];
|
|
4
|
+
import { useChartContainerDimensions } from './useChartContainerDimensions';
|
|
5
|
+
export const useResponsiveChartContainerProps = (props, ref) => {
|
|
6
|
+
const {
|
|
7
|
+
width,
|
|
8
|
+
height,
|
|
9
|
+
margin,
|
|
10
|
+
children,
|
|
11
|
+
series,
|
|
12
|
+
colors,
|
|
13
|
+
dataset,
|
|
14
|
+
desc,
|
|
15
|
+
disableAxisListener,
|
|
16
|
+
highlightedItem,
|
|
17
|
+
onHighlightChange,
|
|
18
|
+
plugins,
|
|
19
|
+
sx,
|
|
20
|
+
title,
|
|
21
|
+
viewBox,
|
|
22
|
+
xAxis,
|
|
23
|
+
yAxis,
|
|
24
|
+
zAxis
|
|
25
|
+
} = props,
|
|
26
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
27
|
+
const {
|
|
28
|
+
containerRef,
|
|
29
|
+
width: dWidth,
|
|
30
|
+
height: dHeight
|
|
31
|
+
} = useChartContainerDimensions(width, height);
|
|
32
|
+
const resizableChartContainerProps = _extends({}, other, {
|
|
33
|
+
ownerState: {
|
|
34
|
+
width,
|
|
35
|
+
height
|
|
36
|
+
},
|
|
37
|
+
ref: containerRef
|
|
38
|
+
});
|
|
39
|
+
const chartContainerProps = {
|
|
40
|
+
margin,
|
|
41
|
+
children,
|
|
42
|
+
series,
|
|
43
|
+
colors,
|
|
44
|
+
dataset,
|
|
45
|
+
desc,
|
|
46
|
+
disableAxisListener,
|
|
47
|
+
highlightedItem,
|
|
48
|
+
onHighlightChange,
|
|
49
|
+
plugins,
|
|
50
|
+
sx,
|
|
51
|
+
title,
|
|
52
|
+
viewBox,
|
|
53
|
+
xAxis,
|
|
54
|
+
yAxis,
|
|
55
|
+
zAxis,
|
|
56
|
+
width: dWidth,
|
|
57
|
+
height: dHeight,
|
|
58
|
+
ref
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
hasIntrinsicSize: dWidth && dHeight,
|
|
62
|
+
chartContainerProps,
|
|
63
|
+
resizableChartContainerProps
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -27,10 +27,7 @@ function Scatter(props) {
|
|
|
27
27
|
markerSize,
|
|
28
28
|
onItemClick
|
|
29
29
|
} = props;
|
|
30
|
-
const
|
|
31
|
-
left,
|
|
32
|
-
width
|
|
33
|
-
} = useDrawingArea();
|
|
30
|
+
const drawingArea = useDrawingArea();
|
|
34
31
|
const {
|
|
35
32
|
useVoronoiInteraction
|
|
36
33
|
} = React.useContext(InteractionContext);
|
|
@@ -43,15 +40,15 @@ function Scatter(props) {
|
|
|
43
40
|
const cleanData = React.useMemo(() => {
|
|
44
41
|
const getXPosition = getValueToPositionMapper(xScale);
|
|
45
42
|
const getYPosition = getValueToPositionMapper(yScale);
|
|
46
|
-
const yRange = yScale.range();
|
|
47
|
-
const minYRange = Math.min(...yRange);
|
|
48
|
-
const maxYRange = Math.max(...yRange);
|
|
49
43
|
const temp = [];
|
|
50
44
|
for (let i = 0; i < series.data.length; i += 1) {
|
|
51
45
|
const scatterPoint = series.data[i];
|
|
52
46
|
const x = getXPosition(scatterPoint.x);
|
|
53
47
|
const y = getYPosition(scatterPoint.y);
|
|
54
|
-
const isInRange =
|
|
48
|
+
const isInRange = drawingArea.isPointInside({
|
|
49
|
+
x,
|
|
50
|
+
y
|
|
51
|
+
});
|
|
55
52
|
const pointCtx = {
|
|
56
53
|
type: 'scatter',
|
|
57
54
|
seriesId: series.id,
|
|
@@ -76,7 +73,7 @@ function Scatter(props) {
|
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
return temp;
|
|
79
|
-
}, [xScale, yScale,
|
|
76
|
+
}, [xScale, yScale, drawingArea, series.data, series.id, isHighlighted, isFaded, getInteractionItemProps, colorGetter, color]);
|
|
80
77
|
return /*#__PURE__*/_jsx("g", {
|
|
81
78
|
children: cleanData.map(dataPoint => /*#__PURE__*/_jsx("circle", _extends({
|
|
82
79
|
cx: 0,
|
|
@@ -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
|
});
|
|
@@ -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,
|
|
@@ -13,7 +13,10 @@ export const getExtremumX = params => {
|
|
|
13
13
|
axis,
|
|
14
14
|
isDefaultAxis
|
|
15
15
|
} = params;
|
|
16
|
-
return Object.keys(series).filter(seriesId =>
|
|
16
|
+
return Object.keys(series).filter(seriesId => {
|
|
17
|
+
const axisId = series[seriesId].xAxisId ?? series[seriesId].xAxisKey;
|
|
18
|
+
return axisId === axis.id || axisId === undefined && isDefaultAxis;
|
|
19
|
+
}).reduce((acc, seriesId) => {
|
|
17
20
|
const seriesMinMax = series[seriesId].data.reduce((accSeries, {
|
|
18
21
|
x
|
|
19
22
|
}) => {
|
|
@@ -29,7 +32,10 @@ export const getExtremumY = params => {
|
|
|
29
32
|
axis,
|
|
30
33
|
isDefaultAxis
|
|
31
34
|
} = params;
|
|
32
|
-
return Object.keys(series).filter(seriesId =>
|
|
35
|
+
return Object.keys(series).filter(seriesId => {
|
|
36
|
+
const axisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey;
|
|
37
|
+
return axisId === axis.id || axisId === undefined && isDefaultAxis;
|
|
38
|
+
}).reduce((acc, seriesId) => {
|
|
33
39
|
const seriesMinMax = series[seriesId].data.reduce((accSeries, {
|
|
34
40
|
y
|
|
35
41
|
}) => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "tooltip", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "legend", "width", "height", "margin", "colors", "sx", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
2
4
|
/**
|
|
3
5
|
* A helper function that extracts ScatterChartProps from the input props
|
|
4
6
|
* and returns an object with props for the children components of ScatterChart.
|
|
@@ -8,34 +10,36 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
8
10
|
*/
|
|
9
11
|
export const useScatterChartProps = props => {
|
|
10
12
|
const {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
13
|
+
xAxis,
|
|
14
|
+
yAxis,
|
|
15
|
+
zAxis,
|
|
16
|
+
series,
|
|
17
|
+
tooltip,
|
|
18
|
+
axisHighlight,
|
|
19
|
+
voronoiMaxRadius,
|
|
20
|
+
disableVoronoi,
|
|
21
|
+
legend,
|
|
22
|
+
width,
|
|
23
|
+
height,
|
|
24
|
+
margin,
|
|
25
|
+
colors,
|
|
26
|
+
sx,
|
|
27
|
+
grid,
|
|
28
|
+
topAxis,
|
|
29
|
+
leftAxis,
|
|
30
|
+
rightAxis,
|
|
31
|
+
bottomAxis,
|
|
32
|
+
onItemClick,
|
|
33
|
+
children,
|
|
34
|
+
slots,
|
|
35
|
+
slotProps,
|
|
36
|
+
loading,
|
|
37
|
+
highlightedItem,
|
|
38
|
+
onHighlightChange,
|
|
39
|
+
className
|
|
40
|
+
} = props,
|
|
41
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
42
|
+
const chartContainerProps = _extends({}, other, {
|
|
39
43
|
series: series.map(s => _extends({
|
|
40
44
|
type: 'scatter'
|
|
41
45
|
}, s)),
|
|
@@ -47,8 +51,9 @@ export const useScatterChartProps = props => {
|
|
|
47
51
|
yAxis,
|
|
48
52
|
sx,
|
|
49
53
|
highlightedItem,
|
|
50
|
-
onHighlightChange
|
|
51
|
-
|
|
54
|
+
onHighlightChange,
|
|
55
|
+
className
|
|
56
|
+
});
|
|
52
57
|
const zAxisProps = {
|
|
53
58
|
zAxis
|
|
54
59
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["xAxis", "yAxis", "width", "height", "margin", "colors", "sx", "showTooltip", "tooltip", "showHighlight", "axisHighlight", "children", "slots", "slotProps", "data", "plotType", "valueFormatter", "area", "curve", "className"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import { BarPlot } from '../BarChart';
|
|
@@ -26,33 +28,35 @@ const SPARKLINE_DEFAULT_MARGIN = {
|
|
|
26
28
|
*/
|
|
27
29
|
const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props, ref) {
|
|
28
30
|
const {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
xAxis,
|
|
32
|
+
yAxis,
|
|
33
|
+
width,
|
|
34
|
+
height,
|
|
35
|
+
margin = SPARKLINE_DEFAULT_MARGIN,
|
|
36
|
+
colors,
|
|
37
|
+
sx,
|
|
38
|
+
showTooltip,
|
|
39
|
+
tooltip,
|
|
40
|
+
showHighlight,
|
|
41
|
+
axisHighlight: inAxisHighlight,
|
|
42
|
+
children,
|
|
43
|
+
slots,
|
|
44
|
+
slotProps,
|
|
45
|
+
data,
|
|
46
|
+
plotType = 'line',
|
|
47
|
+
valueFormatter = value => value === null ? '' : value.toString(),
|
|
48
|
+
area,
|
|
49
|
+
curve = 'linear',
|
|
50
|
+
className
|
|
51
|
+
} = props,
|
|
52
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
49
53
|
const defaultXHighlight = showHighlight && plotType === 'bar' ? {
|
|
50
54
|
x: 'band'
|
|
51
55
|
} : {
|
|
52
56
|
x: 'none'
|
|
53
57
|
};
|
|
54
58
|
const axisHighlight = _extends({}, defaultXHighlight, inAxisHighlight);
|
|
55
|
-
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
|
|
59
|
+
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, _extends({}, other, {
|
|
56
60
|
ref: ref,
|
|
57
61
|
series: [_extends({
|
|
58
62
|
type: plotType,
|
|
@@ -66,6 +70,7 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
66
70
|
width: width,
|
|
67
71
|
height: height,
|
|
68
72
|
margin: margin,
|
|
73
|
+
className: className,
|
|
69
74
|
xAxis: [_extends({
|
|
70
75
|
id: DEFAULT_X_AXIS_KEY,
|
|
71
76
|
scaleType: plotType === 'bar' ? 'band' : 'point',
|
|
@@ -104,7 +109,7 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
104
109
|
slotProps: slotProps,
|
|
105
110
|
slots: slots
|
|
106
111
|
})), children]
|
|
107
|
-
});
|
|
112
|
+
}));
|
|
108
113
|
});
|
|
109
114
|
process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
110
115
|
// ----------------------------- Warning --------------------------------
|