@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
package/Gauge/GaugeContainer.js
CHANGED
|
@@ -9,8 +9,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
13
12
|
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
14
14
|
var _useChartContainerDimensions = require("../ResponsiveChartContainer/useChartContainerDimensions");
|
|
15
15
|
var _ChartsSurface = require("../ChartsSurface");
|
|
16
16
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
@@ -63,9 +63,13 @@ const GaugeContainer = exports.GaugeContainer = /*#__PURE__*/React.forwardRef(fu
|
|
|
63
63
|
children
|
|
64
64
|
} = props,
|
|
65
65
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
66
|
-
const
|
|
66
|
+
const {
|
|
67
|
+
containerRef,
|
|
68
|
+
width,
|
|
69
|
+
height
|
|
70
|
+
} = (0, _useChartContainerDimensions.useChartContainerDimensions)(inWidth, inHeight);
|
|
67
71
|
const svgRef = React.useRef(null);
|
|
68
|
-
const
|
|
72
|
+
const chartSurfaceRef = (0, _useForkRef.default)(ref, svgRef);
|
|
69
73
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ResizableContainer, (0, _extends2.default)({
|
|
70
74
|
ref: containerRef,
|
|
71
75
|
ownerState: {
|
|
@@ -101,7 +105,7 @@ const GaugeContainer = exports.GaugeContainer = /*#__PURE__*/React.forwardRef(fu
|
|
|
101
105
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSurface.ChartsSurface, {
|
|
102
106
|
width: width,
|
|
103
107
|
height: height,
|
|
104
|
-
ref:
|
|
108
|
+
ref: chartSurfaceRef,
|
|
105
109
|
title: title,
|
|
106
110
|
desc: desc,
|
|
107
111
|
disableAxisListener: true,
|
package/Gauge/GaugeProvider.js
CHANGED
|
@@ -7,8 +7,8 @@ exports.GaugeContext = void 0;
|
|
|
7
7
|
exports.GaugeProvider = GaugeProvider;
|
|
8
8
|
exports.useGaugeState = useGaugeState;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _getPercentageValue = require("../internals/getPercentageValue");
|
|
11
|
+
var _utils = require("./utils");
|
|
12
12
|
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -52,12 +52,12 @@ function GaugeProvider(props) {
|
|
|
52
52
|
width,
|
|
53
53
|
height
|
|
54
54
|
} = (0, _useDrawingArea.useDrawingArea)();
|
|
55
|
-
const ratios = (0,
|
|
56
|
-
const innerCx = cxParam ? (0,
|
|
57
|
-
const innerCy = cyParam ? (0,
|
|
55
|
+
const ratios = (0, _utils.getArcRatios)(startAngle, endAngle);
|
|
56
|
+
const innerCx = cxParam ? (0, _getPercentageValue.getPercentageValue)(cxParam, width) : ratios.cx * width;
|
|
57
|
+
const innerCy = cyParam ? (0, _getPercentageValue.getPercentageValue)(cyParam, height) : ratios.cy * height;
|
|
58
58
|
let cx = left + innerCx;
|
|
59
59
|
let cy = top + innerCy;
|
|
60
|
-
const maxRadius = (0,
|
|
60
|
+
const maxRadius = (0, _utils.getAvailableRadius)(innerCx, innerCy, width, height, ratios);
|
|
61
61
|
|
|
62
62
|
// If the center is not defined, after computation of the available radius, update the center to use the remaining space.
|
|
63
63
|
if (cxParam === undefined) {
|
|
@@ -68,9 +68,9 @@ function GaugeProvider(props) {
|
|
|
68
68
|
const usedHeight = maxRadius * (ratios.maxY - ratios.minY);
|
|
69
69
|
cy = top + (height - usedHeight) / 2 + ratios.cy * usedHeight;
|
|
70
70
|
}
|
|
71
|
-
const outerRadius = (0,
|
|
72
|
-
const innerRadius = (0,
|
|
73
|
-
const cornerRadius = (0,
|
|
71
|
+
const outerRadius = (0, _getPercentageValue.getPercentageValue)(outerRadiusParam ?? maxRadius, maxRadius);
|
|
72
|
+
const innerRadius = (0, _getPercentageValue.getPercentageValue)(innerRadiusParam ?? '80%', maxRadius);
|
|
73
|
+
const cornerRadius = (0, _getPercentageValue.getPercentageValue)(cornerRadiusParam ?? 0, outerRadius - innerRadius);
|
|
74
74
|
const contextValue = React.useMemo(() => {
|
|
75
75
|
const startAngleRad = Math.PI * startAngle / 180;
|
|
76
76
|
const endAngleRad = Math.PI * endAngle / 180;
|
|
@@ -14,7 +14,7 @@ var _styles = require("@mui/material/styles");
|
|
|
14
14
|
var _d3Color = require("d3-color");
|
|
15
15
|
var _web = require("@react-spring/web");
|
|
16
16
|
var _useAnimatedPath = require("../internals/useAnimatedPath");
|
|
17
|
-
var
|
|
17
|
+
var _cleanId = require("../internals/cleanId");
|
|
18
18
|
var _hooks = require("../hooks");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
const _excluded = ["d", "skipAnimation", "ownerState"];
|
|
@@ -71,7 +71,7 @@ function AnimatedArea(props) {
|
|
|
71
71
|
reset: false,
|
|
72
72
|
immediate: skipAnimation
|
|
73
73
|
});
|
|
74
|
-
const clipId = (0,
|
|
74
|
+
const clipId = (0, _cleanId.cleanId)(`${chartId}-${ownerState.id}-area-clip`);
|
|
75
75
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
76
76
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
|
|
77
77
|
id: clipId,
|
|
@@ -14,7 +14,7 @@ var _web = require("@react-spring/web");
|
|
|
14
14
|
var _d3Color = require("d3-color");
|
|
15
15
|
var _styles = require("@mui/material/styles");
|
|
16
16
|
var _useAnimatedPath = require("../internals/useAnimatedPath");
|
|
17
|
-
var
|
|
17
|
+
var _cleanId = require("../internals/cleanId");
|
|
18
18
|
var _useChartId = require("../hooks/useChartId");
|
|
19
19
|
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -74,7 +74,7 @@ function AnimatedLine(props) {
|
|
|
74
74
|
reset: false,
|
|
75
75
|
immediate: skipAnimation
|
|
76
76
|
});
|
|
77
|
-
const clipId = (0,
|
|
77
|
+
const clipId = (0, _cleanId.cleanId)(`${chartId}-${ownerState.id}-line-clip`);
|
|
78
78
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
79
79
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
|
|
80
80
|
id: clipId,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { SlotComponentPropsFromProps } from '../internals/SlotComponentPropsFromProps';
|
|
2
3
|
import { AnimatedAreaProps } from './AnimatedArea';
|
|
3
4
|
import { SeriesId } from '../models/seriesType/common';
|
|
4
5
|
export interface AreaElementClasses {
|
|
@@ -28,7 +29,7 @@ export interface AreaElementSlots {
|
|
|
28
29
|
area?: React.JSXElementConstructor<AnimatedAreaProps>;
|
|
29
30
|
}
|
|
30
31
|
export interface AreaElementSlotProps {
|
|
31
|
-
area?: AnimatedAreaProps
|
|
32
|
+
area?: SlotComponentPropsFromProps<AnimatedAreaProps, {}, AreaElementOwnerState>;
|
|
32
33
|
}
|
|
33
34
|
export interface AreaElementProps extends Omit<AreaElementOwnerState, 'isFaded' | 'isHighlighted'>, Pick<AnimatedAreaProps, 'skipAnimation'>, Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color' | 'id'> {
|
|
34
35
|
d: string;
|
package/LineChart/AreaPlot.js
CHANGED
|
@@ -45,22 +45,26 @@ const useAggregatedData = () => {
|
|
|
45
45
|
return [...groupIds].reverse() // Revert stacked area for a more pleasant animation
|
|
46
46
|
.map(seriesId => {
|
|
47
47
|
const {
|
|
48
|
+
xAxisId: xAxisIdProp,
|
|
49
|
+
yAxisId: yAxisIdProp,
|
|
48
50
|
xAxisKey = defaultXAxisId,
|
|
49
51
|
yAxisKey = defaultYAxisId,
|
|
50
52
|
stackedData,
|
|
51
53
|
data,
|
|
52
54
|
connectNulls
|
|
53
55
|
} = series[seriesId];
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
56
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
57
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
58
|
+
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
59
|
+
const yScale = yAxis[yAxisId].scale;
|
|
60
|
+
const xData = xAxis[xAxisId].data;
|
|
61
|
+
const gradientUsed = yAxis[yAxisId].colorScale && [yAxisId, 'y'] || xAxis[xAxisId].colorScale && [xAxisId, 'x'] || undefined;
|
|
58
62
|
if (process.env.NODE_ENV !== 'production') {
|
|
59
63
|
if (xData === undefined) {
|
|
60
|
-
throw new Error(`MUI X
|
|
64
|
+
throw new Error(`MUI X: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
61
65
|
}
|
|
62
66
|
if (xData.length < stackedData.length) {
|
|
63
|
-
throw new Error(`MUI X
|
|
67
|
+
throw new Error(`MUI X: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => {
|
package/LineChart/LineChart.js
CHANGED
|
@@ -57,8 +57,11 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
|
|
|
57
57
|
ref: ref
|
|
58
58
|
}, chartContainerProps, {
|
|
59
59
|
children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), props.grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
60
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, (0, _extends2.default)({}, areaPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePlot.LinePlot, (0, _extends2.default)({}, linePlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps))]
|
|
61
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
60
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, (0, _extends2.default)({}, areaPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePlot.LinePlot, (0, _extends2.default)({}, linePlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
|
|
61
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
62
|
+
"data-drawing-container": true,
|
|
63
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, (0, _extends2.default)({}, markPlotProps))
|
|
64
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, (0, _extends2.default)({}, lineHighlightPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltipProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
62
65
|
}));
|
|
63
66
|
});
|
|
64
67
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { SlotComponentPropsFromProps } from '../internals/SlotComponentPropsFromProps';
|
|
2
3
|
import { AnimatedLineProps } from './AnimatedLine';
|
|
3
4
|
import { SeriesId } from '../models/seriesType/common';
|
|
4
5
|
export interface LineElementClasses {
|
|
@@ -28,7 +29,7 @@ export interface LineElementSlots {
|
|
|
28
29
|
line?: React.JSXElementConstructor<AnimatedLineProps>;
|
|
29
30
|
}
|
|
30
31
|
export interface LineElementSlotProps {
|
|
31
|
-
line?: AnimatedLineProps
|
|
32
|
+
line?: SlotComponentPropsFromProps<AnimatedLineProps, {}, LineElementOwnerState>;
|
|
32
33
|
}
|
|
33
34
|
export interface LineElementProps extends Omit<LineElementOwnerState, 'isFaded' | 'isHighlighted'>, Pick<AnimatedLineProps, 'skipAnimation'>, Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color' | 'id'> {
|
|
34
35
|
d: string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { SlotComponentPropsFromProps } from '../internals/SlotComponentPropsFromProps';
|
|
2
3
|
import { LineHighlightElementProps } from './LineHighlightElement';
|
|
3
4
|
export interface LineHighlightPlotSlots {
|
|
4
5
|
lineHighlight?: React.JSXElementConstructor<LineHighlightElementProps>;
|
|
5
6
|
}
|
|
6
7
|
export interface LineHighlightPlotSlotProps {
|
|
7
|
-
lineHighlight?:
|
|
8
|
+
lineHighlight?: SlotComponentPropsFromProps<LineHighlightElementProps, {}, {}>;
|
|
8
9
|
}
|
|
9
10
|
export interface LineHighlightPlotProps extends React.SVGAttributes<SVGSVGElement> {
|
|
10
11
|
/**
|
|
@@ -16,6 +16,7 @@ var _InteractionProvider = require("../context/InteractionProvider");
|
|
|
16
16
|
var _constants = require("../constants");
|
|
17
17
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
18
18
|
var _useSeries = require("../hooks/useSeries");
|
|
19
|
+
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
19
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
21
|
const _excluded = ["slots", "slotProps"];
|
|
21
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -38,6 +39,7 @@ function LineHighlightPlot(props) {
|
|
|
38
39
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
39
40
|
const seriesData = (0, _useSeries.useLineSeries)();
|
|
40
41
|
const axisData = (0, _CartesianProvider.useCartesianContext)();
|
|
42
|
+
const drawingArea = (0, _useDrawingArea.useDrawingArea)();
|
|
41
43
|
const {
|
|
42
44
|
axis
|
|
43
45
|
} = React.useContext(_InteractionProvider.InteractionContext);
|
|
@@ -67,25 +69,35 @@ function LineHighlightPlot(props) {
|
|
|
67
69
|
}) => {
|
|
68
70
|
return groupIds.flatMap(seriesId => {
|
|
69
71
|
const {
|
|
72
|
+
xAxisId: xAxisIdProp,
|
|
73
|
+
yAxisId: yAxisIdProp,
|
|
70
74
|
xAxisKey = defaultXAxisId,
|
|
71
75
|
yAxisKey = defaultYAxisId,
|
|
72
76
|
stackedData,
|
|
73
77
|
data,
|
|
74
78
|
disableHighlight
|
|
75
79
|
} = series[seriesId];
|
|
80
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
81
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
76
82
|
if (disableHighlight || data[highlightedIndex] == null) {
|
|
77
83
|
return null;
|
|
78
84
|
}
|
|
79
|
-
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[
|
|
80
|
-
const yScale = yAxis[
|
|
81
|
-
const xData = xAxis[
|
|
85
|
+
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
86
|
+
const yScale = yAxis[yAxisId].scale;
|
|
87
|
+
const xData = xAxis[xAxisId].data;
|
|
82
88
|
if (xData === undefined) {
|
|
83
|
-
throw new Error(`MUI X
|
|
89
|
+
throw new Error(`MUI X: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
84
90
|
}
|
|
85
91
|
const x = xScale(xData[highlightedIndex]);
|
|
86
92
|
const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
|
|
87
93
|
|
|
88
|
-
|
|
94
|
+
if (!drawingArea.isPointInside({
|
|
95
|
+
x,
|
|
96
|
+
y
|
|
97
|
+
})) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
89
101
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({
|
|
90
102
|
id: seriesId,
|
|
91
103
|
color: colorGetter(highlightedIndex),
|
package/LineChart/LinePlot.js
CHANGED
|
@@ -44,22 +44,26 @@ const useAggregatedData = () => {
|
|
|
44
44
|
}) => {
|
|
45
45
|
return groupIds.flatMap(seriesId => {
|
|
46
46
|
const {
|
|
47
|
+
xAxisId: xAxisIdProp,
|
|
48
|
+
yAxisId: yAxisIdProp,
|
|
47
49
|
xAxisKey = defaultXAxisId,
|
|
48
50
|
yAxisKey = defaultYAxisId,
|
|
49
51
|
stackedData,
|
|
50
52
|
data,
|
|
51
53
|
connectNulls
|
|
52
54
|
} = series[seriesId];
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
55
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
56
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
57
|
+
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
58
|
+
const yScale = yAxis[yAxisId].scale;
|
|
59
|
+
const xData = xAxis[xAxisId].data;
|
|
60
|
+
const gradientUsed = yAxis[yAxisId].colorScale && [yAxisId, 'y'] || xAxis[xAxisId].colorScale && [xAxisId, 'x'] || undefined;
|
|
57
61
|
if (process.env.NODE_ENV !== 'production') {
|
|
58
62
|
if (xData === undefined) {
|
|
59
|
-
throw new Error(`MUI X
|
|
63
|
+
throw new Error(`MUI X: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
60
64
|
}
|
|
61
65
|
if (xData.length < stackedData.length) {
|
|
62
|
-
throw new Error(`MUI X
|
|
66
|
+
throw new Error(`MUI X: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
const linePath = (0, _d3Shape.line)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y(d => yScale(d.y[1]));
|
package/LineChart/MarkElement.js
CHANGED
|
@@ -17,7 +17,7 @@ var _styles = require("@mui/material/styles");
|
|
|
17
17
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
18
18
|
var _d3Shape = require("d3-shape");
|
|
19
19
|
var _web = require("@react-spring/web");
|
|
20
|
-
var
|
|
20
|
+
var _getSymbol = require("../internals/getSymbol");
|
|
21
21
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
22
22
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
23
23
|
var _context = require("../context");
|
|
@@ -106,7 +106,7 @@ function MarkElement(props) {
|
|
|
106
106
|
},
|
|
107
107
|
ownerState: ownerState,
|
|
108
108
|
className: classes.root,
|
|
109
|
-
d: (0, _d3Shape.symbol)(_d3Shape.symbolsFill[(0,
|
|
109
|
+
d: (0, _d3Shape.symbol)(_d3Shape.symbolsFill[(0, _getSymbol.getSymbol)(shape)])(),
|
|
110
110
|
onClick: onClick,
|
|
111
111
|
cursor: onClick ? 'pointer' : 'unset'
|
|
112
112
|
}, getInteractionItemProps({
|
package/LineChart/MarkPlot.js
CHANGED
|
@@ -14,7 +14,7 @@ var _MarkElement = require("./MarkElement");
|
|
|
14
14
|
var _useScale = require("../hooks/useScale");
|
|
15
15
|
var _useChartId = require("../hooks/useChartId");
|
|
16
16
|
var _constants = require("../constants");
|
|
17
|
-
var
|
|
17
|
+
var _cleanId = require("../internals/cleanId");
|
|
18
18
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
19
19
|
var _useSeries = require("../hooks/useSeries");
|
|
20
20
|
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
@@ -43,10 +43,7 @@ function MarkPlot(props) {
|
|
|
43
43
|
const seriesData = (0, _useSeries.useLineSeries)();
|
|
44
44
|
const axisData = (0, _CartesianProvider.useCartesianContext)();
|
|
45
45
|
const chartId = (0, _useChartId.useChartId)();
|
|
46
|
-
const
|
|
47
|
-
left,
|
|
48
|
-
width
|
|
49
|
-
} = (0, _useDrawingArea.useDrawingArea)();
|
|
46
|
+
const drawingArea = (0, _useDrawingArea.useDrawingArea)();
|
|
50
47
|
const Mark = slots?.mark ?? _MarkElement.MarkElement;
|
|
51
48
|
if (seriesData === undefined) {
|
|
52
49
|
return null;
|
|
@@ -69,6 +66,8 @@ function MarkPlot(props) {
|
|
|
69
66
|
}) => {
|
|
70
67
|
return groupIds.map(seriesId => {
|
|
71
68
|
const {
|
|
69
|
+
xAxisId: xAxisIdProp,
|
|
70
|
+
yAxisId: yAxisIdProp,
|
|
72
71
|
xAxisKey = defaultXAxisId,
|
|
73
72
|
yAxisKey = defaultYAxisId,
|
|
74
73
|
stackedData,
|
|
@@ -78,28 +77,17 @@ function MarkPlot(props) {
|
|
|
78
77
|
if (showMark === false) {
|
|
79
78
|
return null;
|
|
80
79
|
}
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
x,
|
|
87
|
-
y
|
|
88
|
-
}) => {
|
|
89
|
-
if (x < left || x > left + width) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
if (y < Math.min(...yRange) || y > Math.max(...yRange)) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
return true;
|
|
96
|
-
};
|
|
80
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
81
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
82
|
+
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
83
|
+
const yScale = yAxis[yAxisId].scale;
|
|
84
|
+
const xData = xAxis[xAxisId].data;
|
|
97
85
|
if (xData === undefined) {
|
|
98
|
-
throw new Error(`MUI X
|
|
86
|
+
throw new Error(`MUI X: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
99
87
|
}
|
|
100
|
-
const clipId = (0,
|
|
88
|
+
const clipId = (0, _cleanId.cleanId)(`${chartId}-${seriesId}-line-clip`); // We assume that if displaying line mark, the line will also be rendered
|
|
101
89
|
|
|
102
|
-
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[
|
|
90
|
+
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
103
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
104
92
|
clipPath: `url(#${clipId})`,
|
|
105
93
|
children: xData?.map((x, index) => {
|
|
@@ -122,7 +110,7 @@ function MarkPlot(props) {
|
|
|
122
110
|
// Remove missing data point
|
|
123
111
|
return false;
|
|
124
112
|
}
|
|
125
|
-
if (!
|
|
113
|
+
if (!drawingArea.isPointInside({
|
|
126
114
|
x,
|
|
127
115
|
y
|
|
128
116
|
})) {
|
package/LineChart/extremums.js
CHANGED
|
@@ -31,7 +31,10 @@ const getExtremumY = params => {
|
|
|
31
31
|
axis,
|
|
32
32
|
isDefaultAxis
|
|
33
33
|
} = params;
|
|
34
|
-
return Object.keys(series).filter(seriesId =>
|
|
34
|
+
return Object.keys(series).filter(seriesId => {
|
|
35
|
+
const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey;
|
|
36
|
+
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
37
|
+
}).reduce((acc, seriesId) => {
|
|
35
38
|
const {
|
|
36
39
|
area,
|
|
37
40
|
stackedData
|
package/LineChart/formatter.js
CHANGED
|
@@ -38,7 +38,7 @@ const formatter = (params, dataset) => {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
} else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
|
|
41
|
-
throw new Error([`MUI X
|
|
41
|
+
throw new Error([`MUI X: line series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
const completedSeries = {};
|
|
@@ -63,7 +63,7 @@ const formatter = (params, dataset) => {
|
|
|
63
63
|
if (typeof value !== 'number') {
|
|
64
64
|
if (process.env.NODE_ENV !== 'production' && !warnedOnce && value !== null) {
|
|
65
65
|
warnedOnce = true;
|
|
66
|
-
console.error([`MUI
|
|
66
|
+
console.error([`MUI X: Your dataset key "${dataKey}" is used for plotting line, but contains nonnumerical elements.`, 'Line plots only support numbers and null values.']);
|
|
67
67
|
}
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useLineChartProps = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
10
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
10
11
|
var _constants = require("../constants");
|
|
12
|
+
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"];
|
|
11
13
|
/**
|
|
12
14
|
* A helper function that extracts LineChartProps from the input props
|
|
13
15
|
* and returns an object with props for the children components of LineChart.
|
|
@@ -17,39 +19,41 @@ var _constants = require("../constants");
|
|
|
17
19
|
*/
|
|
18
20
|
const useLineChartProps = props => {
|
|
19
21
|
const {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
22
|
+
xAxis,
|
|
23
|
+
yAxis,
|
|
24
|
+
series,
|
|
25
|
+
width,
|
|
26
|
+
height,
|
|
27
|
+
margin,
|
|
28
|
+
colors,
|
|
29
|
+
dataset,
|
|
30
|
+
sx,
|
|
31
|
+
tooltip,
|
|
32
|
+
onAxisClick,
|
|
33
|
+
onAreaClick,
|
|
34
|
+
onLineClick,
|
|
35
|
+
onMarkClick,
|
|
36
|
+
axisHighlight,
|
|
37
|
+
disableLineItemHighlight,
|
|
38
|
+
legend,
|
|
39
|
+
grid,
|
|
40
|
+
topAxis,
|
|
41
|
+
leftAxis,
|
|
42
|
+
rightAxis,
|
|
43
|
+
bottomAxis,
|
|
44
|
+
children,
|
|
45
|
+
slots,
|
|
46
|
+
slotProps,
|
|
47
|
+
skipAnimation,
|
|
48
|
+
loading,
|
|
49
|
+
highlightedItem,
|
|
50
|
+
onHighlightChange,
|
|
51
|
+
className
|
|
52
|
+
} = props,
|
|
53
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
50
54
|
const id = (0, _useId.default)();
|
|
51
55
|
const clipPathId = `${id}-clip-path`;
|
|
52
|
-
const chartContainerProps = {
|
|
56
|
+
const chartContainerProps = (0, _extends2.default)({}, other, {
|
|
53
57
|
series: series.map(s => (0, _extends2.default)({
|
|
54
58
|
disableHighlight: !!disableLineItemHighlight,
|
|
55
59
|
type: 'line'
|
|
@@ -70,8 +74,9 @@ const useLineChartProps = props => {
|
|
|
70
74
|
sx,
|
|
71
75
|
highlightedItem,
|
|
72
76
|
onHighlightChange,
|
|
73
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick
|
|
74
|
-
|
|
77
|
+
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
78
|
+
className
|
|
79
|
+
});
|
|
75
80
|
const axisClickHandlerProps = {
|
|
76
81
|
onAxisClick
|
|
77
82
|
};
|
package/PieChart/PieArc.js
CHANGED
package/PieChart/PieChart.d.ts
CHANGED
|
@@ -75,8 +75,5 @@ export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'seri
|
|
|
75
75
|
*
|
|
76
76
|
* - [PieChart API](https://mui.com/x/api/charts/pie-chart/)
|
|
77
77
|
*/
|
|
78
|
-
declare
|
|
79
|
-
declare namespace PieChart {
|
|
80
|
-
var propTypes: any;
|
|
81
|
-
}
|
|
78
|
+
declare const PieChart: React.ForwardRefExoticComponent<PieChartProps & React.RefAttributes<unknown>>;
|
|
82
79
|
export { PieChart };
|