@mui/x-charts 7.22.2 → 8.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +7 -7
- package/BarChart/BarChart.js +7 -29
- package/BarChart/BarElement.d.ts +1 -1
- package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
- package/BarChart/BarPlot.js +12 -4
- package/BarChart/extremums.js +3 -3
- package/BarChart/useBarChartProps.d.ts +2 -2
- package/BarChart/useBarChartProps.js +3 -4
- package/CHANGELOG.md +142 -155
- package/ChartContainer/ChartContainer.d.ts +16 -33
- package/ChartContainer/ChartContainer.js +22 -41
- package/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.d.ts +2 -2
- package/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.d.ts +1 -1
- package/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/ChartContainer/useChartContainerProps.d.ts +11 -94
- package/ChartContainer/useChartContainerProps.js +42 -58
- package/ChartsLegend/ChartsLegend.js +0 -3
- package/ChartsLegend/DefaultChartsLegend.d.ts +0 -5
- package/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/ChartsLegend/LegendPerItem.d.ts +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/ChartsOverlay/ChartsOverlay.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/ChartsTooltip/ChartsTooltip.js +45 -6
- package/ChartsTooltip/useAxisTooltip.js +3 -3
- package/ChartsTooltip/useItemTooltip.js +3 -3
- package/ChartsTooltip/utils.d.ts +5 -13
- package/ChartsTooltip/utils.js +45 -42
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/Gauge/GaugeContainer.js +1 -1
- package/LineChart/AreaElement.d.ts +1 -1
- package/LineChart/AreaPlot.js +2 -6
- package/LineChart/LineChart.d.ts +7 -7
- package/LineChart/LineChart.js +7 -29
- package/LineChart/LineElement.d.ts +1 -1
- package/LineChart/LineHighlightPlot.d.ts +1 -1
- package/LineChart/LineHighlightPlot.js +2 -6
- package/LineChart/LinePlot.js +2 -6
- package/LineChart/MarkPlot.js +2 -6
- package/LineChart/extremums.js +10 -6
- package/LineChart/useLineChartProps.d.ts +2 -2
- package/LineChart/useLineChartProps.js +3 -4
- package/PieChart/PieArc.d.ts +0 -5
- package/PieChart/PieArc.js +1 -10
- package/PieChart/PieArcPlot.js +0 -5
- package/PieChart/PieChart.d.ts +9 -32
- package/PieChart/PieChart.js +17 -102
- package/README.md +2 -2
- package/ScatterChart/ScatterChart.d.ts +7 -7
- package/ScatterChart/ScatterChart.js +7 -29
- package/ScatterChart/ScatterPlot.js +3 -6
- package/ScatterChart/extremums.js +6 -6
- package/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/ScatterChart/useScatterChartProps.js +3 -4
- package/SparkLineChart/SparkLineChart.d.ts +4 -4
- package/SparkLineChart/SparkLineChart.js +2 -2
- package/context/CartesianProvider/defaultizeAxis.d.ts +1 -1
- package/context/ChartDataProvider/ChartDataProvider.d.ts +41 -0
- package/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +46 -27
- package/context/ChartDataProvider/index.d.ts +1 -0
- package/context/ChartDataProvider/index.js +1 -0
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +97 -0
- package/context/ChartDataProvider/useChartDataProviderProps.js +86 -0
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.d.ts +12 -12
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/context/HighlightedProvider/HighlightedContext.d.ts +0 -8
- package/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/context/PluginProvider/ExtremumGetter.types.d.ts +2 -2
- package/context/ZAxisContextProvider.d.ts +1 -1
- package/index.d.ts +1 -2
- package/index.js +2 -3
- package/internals/defaultizeColor.d.ts +1 -8
- package/internals/getSymbol.js +19 -3
- package/internals/index.d.ts +5 -5
- package/internals/index.js +5 -5
- package/internals/useStringInterpolator.js +1 -0
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/common.d.ts +0 -10
- package/models/seriesType/config.d.ts +1 -1
- package/models/seriesType/line.d.ts +1 -1
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +1 -6
- package/modern/BarChart/BarChart.js +7 -29
- package/modern/BarChart/BarPlot.js +12 -4
- package/modern/BarChart/extremums.js +3 -3
- package/modern/BarChart/useBarChartProps.js +3 -4
- package/modern/ChartContainer/ChartContainer.js +22 -41
- package/modern/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/modern/ChartContainer/useChartContainerProps.js +42 -58
- package/modern/ChartsLegend/ChartsLegend.js +0 -3
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/modern/ChartsTooltip/ChartsTooltip.js +45 -6
- package/modern/ChartsTooltip/useAxisTooltip.js +3 -3
- package/modern/ChartsTooltip/useItemTooltip.js +3 -3
- package/modern/ChartsTooltip/utils.js +45 -42
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/modern/Gauge/GaugeContainer.js +1 -1
- package/modern/LineChart/AreaPlot.js +2 -6
- package/modern/LineChart/LineChart.js +7 -29
- package/modern/LineChart/LineHighlightPlot.js +2 -6
- package/modern/LineChart/LinePlot.js +2 -6
- package/modern/LineChart/MarkPlot.js +2 -6
- package/modern/LineChart/extremums.js +10 -6
- package/modern/LineChart/useLineChartProps.js +3 -4
- package/modern/PieChart/PieArc.js +1 -10
- package/modern/PieChart/PieArcPlot.js +0 -5
- package/modern/PieChart/PieChart.js +17 -102
- package/modern/ScatterChart/ScatterChart.js +7 -29
- package/modern/ScatterChart/ScatterPlot.js +3 -6
- package/modern/ScatterChart/extremums.js +6 -6
- package/modern/ScatterChart/useScatterChartProps.js +3 -4
- package/modern/SparkLineChart/SparkLineChart.js +2 -2
- package/modern/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +46 -27
- package/modern/context/ChartDataProvider/index.js +1 -0
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +86 -0
- package/modern/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/modern/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/modern/index.js +2 -3
- package/modern/internals/getSymbol.js +19 -3
- package/modern/internals/index.js +5 -5
- package/modern/internals/useStringInterpolator.js +1 -0
- package/node/BarChart/BarChart.js +7 -29
- package/node/BarChart/BarPlot.js +11 -3
- package/node/BarChart/extremums.js +3 -3
- package/node/BarChart/useBarChartProps.js +3 -4
- package/node/ChartContainer/ChartContainer.js +21 -40
- package/node/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/node/ChartContainer/useChartContainerProps.js +42 -59
- package/node/ChartsLegend/ChartsLegend.js +0 -3
- package/node/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/node/ChartsTooltip/ChartsTooltip.js +44 -5
- package/node/ChartsTooltip/useAxisTooltip.js +3 -3
- package/node/ChartsTooltip/useItemTooltip.js +3 -3
- package/node/ChartsTooltip/utils.js +46 -44
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/node/Gauge/GaugeContainer.js +1 -1
- package/node/LineChart/AreaPlot.js +2 -6
- package/node/LineChart/LineChart.js +7 -29
- package/node/LineChart/LineHighlightPlot.js +2 -6
- package/node/LineChart/LinePlot.js +2 -6
- package/node/LineChart/MarkPlot.js +2 -6
- package/node/LineChart/extremums.js +10 -6
- package/node/LineChart/useLineChartProps.js +3 -4
- package/node/PieChart/PieArc.js +1 -10
- package/node/PieChart/PieArcPlot.js +0 -5
- package/node/PieChart/PieChart.js +17 -102
- package/node/ScatterChart/ScatterChart.js +7 -29
- package/node/ScatterChart/ScatterPlot.js +3 -6
- package/node/ScatterChart/extremums.js +6 -6
- package/node/ScatterChart/useScatterChartProps.js +3 -4
- package/node/SparkLineChart/SparkLineChart.js +2 -2
- package/node/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -26
- package/node/context/ChartDataProvider/index.js +16 -0
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +94 -0
- package/node/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/node/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/node/index.js +5 -16
- package/node/internals/getSymbol.js +19 -3
- package/node/internals/index.js +37 -29
- package/node/internals/useStringInterpolator.js +2 -0
- package/package.json +4 -4
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -24
- package/ResponsiveChartContainer/index.d.ts +0 -1
- package/ResponsiveChartContainer/index.js +0 -1
- package/ResponsiveChartContainer/package.json +0 -6
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +0 -19
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/internals/SlotComponentPropsFromProps.d.ts +0 -1
- package/internals/SlotComponentPropsFromProps.js +0 -1
- package/models/helpers.d.ts +0 -3
- package/models/helpers.js +0 -1
- package/modern/ResponsiveChartContainer/index.js +0 -1
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/modern/internals/SlotComponentPropsFromProps.js +0 -1
- package/modern/models/helpers.js +0 -1
- package/node/ResponsiveChartContainer/index.js +0 -16
- package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -77
- package/node/internals/SlotComponentPropsFromProps.js +0 -5
- package/node/models/helpers.js +0 -5
- /package/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
- /package/modern/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
- /package/node/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useThemeProps } from '@mui/material/styles';
|
|
7
7
|
import { ScatterPlot } from "./ScatterPlot.js";
|
|
8
|
-
import {
|
|
8
|
+
import { ChartContainer } from "../ChartContainer/index.js";
|
|
9
9
|
import { ChartsAxis } from "../ChartsAxis/index.js";
|
|
10
10
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
11
11
|
import { ChartsLegend } from "../ChartsLegend/index.js";
|
|
@@ -44,14 +44,14 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(inProps
|
|
|
44
44
|
tooltipProps,
|
|
45
45
|
children
|
|
46
46
|
} = useScatterChartProps(props);
|
|
47
|
-
return /*#__PURE__*/_jsx(
|
|
47
|
+
return /*#__PURE__*/_jsx(ChartContainer, _extends({
|
|
48
48
|
ref: ref
|
|
49
49
|
}, chartContainerProps, {
|
|
50
50
|
children: /*#__PURE__*/_jsxs(ZAxisContextProvider, _extends({}, zAxisProps, {
|
|
51
51
|
children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
|
52
52
|
"data-drawing-container": true,
|
|
53
53
|
children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
|
|
54
|
-
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), children]
|
|
54
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), children]
|
|
55
55
|
}))
|
|
56
56
|
}));
|
|
57
57
|
});
|
|
@@ -109,6 +109,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
109
109
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
110
110
|
*/
|
|
111
111
|
height: PropTypes.number,
|
|
112
|
+
/**
|
|
113
|
+
* If `true`, the legend is not rendered.
|
|
114
|
+
*/
|
|
115
|
+
hideLegend: PropTypes.bool,
|
|
112
116
|
/**
|
|
113
117
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
114
118
|
*/
|
|
@@ -122,32 +126,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
122
126
|
* @default yAxisIds[0] The id of the first provided axis
|
|
123
127
|
*/
|
|
124
128
|
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
125
|
-
/**
|
|
126
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
127
|
-
*/
|
|
128
|
-
legend: PropTypes.shape({
|
|
129
|
-
classes: PropTypes.object,
|
|
130
|
-
direction: PropTypes.oneOf(['column', 'row']),
|
|
131
|
-
hidden: PropTypes.bool,
|
|
132
|
-
itemGap: PropTypes.number,
|
|
133
|
-
itemMarkHeight: PropTypes.number,
|
|
134
|
-
itemMarkWidth: PropTypes.number,
|
|
135
|
-
labelStyle: PropTypes.object,
|
|
136
|
-
markGap: PropTypes.number,
|
|
137
|
-
onItemClick: PropTypes.func,
|
|
138
|
-
padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
139
|
-
bottom: PropTypes.number,
|
|
140
|
-
left: PropTypes.number,
|
|
141
|
-
right: PropTypes.number,
|
|
142
|
-
top: PropTypes.number
|
|
143
|
-
})]),
|
|
144
|
-
position: PropTypes.shape({
|
|
145
|
-
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
146
|
-
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
147
|
-
}),
|
|
148
|
-
slotProps: PropTypes.object,
|
|
149
|
-
slots: PropTypes.object
|
|
150
|
-
}),
|
|
151
129
|
/**
|
|
152
130
|
* If `true`, a loading overlay is displayed.
|
|
153
131
|
* @default false
|
|
@@ -52,18 +52,15 @@ function ScatterPlot(props) {
|
|
|
52
52
|
children: seriesOrder.map(seriesId => {
|
|
53
53
|
const {
|
|
54
54
|
id,
|
|
55
|
-
xAxisKey,
|
|
56
|
-
yAxisKey,
|
|
57
|
-
zAxisKey,
|
|
58
55
|
xAxisId,
|
|
59
56
|
yAxisId,
|
|
60
57
|
zAxisId,
|
|
61
58
|
markerSize,
|
|
62
59
|
color
|
|
63
60
|
} = series[seriesId];
|
|
64
|
-
const colorGetter = getColor(series[seriesId], xAxis[xAxisId ??
|
|
65
|
-
const xScale = xAxis[xAxisId ??
|
|
66
|
-
const yScale = yAxis[yAxisId ??
|
|
61
|
+
const colorGetter = getColor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[zAxisId ?? defaultZAxisId]);
|
|
62
|
+
const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
|
|
63
|
+
const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
|
|
67
64
|
return /*#__PURE__*/_jsx(ScatterItems, _extends({
|
|
68
65
|
xScale: xScale,
|
|
69
66
|
yScale: yScale,
|
|
@@ -9,14 +9,14 @@ export const getExtremumX = params => {
|
|
|
9
9
|
getFilters
|
|
10
10
|
} = params;
|
|
11
11
|
return Object.keys(series).filter(seriesId => {
|
|
12
|
-
const axisId = series[seriesId].xAxisId
|
|
12
|
+
const axisId = series[seriesId].xAxisId;
|
|
13
13
|
return axisId === axis.id || axisId === undefined && isDefaultAxis;
|
|
14
14
|
}).reduce((acc, seriesId) => {
|
|
15
15
|
const filter = getFilters?.({
|
|
16
16
|
currentAxisId: axis.id,
|
|
17
17
|
isDefaultAxis,
|
|
18
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
19
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
18
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
19
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
20
20
|
});
|
|
21
21
|
const seriesMinMax = series[seriesId].data?.reduce((accSeries, d, dataIndex) => {
|
|
22
22
|
if (filter && !filter(d, dataIndex)) {
|
|
@@ -35,14 +35,14 @@ export const getExtremumY = params => {
|
|
|
35
35
|
getFilters
|
|
36
36
|
} = params;
|
|
37
37
|
return Object.keys(series).filter(seriesId => {
|
|
38
|
-
const axisId = series[seriesId].yAxisId
|
|
38
|
+
const axisId = series[seriesId].yAxisId;
|
|
39
39
|
return axisId === axis.id || axisId === undefined && isDefaultAxis;
|
|
40
40
|
}).reduce((acc, seriesId) => {
|
|
41
41
|
const filter = getFilters?.({
|
|
42
42
|
currentAxisId: axis.id,
|
|
43
43
|
isDefaultAxis,
|
|
44
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
45
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
44
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
45
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
46
46
|
});
|
|
47
47
|
const seriesMinMax = series[seriesId].data?.reduce((accSeries, d, dataIndex) => {
|
|
48
48
|
if (filter && !filter(d, dataIndex)) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "tooltip", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "tooltip", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
6
6
|
/**
|
|
7
7
|
* A helper function that extracts ScatterChartProps from the input props
|
|
8
8
|
* and returns an object with props for the children components of ScatterChart.
|
|
@@ -20,7 +20,6 @@ export const useScatterChartProps = props => {
|
|
|
20
20
|
axisHighlight,
|
|
21
21
|
voronoiMaxRadius,
|
|
22
22
|
disableVoronoi,
|
|
23
|
-
legend,
|
|
24
23
|
width,
|
|
25
24
|
height,
|
|
26
25
|
margin,
|
|
@@ -85,10 +84,10 @@ export const useScatterChartProps = props => {
|
|
|
85
84
|
slots,
|
|
86
85
|
slotProps
|
|
87
86
|
};
|
|
88
|
-
const legendProps =
|
|
87
|
+
const legendProps = {
|
|
89
88
|
slots,
|
|
90
89
|
slotProps
|
|
91
|
-
}
|
|
90
|
+
};
|
|
92
91
|
const axisHighlightProps = _extends({
|
|
93
92
|
y: 'none',
|
|
94
93
|
x: 'none'
|
|
@@ -7,7 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { BarPlot } from "../BarChart/index.js";
|
|
9
9
|
import { LinePlot, AreaPlot, LineHighlightPlot } from "../LineChart/index.js";
|
|
10
|
-
import {
|
|
10
|
+
import { ChartContainer } from "../ChartContainer/index.js";
|
|
11
11
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
12
12
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
13
13
|
import { ChartsAxisHighlight } from "../ChartsAxisHighlight/index.js";
|
|
@@ -58,7 +58,7 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
58
58
|
x: 'none'
|
|
59
59
|
};
|
|
60
60
|
const axisHighlight = _extends({}, defaultXHighlight, inAxisHighlight);
|
|
61
|
-
return /*#__PURE__*/_jsxs(
|
|
61
|
+
return /*#__PURE__*/_jsxs(ChartContainer, _extends({}, other, {
|
|
62
62
|
ref: ref,
|
|
63
63
|
series: [_extends({
|
|
64
64
|
type: plotType,
|
|
@@ -3,21 +3,50 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
6
|
+
import { DrawingProvider } from "../DrawingProvider.js";
|
|
7
|
+
import { SeriesProvider } from "../SeriesProvider/index.js";
|
|
8
|
+
import { InteractionProvider } from "../InteractionProvider.js";
|
|
9
|
+
import { ChartsSurface } from "../../ChartsSurface/index.js";
|
|
10
|
+
import { CartesianProvider } from "../CartesianProvider/index.js";
|
|
11
|
+
import { ChartsAxesGradients } from "../../internals/components/ChartsAxesGradients/index.js";
|
|
12
|
+
import { HighlightedProvider, ZAxisContextProvider } from "../index.js";
|
|
13
|
+
import { PluginProvider } from "../PluginProvider/index.js";
|
|
14
|
+
import { useChartDataProviderProps } from "./useChartDataProviderProps.js";
|
|
15
|
+
import { AnimationProvider } from "../AnimationProvider/index.js";
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
const ChartDataProvider = /*#__PURE__*/React.forwardRef(function ChartDataProvider(props, ref) {
|
|
11
18
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
children,
|
|
20
|
+
drawingProviderProps,
|
|
21
|
+
seriesProviderProps,
|
|
22
|
+
cartesianProviderProps,
|
|
23
|
+
zAxisContextProps,
|
|
24
|
+
highlightedProviderProps,
|
|
25
|
+
chartsSurfaceProps,
|
|
26
|
+
pluginProviderProps,
|
|
27
|
+
animationProviderProps
|
|
28
|
+
} = useChartDataProviderProps(props, ref);
|
|
29
|
+
return /*#__PURE__*/_jsx(DrawingProvider, _extends({}, drawingProviderProps, {
|
|
30
|
+
children: /*#__PURE__*/_jsx(PluginProvider, _extends({}, pluginProviderProps, {
|
|
31
|
+
children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
|
|
32
|
+
children: /*#__PURE__*/_jsx(CartesianProvider, _extends({}, cartesianProviderProps, {
|
|
33
|
+
children: /*#__PURE__*/_jsx(ZAxisContextProvider, _extends({}, zAxisContextProps, {
|
|
34
|
+
children: /*#__PURE__*/_jsx(InteractionProvider, {
|
|
35
|
+
children: /*#__PURE__*/_jsx(HighlightedProvider, _extends({}, highlightedProviderProps, {
|
|
36
|
+
children: /*#__PURE__*/_jsx(AnimationProvider, _extends({}, animationProviderProps, {
|
|
37
|
+
children: /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
38
|
+
children: [/*#__PURE__*/_jsx(ChartsAxesGradients, {}), children]
|
|
39
|
+
}))
|
|
40
|
+
}))
|
|
41
|
+
}))
|
|
42
|
+
})
|
|
43
|
+
}))
|
|
44
|
+
}))
|
|
45
|
+
}))
|
|
46
|
+
}))
|
|
18
47
|
}));
|
|
19
48
|
});
|
|
20
|
-
process.env.NODE_ENV !== "production" ?
|
|
49
|
+
process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
|
|
21
50
|
// ----------------------------- Warning --------------------------------
|
|
22
51
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
23
52
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
@@ -41,9 +70,9 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
41
70
|
*/
|
|
42
71
|
disableAxisListener: PropTypes.bool,
|
|
43
72
|
/**
|
|
44
|
-
* The height of the chart in px.
|
|
73
|
+
* The height of the chart in px.
|
|
45
74
|
*/
|
|
46
|
-
height: PropTypes.number,
|
|
75
|
+
height: PropTypes.number.isRequired,
|
|
47
76
|
/**
|
|
48
77
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
49
78
|
*/
|
|
@@ -74,16 +103,6 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
74
103
|
* If not provided, the container supports line, bar, scatter and pie charts.
|
|
75
104
|
*/
|
|
76
105
|
plugins: PropTypes.arrayOf(PropTypes.object),
|
|
77
|
-
/**
|
|
78
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
79
|
-
* before it renders for the first time.
|
|
80
|
-
*
|
|
81
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
82
|
-
* the first render, like when used inside a grid.
|
|
83
|
-
*
|
|
84
|
-
* @default false
|
|
85
|
-
*/
|
|
86
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
87
106
|
/**
|
|
88
107
|
* The array of series to display.
|
|
89
108
|
* Each type of series has its own specificity.
|
|
@@ -104,9 +123,9 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
104
123
|
y: PropTypes.number
|
|
105
124
|
}),
|
|
106
125
|
/**
|
|
107
|
-
* The width of the chart in px.
|
|
126
|
+
* The width of the chart in px.
|
|
108
127
|
*/
|
|
109
|
-
width: PropTypes.number,
|
|
128
|
+
width: PropTypes.number.isRequired,
|
|
110
129
|
/**
|
|
111
130
|
* The configuration of the x-axes.
|
|
112
131
|
* If not provided, a default axis config is used.
|
|
@@ -241,4 +260,4 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
241
260
|
min: PropTypes.number
|
|
242
261
|
}))
|
|
243
262
|
} : void 0;
|
|
244
|
-
export {
|
|
263
|
+
export { ChartDataProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ChartDataProvider.js";
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["width", "height", "series", "margin", "xAxis", "yAxis", "zAxis", "colors", "dataset", "sx", "title", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "children", "skipAnimation"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
8
|
+
import { useDefaultizeAxis } from "./useDefaultizeAxis.js";
|
|
9
|
+
export const useChartDataProviderProps = (props, ref) => {
|
|
10
|
+
const {
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
series,
|
|
14
|
+
margin,
|
|
15
|
+
xAxis,
|
|
16
|
+
yAxis,
|
|
17
|
+
zAxis,
|
|
18
|
+
colors,
|
|
19
|
+
dataset,
|
|
20
|
+
sx,
|
|
21
|
+
title,
|
|
22
|
+
desc,
|
|
23
|
+
disableAxisListener,
|
|
24
|
+
highlightedItem,
|
|
25
|
+
onHighlightChange,
|
|
26
|
+
plugins,
|
|
27
|
+
children,
|
|
28
|
+
skipAnimation
|
|
29
|
+
} = props,
|
|
30
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
|
+
const svgRef = React.useRef(null);
|
|
32
|
+
const chartSurfaceRef = useForkRef(ref, svgRef);
|
|
33
|
+
const [defaultizedXAxis, defaultizedYAxis] = useDefaultizeAxis(xAxis, yAxis, dataset);
|
|
34
|
+
const drawingProviderProps = {
|
|
35
|
+
width,
|
|
36
|
+
height,
|
|
37
|
+
margin,
|
|
38
|
+
svgRef
|
|
39
|
+
};
|
|
40
|
+
const animationProviderProps = {
|
|
41
|
+
skipAnimation
|
|
42
|
+
};
|
|
43
|
+
const pluginProviderProps = {
|
|
44
|
+
plugins
|
|
45
|
+
};
|
|
46
|
+
const seriesProviderProps = {
|
|
47
|
+
series,
|
|
48
|
+
colors,
|
|
49
|
+
dataset
|
|
50
|
+
};
|
|
51
|
+
const cartesianProviderProps = {
|
|
52
|
+
xAxis: defaultizedXAxis,
|
|
53
|
+
yAxis: defaultizedYAxis,
|
|
54
|
+
dataset
|
|
55
|
+
};
|
|
56
|
+
const zAxisContextProps = {
|
|
57
|
+
zAxis,
|
|
58
|
+
dataset
|
|
59
|
+
};
|
|
60
|
+
const highlightedProviderProps = {
|
|
61
|
+
highlightedItem,
|
|
62
|
+
onHighlightChange
|
|
63
|
+
};
|
|
64
|
+
const chartsSurfaceProps = _extends({}, other, {
|
|
65
|
+
width,
|
|
66
|
+
height,
|
|
67
|
+
ref: chartSurfaceRef,
|
|
68
|
+
sx,
|
|
69
|
+
title,
|
|
70
|
+
desc,
|
|
71
|
+
disableAxisListener
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
children,
|
|
75
|
+
drawingProviderProps,
|
|
76
|
+
seriesProviderProps,
|
|
77
|
+
cartesianProviderProps,
|
|
78
|
+
zAxisContextProps,
|
|
79
|
+
highlightedProviderProps,
|
|
80
|
+
chartsSurfaceProps,
|
|
81
|
+
pluginProviderProps,
|
|
82
|
+
animationProviderProps,
|
|
83
|
+
xAxis: defaultizedXAxis,
|
|
84
|
+
yAxis: defaultizedYAxis
|
|
85
|
+
};
|
|
86
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "
|
|
5
|
+
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../../constants/index.js";
|
|
6
6
|
const defaultizeAxis = (inAxis, dataset, axisName) => {
|
|
7
7
|
const DEFAULT_AXIS_KEY = axisName === 'x' ? DEFAULT_X_AXIS_KEY : DEFAULT_Y_AXIS_KEY;
|
|
8
8
|
return [...(inAxis?.map((axis, index) => _extends({
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["highlighted", "faded"];
|
|
6
3
|
import * as React from 'react';
|
|
7
4
|
import PropTypes from 'prop-types';
|
|
8
5
|
import useControlled from '@mui/utils/useControlled';
|
|
@@ -11,18 +8,6 @@ import { createIsFaded } from "./createIsFaded.js";
|
|
|
11
8
|
import { createIsHighlighted } from "./createIsHighlighted.js";
|
|
12
9
|
import { useSeries } from "../../hooks/useSeries.js";
|
|
13
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const mergeDeprecatedOptions = options => {
|
|
15
|
-
const _ref = options ?? {},
|
|
16
|
-
{
|
|
17
|
-
highlighted,
|
|
18
|
-
faded
|
|
19
|
-
} = _ref,
|
|
20
|
-
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21
|
-
return _extends({
|
|
22
|
-
highlight: highlighted,
|
|
23
|
-
fade: faded
|
|
24
|
-
}, other);
|
|
25
|
-
};
|
|
26
11
|
function HighlightedProvider({
|
|
27
12
|
children,
|
|
28
13
|
highlightedItem: highlightedItemProps,
|
|
@@ -41,7 +26,7 @@ function HighlightedProvider({
|
|
|
41
26
|
const seriesData = series[seriesType];
|
|
42
27
|
Object.keys(seriesData?.series ?? {}).forEach(seriesId => {
|
|
43
28
|
const seriesItem = seriesData?.series[seriesId];
|
|
44
|
-
map.set(seriesId,
|
|
29
|
+
map.set(seriesId, seriesItem?.highlightScope);
|
|
45
30
|
});
|
|
46
31
|
});
|
|
47
32
|
return map;
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts
|
|
2
|
+
* @mui/x-charts v8.0.0-alpha.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -28,6 +28,5 @@ export * from "./PieChart/index.js";
|
|
|
28
28
|
export * from "./ScatterChart/index.js";
|
|
29
29
|
export * from "./SparkLineChart/index.js";
|
|
30
30
|
export * from "./Gauge/index.js";
|
|
31
|
-
export * from "./ChartContainer/index.js";
|
|
32
31
|
export * from "./ChartsSurface/index.js";
|
|
33
|
-
export * from "./
|
|
32
|
+
export * from "./ChartContainer/index.js";
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
// Returns the index of a defined shape
|
|
2
1
|
export function getSymbol(shape) {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
// prettier-ignore
|
|
3
|
+
switch (shape) {
|
|
4
|
+
case 'circle':
|
|
5
|
+
return 0;
|
|
6
|
+
case 'cross':
|
|
7
|
+
return 1;
|
|
8
|
+
case 'diamond':
|
|
9
|
+
return 2;
|
|
10
|
+
case 'square':
|
|
11
|
+
return 3;
|
|
12
|
+
case 'star':
|
|
13
|
+
return 4;
|
|
14
|
+
case 'triangle':
|
|
15
|
+
return 5;
|
|
16
|
+
case 'wye':
|
|
17
|
+
return 6;
|
|
18
|
+
default:
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
5
21
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Components
|
|
2
2
|
export * from "./components/ChartsAxesGradients/index.js";
|
|
3
|
-
export * from "../
|
|
4
|
-
export * from "../
|
|
3
|
+
export * from "../ChartContainer/useChartContainerDimensions.js";
|
|
4
|
+
export * from "../ChartContainer/ResizableContainer.js";
|
|
5
5
|
|
|
6
6
|
// hooks
|
|
7
7
|
export { useSeries } from "../hooks/useSeries.js";
|
|
@@ -10,8 +10,8 @@ export { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
|
10
10
|
export { useScatterChartProps } from "../ScatterChart/useScatterChartProps.js";
|
|
11
11
|
export { useLineChartProps } from "../LineChart/useLineChartProps.js";
|
|
12
12
|
export { useBarChartProps } from "../BarChart/useBarChartProps.js";
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export * from "../ChartContainer/useChartContainerProps.js";
|
|
14
|
+
export * from "../context/ChartDataProvider/useChartDataProviderProps.js";
|
|
15
15
|
|
|
16
16
|
// utils
|
|
17
17
|
export * from "./defaultizeValueFormatter.js";
|
|
@@ -33,10 +33,10 @@ export * from "../context/ZAxisContextProvider.js";
|
|
|
33
33
|
export * from "../context/PluginProvider/index.js";
|
|
34
34
|
export * from "../context/AnimationProvider/index.js";
|
|
35
35
|
export { getAxisExtremum } from "../context/CartesianProvider/getAxisExtremum.js";
|
|
36
|
+
export * from "../context/ChartDataProvider/index.js";
|
|
36
37
|
|
|
37
38
|
// series configuration
|
|
38
39
|
export * from "../models/seriesType/config.js";
|
|
39
40
|
export * from "../models/seriesType/common.js";
|
|
40
|
-
export * from "../models/helpers.js";
|
|
41
41
|
export * from "../models/z-axis.js";
|
|
42
42
|
export * from "../models/axis.js";
|
|
@@ -12,7 +12,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _BarPlot = require("./BarPlot");
|
|
15
|
-
var
|
|
15
|
+
var _ChartContainer = require("../ChartContainer");
|
|
16
16
|
var _ChartsAxis = require("../ChartsAxis");
|
|
17
17
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
18
18
|
var _ChartsLegend = require("../ChartsLegend");
|
|
@@ -53,12 +53,12 @@ const BarChart = exports.BarChart = /*#__PURE__*/React.forwardRef(function BarCh
|
|
|
53
53
|
tooltipProps,
|
|
54
54
|
children
|
|
55
55
|
} = (0, _useBarChartProps.useBarChartProps)(props);
|
|
56
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartContainer.ChartContainer, (0, _extends2.default)({
|
|
57
57
|
ref: ref
|
|
58
58
|
}, chartContainerProps, {
|
|
59
59
|
children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
60
60
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_BarPlot.BarPlot, (0, _extends2.default)({}, barPlotProps)), /*#__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)(_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]
|
|
61
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), !props.hideLegend && /*#__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
62
|
}));
|
|
63
63
|
});
|
|
64
64
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
@@ -123,6 +123,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
123
123
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
124
124
|
*/
|
|
125
125
|
height: _propTypes.default.number,
|
|
126
|
+
/**
|
|
127
|
+
* If `true`, the legend is not rendered.
|
|
128
|
+
*/
|
|
129
|
+
hideLegend: _propTypes.default.bool,
|
|
126
130
|
/**
|
|
127
131
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
128
132
|
*/
|
|
@@ -141,32 +145,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
141
145
|
* @default yAxisIds[0] The id of the first provided axis
|
|
142
146
|
*/
|
|
143
147
|
leftAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
144
|
-
/**
|
|
145
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
146
|
-
*/
|
|
147
|
-
legend: _propTypes.default.shape({
|
|
148
|
-
classes: _propTypes.default.object,
|
|
149
|
-
direction: _propTypes.default.oneOf(['column', 'row']),
|
|
150
|
-
hidden: _propTypes.default.bool,
|
|
151
|
-
itemGap: _propTypes.default.number,
|
|
152
|
-
itemMarkHeight: _propTypes.default.number,
|
|
153
|
-
itemMarkWidth: _propTypes.default.number,
|
|
154
|
-
labelStyle: _propTypes.default.object,
|
|
155
|
-
markGap: _propTypes.default.number,
|
|
156
|
-
onItemClick: _propTypes.default.func,
|
|
157
|
-
padding: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
158
|
-
bottom: _propTypes.default.number,
|
|
159
|
-
left: _propTypes.default.number,
|
|
160
|
-
right: _propTypes.default.number,
|
|
161
|
-
top: _propTypes.default.number
|
|
162
|
-
})]),
|
|
163
|
-
position: _propTypes.default.shape({
|
|
164
|
-
horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
|
|
165
|
-
vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
166
|
-
}),
|
|
167
|
-
slotProps: _propTypes.default.object,
|
|
168
|
-
slots: _propTypes.default.object
|
|
169
|
-
}),
|
|
170
148
|
/**
|
|
171
149
|
* If `true`, a loading overlay is displayed.
|
|
172
150
|
* @default false
|
package/node/BarChart/BarPlot.js
CHANGED
|
@@ -57,6 +57,7 @@ const useAggregatedData = () => {
|
|
|
57
57
|
seriesOrder: []
|
|
58
58
|
};
|
|
59
59
|
const axisData = (0, _CartesianProvider.useCartesianContext)();
|
|
60
|
+
const drawingArea = (0, _hooks.useDrawingArea)();
|
|
60
61
|
const chartId = (0, _hooks.useChartId)();
|
|
61
62
|
const {
|
|
62
63
|
series,
|
|
@@ -74,9 +75,13 @@ const useAggregatedData = () => {
|
|
|
74
75
|
const data = stackingGroups.flatMap(({
|
|
75
76
|
ids: groupIds
|
|
76
77
|
}, groupIndex) => {
|
|
78
|
+
const xMin = drawingArea.left;
|
|
79
|
+
const xMax = drawingArea.left + drawingArea.width;
|
|
80
|
+
const yMin = drawingArea.top;
|
|
81
|
+
const yMax = drawingArea.top + drawingArea.height;
|
|
77
82
|
return groupIds.flatMap(seriesId => {
|
|
78
|
-
const xAxisId = series[seriesId].xAxisId ??
|
|
79
|
-
const yAxisId = series[seriesId].yAxisId ??
|
|
83
|
+
const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
|
|
84
|
+
const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
|
|
80
85
|
const xAxisConfig = xAxis[xAxisId];
|
|
81
86
|
const yAxisConfig = yAxis[yAxisId];
|
|
82
87
|
const verticalLayout = series[seriesId].layout === 'vertical';
|
|
@@ -117,6 +122,9 @@ const useAggregatedData = () => {
|
|
|
117
122
|
value: series[seriesId].data[dataIndex],
|
|
118
123
|
maskId: `${chartId}_${stackId || seriesId}_${groupIndex}_${dataIndex}`
|
|
119
124
|
};
|
|
125
|
+
if (result.x > xMax || result.x + result.width < xMin || result.y > yMax || result.y + result.height < yMin) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
120
128
|
if (!masks[result.maskId]) {
|
|
121
129
|
masks[result.maskId] = {
|
|
122
130
|
id: result.maskId,
|
|
@@ -139,7 +147,7 @@ const useAggregatedData = () => {
|
|
|
139
147
|
mask.hasNegative = mask.hasNegative || (result.value ?? 0) < 0;
|
|
140
148
|
mask.hasPositive = mask.hasPositive || (result.value ?? 0) > 0;
|
|
141
149
|
return result;
|
|
142
|
-
});
|
|
150
|
+
}).filter(rectangle => rectangle !== null);
|
|
143
151
|
});
|
|
144
152
|
});
|
|
145
153
|
return {
|
|
@@ -42,7 +42,7 @@ const getValueExtremum = direction => params => {
|
|
|
42
42
|
isDefaultAxis
|
|
43
43
|
} = params;
|
|
44
44
|
return Object.keys(series).filter(seriesId => {
|
|
45
|
-
const yAxisId = series[seriesId].yAxisId
|
|
45
|
+
const yAxisId = series[seriesId].yAxisId;
|
|
46
46
|
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
47
47
|
}).reduce((acc, seriesId) => {
|
|
48
48
|
const {
|
|
@@ -51,8 +51,8 @@ const getValueExtremum = direction => params => {
|
|
|
51
51
|
const filter = getFilters?.({
|
|
52
52
|
currentAxisId: axis.id,
|
|
53
53
|
isDefaultAxis,
|
|
54
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
55
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
54
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
55
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
56
56
|
});
|
|
57
57
|
const [seriesMin, seriesMax] = stackedData?.reduce((seriesAcc, values, index) => {
|
|
58
58
|
if (filter && (!filter(createResult(values[0], direction), index) || !filter(createResult(values[1], direction), index))) {
|