@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
package/BarChart/BarChart.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
3
|
import { BarPlotProps, BarPlotSlotProps, BarPlotSlots } from './BarPlot';
|
|
3
|
-
import {
|
|
4
|
+
import { ChartContainerProps } from '../ChartContainer';
|
|
4
5
|
import { ChartsAxisProps } from '../ChartsAxis';
|
|
5
6
|
import { BarSeriesType } from '../models/seriesType/bar';
|
|
6
|
-
import { MakeOptional } from '../models/helpers';
|
|
7
7
|
import { ChartsTooltipProps, ChartsTooltipSlotProps, ChartsTooltipSlots } from '../ChartsTooltip';
|
|
8
|
-
import {
|
|
8
|
+
import { ChartsLegendSlots, ChartsLegendSlotProps } from '../ChartsLegend';
|
|
9
9
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
10
10
|
import { ChartsAxisSlots, ChartsAxisSlotProps } from '../models/axis';
|
|
11
11
|
import { ChartsGridProps } from '../ChartsGrid';
|
|
@@ -15,7 +15,7 @@ export interface BarChartSlots extends ChartsAxisSlots, BarPlotSlots, ChartsLege
|
|
|
15
15
|
}
|
|
16
16
|
export interface BarChartSlotProps extends ChartsAxisSlotProps, BarPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps<'bar'>, ChartsOverlaySlotProps {
|
|
17
17
|
}
|
|
18
|
-
export interface BarChartProps extends Omit<
|
|
18
|
+
export interface BarChartProps extends Omit<ChartContainerProps, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<BarPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
|
|
19
19
|
/**
|
|
20
20
|
* The series to display in the bar chart.
|
|
21
21
|
* An array of [[BarSeriesType]] objects.
|
|
@@ -39,9 +39,9 @@ export interface BarChartProps extends Omit<ResponsiveChartContainerProps, 'seri
|
|
|
39
39
|
*/
|
|
40
40
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* If `true`, the legend is not rendered.
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
hideLegend?: boolean;
|
|
45
45
|
/**
|
|
46
46
|
* Overridable component slots.
|
|
47
47
|
* @default {}
|
|
@@ -69,5 +69,5 @@ export interface BarChartProps extends Omit<ResponsiveChartContainerProps, 'seri
|
|
|
69
69
|
*
|
|
70
70
|
* - [BarChart API](https://mui.com/x/api/charts/bar-chart/)
|
|
71
71
|
*/
|
|
72
|
-
declare const BarChart: React.ForwardRefExoticComponent<BarChartProps & React.RefAttributes<
|
|
72
|
+
declare const BarChart: React.ForwardRefExoticComponent<BarChartProps & React.RefAttributes<SVGSVGElement>>;
|
|
73
73
|
export { BarChart };
|
package/BarChart/BarChart.js
CHANGED
|
@@ -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 { BarPlot } from "./BarPlot.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";
|
|
@@ -46,12 +46,12 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(inProps, ref) {
|
|
|
46
46
|
tooltipProps,
|
|
47
47
|
children
|
|
48
48
|
} = useBarChartProps(props);
|
|
49
|
-
return /*#__PURE__*/_jsxs(
|
|
49
|
+
return /*#__PURE__*/_jsxs(ChartContainer, _extends({
|
|
50
50
|
ref: ref
|
|
51
51
|
}, chartContainerProps, {
|
|
52
52
|
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
53
53
|
children: [/*#__PURE__*/_jsx(BarPlot, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
54
|
-
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
54
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
55
55
|
}));
|
|
56
56
|
});
|
|
57
57
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
@@ -116,6 +116,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
116
116
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
117
117
|
*/
|
|
118
118
|
height: PropTypes.number,
|
|
119
|
+
/**
|
|
120
|
+
* If `true`, the legend is not rendered.
|
|
121
|
+
*/
|
|
122
|
+
hideLegend: PropTypes.bool,
|
|
119
123
|
/**
|
|
120
124
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
121
125
|
*/
|
|
@@ -134,32 +138,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
134
138
|
* @default yAxisIds[0] The id of the first provided axis
|
|
135
139
|
*/
|
|
136
140
|
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
137
|
-
/**
|
|
138
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
139
|
-
*/
|
|
140
|
-
legend: PropTypes.shape({
|
|
141
|
-
classes: PropTypes.object,
|
|
142
|
-
direction: PropTypes.oneOf(['column', 'row']),
|
|
143
|
-
hidden: PropTypes.bool,
|
|
144
|
-
itemGap: PropTypes.number,
|
|
145
|
-
itemMarkHeight: PropTypes.number,
|
|
146
|
-
itemMarkWidth: PropTypes.number,
|
|
147
|
-
labelStyle: PropTypes.object,
|
|
148
|
-
markGap: PropTypes.number,
|
|
149
|
-
onItemClick: PropTypes.func,
|
|
150
|
-
padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
151
|
-
bottom: PropTypes.number,
|
|
152
|
-
left: PropTypes.number,
|
|
153
|
-
right: PropTypes.number,
|
|
154
|
-
top: PropTypes.number
|
|
155
|
-
})]),
|
|
156
|
-
position: PropTypes.shape({
|
|
157
|
-
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
158
|
-
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
159
|
-
}),
|
|
160
|
-
slotProps: PropTypes.object,
|
|
161
|
-
slots: PropTypes.object
|
|
162
|
-
}),
|
|
163
141
|
/**
|
|
164
142
|
* If `true`, a loading overlay is displayed.
|
|
165
143
|
* @default false
|
package/BarChart/BarElement.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AnimatedProps } from '@react-spring/web';
|
|
3
|
-
import { SlotComponentPropsFromProps } from '
|
|
3
|
+
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
4
4
|
import { SeriesId } from '../models/seriesType/common';
|
|
5
5
|
export interface BarElementClasses {
|
|
6
6
|
/** Styles applied to the root element. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SlotComponentPropsFromProps } from '
|
|
2
|
+
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
3
3
|
import { BarLabelOwnerState, BarItem, BarLabelContext } from './BarLabel.types';
|
|
4
4
|
import { BarLabelProps } from './BarLabel';
|
|
5
5
|
export interface BarLabelSlots {
|
package/BarChart/BarPlot.js
CHANGED
|
@@ -9,7 +9,7 @@ import { useTransition } from '@react-spring/web';
|
|
|
9
9
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
10
10
|
import { BarElement } from "./BarElement.js";
|
|
11
11
|
import getColor from "./getColor.js";
|
|
12
|
-
import { useChartId } from "../hooks/index.js";
|
|
12
|
+
import { useChartId, useDrawingArea } from "../hooks/index.js";
|
|
13
13
|
import { BarClipPath } from "./BarClipPath.js";
|
|
14
14
|
import { BarLabelPlot } from "./BarLabel/BarLabelPlot.js";
|
|
15
15
|
import { checkScaleErrors } from "./checkScaleErrors.js";
|
|
@@ -51,6 +51,7 @@ const useAggregatedData = () => {
|
|
|
51
51
|
seriesOrder: []
|
|
52
52
|
};
|
|
53
53
|
const axisData = useCartesianContext();
|
|
54
|
+
const drawingArea = useDrawingArea();
|
|
54
55
|
const chartId = useChartId();
|
|
55
56
|
const {
|
|
56
57
|
series,
|
|
@@ -68,9 +69,13 @@ const useAggregatedData = () => {
|
|
|
68
69
|
const data = stackingGroups.flatMap(({
|
|
69
70
|
ids: groupIds
|
|
70
71
|
}, groupIndex) => {
|
|
72
|
+
const xMin = drawingArea.left;
|
|
73
|
+
const xMax = drawingArea.left + drawingArea.width;
|
|
74
|
+
const yMin = drawingArea.top;
|
|
75
|
+
const yMax = drawingArea.top + drawingArea.height;
|
|
71
76
|
return groupIds.flatMap(seriesId => {
|
|
72
|
-
const xAxisId = series[seriesId].xAxisId ??
|
|
73
|
-
const yAxisId = series[seriesId].yAxisId ??
|
|
77
|
+
const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
|
|
78
|
+
const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
|
|
74
79
|
const xAxisConfig = xAxis[xAxisId];
|
|
75
80
|
const yAxisConfig = yAxis[yAxisId];
|
|
76
81
|
const verticalLayout = series[seriesId].layout === 'vertical';
|
|
@@ -111,6 +116,9 @@ const useAggregatedData = () => {
|
|
|
111
116
|
value: series[seriesId].data[dataIndex],
|
|
112
117
|
maskId: `${chartId}_${stackId || seriesId}_${groupIndex}_${dataIndex}`
|
|
113
118
|
};
|
|
119
|
+
if (result.x > xMax || result.x + result.width < xMin || result.y > yMax || result.y + result.height < yMin) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
114
122
|
if (!masks[result.maskId]) {
|
|
115
123
|
masks[result.maskId] = {
|
|
116
124
|
id: result.maskId,
|
|
@@ -133,7 +141,7 @@ const useAggregatedData = () => {
|
|
|
133
141
|
mask.hasNegative = mask.hasNegative || (result.value ?? 0) < 0;
|
|
134
142
|
mask.hasPositive = mask.hasPositive || (result.value ?? 0) > 0;
|
|
135
143
|
return result;
|
|
136
|
-
});
|
|
144
|
+
}).filter(rectangle => rectangle !== null);
|
|
137
145
|
});
|
|
138
146
|
});
|
|
139
147
|
return {
|
package/BarChart/extremums.js
CHANGED
|
@@ -36,7 +36,7 @@ const getValueExtremum = direction => params => {
|
|
|
36
36
|
isDefaultAxis
|
|
37
37
|
} = params;
|
|
38
38
|
return Object.keys(series).filter(seriesId => {
|
|
39
|
-
const yAxisId = series[seriesId].yAxisId
|
|
39
|
+
const yAxisId = series[seriesId].yAxisId;
|
|
40
40
|
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
41
41
|
}).reduce((acc, seriesId) => {
|
|
42
42
|
const {
|
|
@@ -45,8 +45,8 @@ const getValueExtremum = direction => params => {
|
|
|
45
45
|
const filter = getFilters?.({
|
|
46
46
|
currentAxisId: axis.id,
|
|
47
47
|
isDefaultAxis,
|
|
48
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
49
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
48
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
49
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
50
50
|
});
|
|
51
51
|
const [seriesMin, seriesMax] = stackedData?.reduce((seriesAcc, values, index) => {
|
|
52
52
|
if (filter && (!filter(createResult(values[0], direction), index) || !filter(createResult(values[1], direction), index))) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BarChartProps } from './BarChart';
|
|
2
|
-
import {
|
|
2
|
+
import { ChartContainerProps } from '../ChartContainer';
|
|
3
3
|
import { BarPlotProps } from './BarPlot';
|
|
4
4
|
import { ChartsOnAxisClickHandlerProps } from '../ChartsOnAxisClickHandler';
|
|
5
5
|
import { ChartsGridProps } from '../ChartsGrid';
|
|
@@ -17,7 +17,7 @@ import { ChartsTooltipProps } from '../ChartsTooltip';
|
|
|
17
17
|
* @returns An object with props for the children components of BarChart
|
|
18
18
|
*/
|
|
19
19
|
export declare const useBarChartProps: (props: BarChartProps) => {
|
|
20
|
-
chartContainerProps:
|
|
20
|
+
chartContainerProps: ChartContainerProps;
|
|
21
21
|
barPlotProps: BarPlotProps;
|
|
22
22
|
axisClickHandlerProps: ChartsOnAxisClickHandlerProps;
|
|
23
23
|
gridProps: ChartsGridProps;
|
|
@@ -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", "series", "width", "height", "margin", "colors", "dataset", "sx", "tooltip", "onAxisClick", "axisHighlight", "
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "tooltip", "onAxisClick", "axisHighlight", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend"];
|
|
6
6
|
import useId from '@mui/utils/useId';
|
|
7
7
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../constants/index.js";
|
|
8
8
|
/**
|
|
@@ -26,7 +26,6 @@ export const useBarChartProps = props => {
|
|
|
26
26
|
tooltip,
|
|
27
27
|
onAxisClick,
|
|
28
28
|
axisHighlight,
|
|
29
|
-
legend,
|
|
30
29
|
grid,
|
|
31
30
|
topAxis,
|
|
32
31
|
leftAxis,
|
|
@@ -117,10 +116,10 @@ export const useBarChartProps = props => {
|
|
|
117
116
|
} : {
|
|
118
117
|
x: 'band'
|
|
119
118
|
}, axisHighlight);
|
|
120
|
-
const legendProps =
|
|
119
|
+
const legendProps = {
|
|
121
120
|
slots,
|
|
122
121
|
slotProps
|
|
123
|
-
}
|
|
122
|
+
};
|
|
124
123
|
const tooltipProps = _extends({}, tooltip, {
|
|
125
124
|
slots,
|
|
126
125
|
slotProps
|