@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/PieChart/PieChart.js
CHANGED
|
@@ -4,8 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.PieChart =
|
|
7
|
+
exports.PieChart = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
10
|
var React = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
12
|
var _ResponsiveChartContainer = require("../ResponsiveChartContainer");
|
|
@@ -18,6 +19,7 @@ var _PiePlot = require("./PiePlot");
|
|
|
18
19
|
var _useIsRTL = require("../internals/useIsRTL");
|
|
19
20
|
var _ChartsOverlay = require("../ChartsOverlay");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
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"];
|
|
21
23
|
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); }
|
|
22
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
25
|
const defaultMargin = {
|
|
@@ -43,37 +45,39 @@ const defaultRTLMargin = {
|
|
|
43
45
|
*
|
|
44
46
|
* - [PieChart API](https://mui.com/x/api/charts/pie-chart/)
|
|
45
47
|
*/
|
|
46
|
-
function PieChart(props) {
|
|
48
|
+
const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieChart(props, ref) {
|
|
47
49
|
const {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
50
|
+
xAxis,
|
|
51
|
+
yAxis,
|
|
52
|
+
series,
|
|
53
|
+
width,
|
|
54
|
+
height,
|
|
55
|
+
margin: marginProps,
|
|
56
|
+
colors,
|
|
57
|
+
sx,
|
|
58
|
+
tooltip = {
|
|
59
|
+
trigger: 'item'
|
|
60
|
+
},
|
|
61
|
+
axisHighlight = {
|
|
62
|
+
x: 'none',
|
|
63
|
+
y: 'none'
|
|
64
|
+
},
|
|
65
|
+
skipAnimation,
|
|
66
|
+
legend: legendProps,
|
|
67
|
+
topAxis = null,
|
|
68
|
+
leftAxis = null,
|
|
69
|
+
rightAxis = null,
|
|
70
|
+
bottomAxis = null,
|
|
71
|
+
children,
|
|
72
|
+
slots,
|
|
73
|
+
slotProps,
|
|
74
|
+
onItemClick,
|
|
75
|
+
loading,
|
|
76
|
+
highlightedItem,
|
|
77
|
+
onHighlightChange,
|
|
78
|
+
className
|
|
79
|
+
} = props,
|
|
80
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
77
81
|
const isRTL = (0, _useIsRTL.useIsRTL)();
|
|
78
82
|
const margin = (0, _extends2.default)({}, isRTL ? defaultRTLMargin : defaultMargin, marginProps);
|
|
79
83
|
const legend = (0, _extends2.default)({
|
|
@@ -83,7 +87,8 @@ function PieChart(props) {
|
|
|
83
87
|
horizontal: isRTL ? 'left' : 'right'
|
|
84
88
|
}
|
|
85
89
|
}, legendProps);
|
|
86
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, {
|
|
90
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, (0, _extends2.default)({}, other, {
|
|
91
|
+
ref: ref,
|
|
87
92
|
series: series.map(s => (0, _extends2.default)({
|
|
88
93
|
type: 'pie'
|
|
89
94
|
}, s)),
|
|
@@ -101,6 +106,7 @@ function PieChart(props) {
|
|
|
101
106
|
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
102
107
|
highlightedItem: highlightedItem,
|
|
103
108
|
onHighlightChange: onHighlightChange,
|
|
109
|
+
className: className,
|
|
104
110
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
|
|
105
111
|
topAxis: topAxis,
|
|
106
112
|
leftAxis: leftAxis,
|
|
@@ -124,8 +130,8 @@ function PieChart(props) {
|
|
|
124
130
|
slots: slots,
|
|
125
131
|
slotProps: slotProps
|
|
126
132
|
})), children]
|
|
127
|
-
});
|
|
128
|
-
}
|
|
133
|
+
}));
|
|
134
|
+
});
|
|
129
135
|
process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
130
136
|
// ----------------------------- Warning --------------------------------
|
|
131
137
|
// | These PropTypes are generated from the TypeScript type definitions |
|
package/PieChart/PiePlot.js
CHANGED
|
@@ -10,7 +10,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
10
10
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
11
11
|
var _PieArcPlot = require("./PieArcPlot");
|
|
12
12
|
var _PieArcLabelPlot = require("./PieArcLabelPlot");
|
|
13
|
-
var
|
|
13
|
+
var _getPercentageValue = require("../internals/getPercentageValue");
|
|
14
14
|
var _getPieCoordinates = require("./getPieCoordinates");
|
|
15
15
|
var _useSeries = require("../hooks/useSeries");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -71,8 +71,8 @@ function PiePlot(props) {
|
|
|
71
71
|
width,
|
|
72
72
|
height
|
|
73
73
|
});
|
|
74
|
-
const outerRadius = (0,
|
|
75
|
-
const innerRadius = (0,
|
|
74
|
+
const outerRadius = (0, _getPercentageValue.getPercentageValue)(outerRadiusParam ?? availableRadius, availableRadius);
|
|
75
|
+
const innerRadius = (0, _getPercentageValue.getPercentageValue)(innerRadiusParam ?? 0, availableRadius);
|
|
76
76
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
77
77
|
transform: `translate(${left + cx}, ${top + cy})`,
|
|
78
78
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PieArcPlot.PieArcPlot, {
|
|
@@ -114,9 +114,9 @@ function PiePlot(props) {
|
|
|
114
114
|
width,
|
|
115
115
|
height
|
|
116
116
|
});
|
|
117
|
-
const outerRadius = (0,
|
|
118
|
-
const innerRadius = (0,
|
|
119
|
-
const arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : (0,
|
|
117
|
+
const outerRadius = (0, _getPercentageValue.getPercentageValue)(outerRadiusParam ?? availableRadius, availableRadius);
|
|
118
|
+
const innerRadius = (0, _getPercentageValue.getPercentageValue)(innerRadiusParam ?? 0, availableRadius);
|
|
119
|
+
const arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : (0, _getPercentageValue.getPercentageValue)(arcLabelRadiusParam, availableRadius);
|
|
120
120
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
121
121
|
transform: `translate(${left + cx}, ${top + cy})`,
|
|
122
122
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PieArcLabelPlot.PieArcLabelPlot, {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getPieCoordinates = getPieCoordinates;
|
|
7
|
-
var
|
|
7
|
+
var _getPercentageValue = require("../internals/getPercentageValue");
|
|
8
8
|
function getPieCoordinates(series, drawing) {
|
|
9
9
|
const {
|
|
10
10
|
height,
|
|
@@ -15,8 +15,8 @@ function getPieCoordinates(series, drawing) {
|
|
|
15
15
|
cy: cyParam
|
|
16
16
|
} = series;
|
|
17
17
|
const availableRadius = Math.min(width, height) / 2;
|
|
18
|
-
const cx = (0,
|
|
19
|
-
const cy = (0,
|
|
18
|
+
const cx = (0, _getPercentageValue.getPercentageValue)(cxParam ?? '50%', width);
|
|
19
|
+
const cy = (0, _getPercentageValue.getPercentageValue)(cyParam ?? '50%', height);
|
|
20
20
|
return {
|
|
21
21
|
cx,
|
|
22
22
|
cy,
|
|
@@ -6,35 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.ResponsiveChartContainer = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
9
|
var React = _interopRequireWildcard(require("react"));
|
|
11
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
11
|
var _ChartContainer = require("../ChartContainer");
|
|
13
|
-
var _useChartContainerDimensions = require("./useChartContainerDimensions");
|
|
14
12
|
var _ResizableContainer = require("./ResizableContainer");
|
|
13
|
+
var _useResponsiveChartContainerProps = require("./useResponsiveChartContainerProps");
|
|
15
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
const _excluded = ["width", "height"];
|
|
17
15
|
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); }
|
|
18
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
17
|
const ResponsiveChartContainer = exports.ResponsiveChartContainer = /*#__PURE__*/React.forwardRef(function ResponsiveChartContainer(props, ref) {
|
|
20
18
|
const {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
ownerState: {
|
|
29
|
-
width: inWidth,
|
|
30
|
-
height: inHeight
|
|
31
|
-
},
|
|
32
|
-
children: width && height ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartContainer.ChartContainer, (0, _extends2.default)({}, other, {
|
|
33
|
-
width: width,
|
|
34
|
-
height: height,
|
|
35
|
-
ref: ref
|
|
36
|
-
})) : null
|
|
37
|
-
});
|
|
19
|
+
hasIntrinsicSize,
|
|
20
|
+
chartContainerProps,
|
|
21
|
+
resizableChartContainerProps
|
|
22
|
+
} = (0, _useResponsiveChartContainerProps.useResponsiveChartContainerProps)(props, ref);
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResizableContainer.ResizableContainer, (0, _extends2.default)({}, resizableChartContainerProps, {
|
|
24
|
+
children: hasIntrinsicSize ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartContainer.ChartContainer, (0, _extends2.default)({}, chartContainerProps)) : null
|
|
25
|
+
}));
|
|
38
26
|
});
|
|
39
27
|
process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
40
28
|
// ----------------------------- Warning --------------------------------
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare const useChartContainerDimensions: (inWidth?: number, inHeight?: number) =>
|
|
2
|
+
export declare const useChartContainerDimensions: (inWidth?: number, inHeight?: number) => {
|
|
3
|
+
containerRef: React.MutableRefObject<null>;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
@@ -11,8 +11,8 @@ var _ownerWindow = _interopRequireDefault(require("@mui/utils/ownerWindow"));
|
|
|
11
11
|
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); }
|
|
12
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
13
|
const useChartContainerDimensions = (inWidth, inHeight) => {
|
|
14
|
-
const rootRef = React.useRef(null);
|
|
15
14
|
const displayError = React.useRef(false);
|
|
15
|
+
const rootRef = React.useRef(null);
|
|
16
16
|
const [width, setWidth] = React.useState(0);
|
|
17
17
|
const [height, setHeight] = React.useState(0);
|
|
18
18
|
|
|
@@ -63,14 +63,18 @@ const useChartContainerDimensions = (inWidth, inHeight) => {
|
|
|
63
63
|
}, [computeSize, inHeight, inWidth]);
|
|
64
64
|
if (process.env.NODE_ENV !== 'production') {
|
|
65
65
|
if (displayError.current && inWidth === undefined && width === 0) {
|
|
66
|
-
console.error(`MUI X
|
|
66
|
+
console.error(`MUI X: ChartContainer does not have \`width\` prop, and its container has no \`width\` defined.`);
|
|
67
67
|
displayError.current = false;
|
|
68
68
|
}
|
|
69
69
|
if (displayError.current && inHeight === undefined && height === 0) {
|
|
70
|
-
console.error(`MUI X
|
|
70
|
+
console.error(`MUI X: ChartContainer does not have \`height\` prop, and its container has no \`height\` defined.`);
|
|
71
71
|
displayError.current = false;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return {
|
|
75
|
+
containerRef: rootRef,
|
|
76
|
+
width: inWidth ?? width,
|
|
77
|
+
height: inHeight ?? height
|
|
78
|
+
};
|
|
75
79
|
};
|
|
76
80
|
exports.useChartContainerDimensions = useChartContainerDimensions;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ResponsiveChartContainerProps } from './ResponsiveChartContainer';
|
|
2
|
+
export declare const useResponsiveChartContainerProps: (props: ResponsiveChartContainerProps, ref: React.ForwardedRef<unknown>) => {
|
|
3
|
+
hasIntrinsicSize: number;
|
|
4
|
+
chartContainerProps: Omit<import("..").ChartsSurfaceProps & Omit<import("../internals").SeriesContextProviderProps, "seriesFormatters"> & Omit<import("../internals").DrawingProviderProps, "svgRef"> & Pick<import("../internals").CartesianContextProviderProps, "dataset"> & import("..").ZAxisContextProviderProps & import("..").HighlightedProviderProps, "children"> & {
|
|
5
|
+
xAxis?: import("../internals").MakeOptional<import("..").AxisConfig<import("..").ScaleName, any, import("..").ChartsXAxisProps>, "id">[];
|
|
6
|
+
yAxis?: import("../internals").MakeOptional<import("..").AxisConfig<import("..").ScaleName, any, import("..").ChartsYAxisProps>, "id">[];
|
|
7
|
+
children?: import("react").ReactNode;
|
|
8
|
+
plugins?: import("..").ChartsPluginType<import("../internals").ChartSeriesType>[];
|
|
9
|
+
} & {
|
|
10
|
+
ref: React.ForwardedRef<unknown>;
|
|
11
|
+
};
|
|
12
|
+
resizableChartContainerProps: {
|
|
13
|
+
ownerState: {
|
|
14
|
+
width: number | undefined;
|
|
15
|
+
height: number | undefined;
|
|
16
|
+
};
|
|
17
|
+
ref: import("react").MutableRefObject<null>;
|
|
18
|
+
className?: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useResponsiveChartContainerProps = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
+
var _useChartContainerDimensions = require("./useChartContainerDimensions");
|
|
11
|
+
const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "sx", "title", "viewBox", "xAxis", "yAxis", "zAxis"];
|
|
12
|
+
const useResponsiveChartContainerProps = (props, ref) => {
|
|
13
|
+
const {
|
|
14
|
+
width,
|
|
15
|
+
height,
|
|
16
|
+
margin,
|
|
17
|
+
children,
|
|
18
|
+
series,
|
|
19
|
+
colors,
|
|
20
|
+
dataset,
|
|
21
|
+
desc,
|
|
22
|
+
disableAxisListener,
|
|
23
|
+
highlightedItem,
|
|
24
|
+
onHighlightChange,
|
|
25
|
+
plugins,
|
|
26
|
+
sx,
|
|
27
|
+
title,
|
|
28
|
+
viewBox,
|
|
29
|
+
xAxis,
|
|
30
|
+
yAxis,
|
|
31
|
+
zAxis
|
|
32
|
+
} = props,
|
|
33
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
34
|
+
const {
|
|
35
|
+
containerRef,
|
|
36
|
+
width: dWidth,
|
|
37
|
+
height: dHeight
|
|
38
|
+
} = (0, _useChartContainerDimensions.useChartContainerDimensions)(width, height);
|
|
39
|
+
const resizableChartContainerProps = (0, _extends2.default)({}, other, {
|
|
40
|
+
ownerState: {
|
|
41
|
+
width,
|
|
42
|
+
height
|
|
43
|
+
},
|
|
44
|
+
ref: containerRef
|
|
45
|
+
});
|
|
46
|
+
const chartContainerProps = {
|
|
47
|
+
margin,
|
|
48
|
+
children,
|
|
49
|
+
series,
|
|
50
|
+
colors,
|
|
51
|
+
dataset,
|
|
52
|
+
desc,
|
|
53
|
+
disableAxisListener,
|
|
54
|
+
highlightedItem,
|
|
55
|
+
onHighlightChange,
|
|
56
|
+
plugins,
|
|
57
|
+
sx,
|
|
58
|
+
title,
|
|
59
|
+
viewBox,
|
|
60
|
+
xAxis,
|
|
61
|
+
yAxis,
|
|
62
|
+
zAxis,
|
|
63
|
+
width: dWidth,
|
|
64
|
+
height: dHeight,
|
|
65
|
+
ref
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
hasIntrinsicSize: dWidth && dHeight,
|
|
69
|
+
chartContainerProps,
|
|
70
|
+
resizableChartContainerProps
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
exports.useResponsiveChartContainerProps = useResponsiveChartContainerProps;
|
package/ScatterChart/Scatter.js
CHANGED
|
@@ -36,10 +36,7 @@ function Scatter(props) {
|
|
|
36
36
|
markerSize,
|
|
37
37
|
onItemClick
|
|
38
38
|
} = props;
|
|
39
|
-
const
|
|
40
|
-
left,
|
|
41
|
-
width
|
|
42
|
-
} = (0, _useDrawingArea.useDrawingArea)();
|
|
39
|
+
const drawingArea = (0, _useDrawingArea.useDrawingArea)();
|
|
43
40
|
const {
|
|
44
41
|
useVoronoiInteraction
|
|
45
42
|
} = React.useContext(_InteractionProvider.InteractionContext);
|
|
@@ -52,15 +49,15 @@ function Scatter(props) {
|
|
|
52
49
|
const cleanData = React.useMemo(() => {
|
|
53
50
|
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
54
51
|
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
55
|
-
const yRange = yScale.range();
|
|
56
|
-
const minYRange = Math.min(...yRange);
|
|
57
|
-
const maxYRange = Math.max(...yRange);
|
|
58
52
|
const temp = [];
|
|
59
53
|
for (let i = 0; i < series.data.length; i += 1) {
|
|
60
54
|
const scatterPoint = series.data[i];
|
|
61
55
|
const x = getXPosition(scatterPoint.x);
|
|
62
56
|
const y = getYPosition(scatterPoint.y);
|
|
63
|
-
const isInRange =
|
|
57
|
+
const isInRange = drawingArea.isPointInside({
|
|
58
|
+
x,
|
|
59
|
+
y
|
|
60
|
+
});
|
|
64
61
|
const pointCtx = {
|
|
65
62
|
type: 'scatter',
|
|
66
63
|
seriesId: series.id,
|
|
@@ -85,7 +82,7 @@ function Scatter(props) {
|
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
84
|
return temp;
|
|
88
|
-
}, [xScale, yScale,
|
|
85
|
+
}, [xScale, yScale, drawingArea, series.data, series.id, isHighlighted, isFaded, getInteractionItemProps, colorGetter, color]);
|
|
89
86
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
90
87
|
children: cleanData.map(dataPoint => /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", (0, _extends2.default)({
|
|
91
88
|
cx: 0,
|
|
@@ -50,7 +50,10 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
50
50
|
ref: ref
|
|
51
51
|
}, chartContainerProps, {
|
|
52
52
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ZAxisContextProvider.ZAxisContextProvider, (0, _extends2.default)({}, zAxisProps, {
|
|
53
|
-
children: [!props.disableVoronoi && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsVoronoiHandler.ChartsVoronoiHandler, (0, _extends2.default)({}, voronoiHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), props.grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
53
|
+
children: [!props.disableVoronoi && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsVoronoiHandler.ChartsVoronoiHandler, (0, _extends2.default)({}, voronoiHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), props.grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
54
|
+
"data-drawing-container": true,
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, (0, _extends2.default)({}, scatterPlotProps))
|
|
56
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltipProps)), children]
|
|
54
57
|
}))
|
|
55
58
|
}));
|
|
56
59
|
});
|
|
@@ -62,12 +62,15 @@ function ScatterPlot(props) {
|
|
|
62
62
|
xAxisKey,
|
|
63
63
|
yAxisKey,
|
|
64
64
|
zAxisKey,
|
|
65
|
+
xAxisId,
|
|
66
|
+
yAxisId,
|
|
67
|
+
zAxisId,
|
|
65
68
|
markerSize,
|
|
66
69
|
color
|
|
67
70
|
} = series[seriesId];
|
|
68
|
-
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisKey ?? defaultXAxisId], yAxis[yAxisKey ?? defaultYAxisId], zAxis[zAxisKey ?? defaultZAxisId]);
|
|
69
|
-
const xScale = xAxis[xAxisKey ?? defaultXAxisId].scale;
|
|
70
|
-
const yScale = yAxis[yAxisKey ?? defaultYAxisId].scale;
|
|
71
|
+
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisId ?? xAxisKey ?? defaultXAxisId], yAxis[yAxisId ?? yAxisKey ?? defaultYAxisId], zAxis[zAxisId ?? zAxisKey ?? defaultZAxisId]);
|
|
72
|
+
const xScale = xAxis[xAxisId ?? xAxisKey ?? defaultXAxisId].scale;
|
|
73
|
+
const yScale = yAxis[yAxisId ?? yAxisKey ?? defaultYAxisId].scale;
|
|
71
74
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ScatterItems, (0, _extends2.default)({
|
|
72
75
|
xScale: xScale,
|
|
73
76
|
yScale: yScale,
|
|
@@ -19,7 +19,10 @@ const getExtremumX = params => {
|
|
|
19
19
|
axis,
|
|
20
20
|
isDefaultAxis
|
|
21
21
|
} = params;
|
|
22
|
-
return Object.keys(series).filter(seriesId =>
|
|
22
|
+
return Object.keys(series).filter(seriesId => {
|
|
23
|
+
const axisId = series[seriesId].xAxisId ?? series[seriesId].xAxisKey;
|
|
24
|
+
return axisId === axis.id || axisId === undefined && isDefaultAxis;
|
|
25
|
+
}).reduce((acc, seriesId) => {
|
|
23
26
|
const seriesMinMax = series[seriesId].data.reduce((accSeries, {
|
|
24
27
|
x
|
|
25
28
|
}) => {
|
|
@@ -36,7 +39,10 @@ const getExtremumY = params => {
|
|
|
36
39
|
axis,
|
|
37
40
|
isDefaultAxis
|
|
38
41
|
} = params;
|
|
39
|
-
return Object.keys(series).filter(seriesId =>
|
|
42
|
+
return Object.keys(series).filter(seriesId => {
|
|
43
|
+
const axisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey;
|
|
44
|
+
return axisId === axis.id || axisId === undefined && isDefaultAxis;
|
|
45
|
+
}).reduce((acc, seriesId) => {
|
|
40
46
|
const seriesMinMax = series[seriesId].data.reduce((accSeries, {
|
|
41
47
|
y
|
|
42
48
|
}) => {
|
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useScatterChartProps = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
+
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"];
|
|
9
11
|
/**
|
|
10
12
|
* A helper function that extracts ScatterChartProps from the input props
|
|
11
13
|
* and returns an object with props for the children components of ScatterChart.
|
|
@@ -15,34 +17,36 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
15
17
|
*/
|
|
16
18
|
const useScatterChartProps = props => {
|
|
17
19
|
const {
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
20
|
+
xAxis,
|
|
21
|
+
yAxis,
|
|
22
|
+
zAxis,
|
|
23
|
+
series,
|
|
24
|
+
tooltip,
|
|
25
|
+
axisHighlight,
|
|
26
|
+
voronoiMaxRadius,
|
|
27
|
+
disableVoronoi,
|
|
28
|
+
legend,
|
|
29
|
+
width,
|
|
30
|
+
height,
|
|
31
|
+
margin,
|
|
32
|
+
colors,
|
|
33
|
+
sx,
|
|
34
|
+
grid,
|
|
35
|
+
topAxis,
|
|
36
|
+
leftAxis,
|
|
37
|
+
rightAxis,
|
|
38
|
+
bottomAxis,
|
|
39
|
+
onItemClick,
|
|
40
|
+
children,
|
|
41
|
+
slots,
|
|
42
|
+
slotProps,
|
|
43
|
+
loading,
|
|
44
|
+
highlightedItem,
|
|
45
|
+
onHighlightChange,
|
|
46
|
+
className
|
|
47
|
+
} = props,
|
|
48
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
49
|
+
const chartContainerProps = (0, _extends2.default)({}, other, {
|
|
46
50
|
series: series.map(s => (0, _extends2.default)({
|
|
47
51
|
type: 'scatter'
|
|
48
52
|
}, s)),
|
|
@@ -54,8 +58,9 @@ const useScatterChartProps = props => {
|
|
|
54
58
|
yAxis,
|
|
55
59
|
sx,
|
|
56
60
|
highlightedItem,
|
|
57
|
-
onHighlightChange
|
|
58
|
-
|
|
61
|
+
onHighlightChange,
|
|
62
|
+
className
|
|
63
|
+
});
|
|
59
64
|
const zAxisProps = {
|
|
60
65
|
zAxis
|
|
61
66
|
};
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.SparkLineChart = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
10
|
var React = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
12
|
var _BarChart = require("../BarChart");
|
|
@@ -15,6 +16,7 @@ var _constants = require("../constants");
|
|
|
15
16
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
16
17
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["xAxis", "yAxis", "width", "height", "margin", "colors", "sx", "showTooltip", "tooltip", "showHighlight", "axisHighlight", "children", "slots", "slotProps", "data", "plotType", "valueFormatter", "area", "curve", "className"];
|
|
18
20
|
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); }
|
|
19
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
22
|
const SPARKLINE_DEFAULT_MARGIN = {
|
|
@@ -35,33 +37,35 @@ const SPARKLINE_DEFAULT_MARGIN = {
|
|
|
35
37
|
*/
|
|
36
38
|
const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props, ref) {
|
|
37
39
|
const {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
xAxis,
|
|
41
|
+
yAxis,
|
|
42
|
+
width,
|
|
43
|
+
height,
|
|
44
|
+
margin = SPARKLINE_DEFAULT_MARGIN,
|
|
45
|
+
colors,
|
|
46
|
+
sx,
|
|
47
|
+
showTooltip,
|
|
48
|
+
tooltip,
|
|
49
|
+
showHighlight,
|
|
50
|
+
axisHighlight: inAxisHighlight,
|
|
51
|
+
children,
|
|
52
|
+
slots,
|
|
53
|
+
slotProps,
|
|
54
|
+
data,
|
|
55
|
+
plotType = 'line',
|
|
56
|
+
valueFormatter = value => value === null ? '' : value.toString(),
|
|
57
|
+
area,
|
|
58
|
+
curve = 'linear',
|
|
59
|
+
className
|
|
60
|
+
} = props,
|
|
61
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
58
62
|
const defaultXHighlight = showHighlight && plotType === 'bar' ? {
|
|
59
63
|
x: 'band'
|
|
60
64
|
} : {
|
|
61
65
|
x: 'none'
|
|
62
66
|
};
|
|
63
67
|
const axisHighlight = (0, _extends2.default)({}, defaultXHighlight, inAxisHighlight);
|
|
64
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, {
|
|
68
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, (0, _extends2.default)({}, other, {
|
|
65
69
|
ref: ref,
|
|
66
70
|
series: [(0, _extends2.default)({
|
|
67
71
|
type: plotType,
|
|
@@ -75,6 +79,7 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
|
|
|
75
79
|
width: width,
|
|
76
80
|
height: height,
|
|
77
81
|
margin: margin,
|
|
82
|
+
className: className,
|
|
78
83
|
xAxis: [(0, _extends2.default)({
|
|
79
84
|
id: _constants.DEFAULT_X_AXIS_KEY,
|
|
80
85
|
scaleType: plotType === 'bar' ? 'band' : 'point',
|
|
@@ -113,7 +118,7 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
|
|
|
113
118
|
slotProps: slotProps,
|
|
114
119
|
slots: slots
|
|
115
120
|
})), children]
|
|
116
|
-
});
|
|
121
|
+
}));
|
|
117
122
|
});
|
|
118
123
|
process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
119
124
|
// ----------------------------- Warning --------------------------------
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { Initializable } from '../context.types';
|
|
3
3
|
import { AxisDefaultized, ScaleName, ChartsXAxisProps, ChartsYAxisProps, AxisId } from '../../models/axis';
|
|
4
4
|
export type DefaultizedAxisConfig<AxisProps> = {
|
|
5
|
-
[
|
|
5
|
+
[axisId: AxisId]: AxisDefaultized<ScaleName, any, AxisProps>;
|
|
6
6
|
};
|
|
7
7
|
export type CartesianContextState = {
|
|
8
8
|
/**
|