@mui/x-charts 8.5.3 → 8.7.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/AnimatedBarElement.js +3 -1
- package/BarChart/BarLabel/BarLabelPlot.d.ts +2 -2
- package/BarChart/BarLabel/BarLabelPlot.js +33 -25
- package/BarChart/BarPlot.js +59 -183
- package/BarChart/barClasses.d.ts +12 -0
- package/BarChart/barClasses.js +25 -0
- package/BarChart/index.d.ts +3 -1
- package/BarChart/index.js +23 -1
- package/BarChart/types.d.ts +5 -1
- package/BarChart/useBarPlotData.d.ts +8 -0
- package/BarChart/useBarPlotData.js +146 -0
- package/CHANGELOG.md +210 -0
- package/ChartContainer/ChartContainer.d.ts +1 -21
- package/ChartContainer/ChartContainer.js +0 -8
- package/ChartContainer/index.d.ts +8 -1
- package/ChartsLegend/ChartsLegend.js +1 -0
- package/ChartsReferenceLine/ChartsReferenceLine.d.ts +1 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +3 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +48 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +3 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.js +48 -1
- package/ChartsReferenceLine/index.d.ts +3 -1
- package/ChartsSurface/ChartsSurface.js +2 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +6 -3
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/ChartsTooltip/utils.js +18 -29
- package/ChartsXAxis/ChartsXAxis.js +4 -108
- package/ChartsXAxis/getVisibleLabels.d.ts +14 -0
- package/ChartsXAxis/getVisibleLabels.js +71 -0
- package/ChartsXAxis/shortenLabels.d.ts +4 -0
- package/ChartsXAxis/shortenLabels.js +48 -0
- package/ChartsYAxis/ChartsYAxis.js +2 -39
- package/ChartsYAxis/shortenLabels.d.ts +4 -0
- package/ChartsYAxis/shortenLabels.js +46 -0
- package/LineChart/AnimatedArea.js +4 -1
- package/LineChart/AnimatedLine.js +4 -1
- package/LineChart/AreaPlot.js +5 -115
- package/LineChart/CircleMarkElement.js +4 -1
- package/LineChart/LinePlot.js +5 -99
- package/LineChart/MarkElement.js +4 -1
- package/LineChart/MarkPlot.js +1 -0
- package/LineChart/useAreaPlotData.d.ts +12 -0
- package/LineChart/useAreaPlotData.js +125 -0
- package/LineChart/useLinePlotData.d.ts +11 -0
- package/LineChart/useLinePlotData.js +108 -0
- package/PieChart/PieArc.js +3 -1
- package/PieChart/PiePlot.js +6 -0
- package/PieChart/index.d.ts +3 -1
- package/PieChart/index.js +18 -1
- package/PieChart/pieClasses.d.ts +12 -0
- package/PieChart/pieClasses.js +24 -0
- package/ScatterChart/Scatter.js +22 -48
- package/ScatterChart/useScatterPlotData.d.ts +8 -0
- package/ScatterChart/useScatterPlotData.js +33 -0
- package/Toolbar/ToolbarButton.js +2 -0
- package/context/ChartApi.d.ts +22 -0
- package/context/ChartApi.js +5 -0
- package/context/ChartProvider/ChartContext.js +1 -0
- package/context/index.d.ts +2 -1
- package/context/useChartApiContext.d.ts +1 -1
- package/esm/BarChart/AnimatedBarElement.js +3 -1
- package/esm/BarChart/BarLabel/BarLabelPlot.d.ts +2 -2
- package/esm/BarChart/BarLabel/BarLabelPlot.js +33 -25
- package/esm/BarChart/BarPlot.js +60 -185
- package/esm/BarChart/barClasses.d.ts +12 -0
- package/esm/BarChart/barClasses.js +15 -0
- package/esm/BarChart/index.d.ts +3 -1
- package/esm/BarChart/index.js +2 -1
- package/esm/BarChart/types.d.ts +5 -1
- package/esm/BarChart/useBarPlotData.d.ts +8 -0
- package/esm/BarChart/useBarPlotData.js +139 -0
- package/esm/ChartContainer/ChartContainer.d.ts +1 -21
- package/esm/ChartContainer/ChartContainer.js +0 -8
- package/esm/ChartContainer/index.d.ts +8 -1
- package/esm/ChartContainer/index.js +6 -1
- package/esm/ChartsLegend/ChartsLegend.js +1 -0
- package/esm/ChartsReferenceLine/ChartsReferenceLine.d.ts +1 -1
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.d.ts +3 -0
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +47 -0
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.d.ts +3 -0
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +47 -0
- package/esm/ChartsReferenceLine/index.d.ts +3 -1
- package/esm/ChartsReferenceLine/index.js +2 -1
- package/esm/ChartsSurface/ChartsSurface.js +2 -1
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +6 -3
- package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/esm/ChartsTooltip/utils.js +18 -29
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -106
- package/esm/ChartsXAxis/getVisibleLabels.d.ts +14 -0
- package/esm/ChartsXAxis/getVisibleLabels.js +67 -0
- package/esm/ChartsXAxis/shortenLabels.d.ts +4 -0
- package/esm/ChartsXAxis/shortenLabels.js +42 -0
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -38
- package/esm/ChartsYAxis/shortenLabels.d.ts +4 -0
- package/esm/ChartsYAxis/shortenLabels.js +41 -0
- package/esm/LineChart/AnimatedArea.js +4 -1
- package/esm/LineChart/AnimatedLine.js +4 -1
- package/esm/LineChart/AreaPlot.js +5 -115
- package/esm/LineChart/CircleMarkElement.js +4 -1
- package/esm/LineChart/LinePlot.js +5 -99
- package/esm/LineChart/MarkElement.js +4 -1
- package/esm/LineChart/MarkPlot.js +1 -0
- package/esm/LineChart/useAreaPlotData.d.ts +12 -0
- package/esm/LineChart/useAreaPlotData.js +118 -0
- package/esm/LineChart/useLinePlotData.d.ts +11 -0
- package/esm/LineChart/useLinePlotData.js +101 -0
- package/esm/PieChart/PieArc.js +3 -1
- package/esm/PieChart/PiePlot.js +6 -0
- package/esm/PieChart/index.d.ts +3 -1
- package/esm/PieChart/index.js +2 -1
- package/esm/PieChart/pieClasses.d.ts +12 -0
- package/esm/PieChart/pieClasses.js +15 -0
- package/esm/ScatterChart/Scatter.js +23 -49
- package/esm/ScatterChart/useScatterPlotData.d.ts +8 -0
- package/esm/ScatterChart/useScatterPlotData.js +26 -0
- package/esm/Toolbar/ToolbarButton.js +2 -0
- package/esm/context/ChartApi.d.ts +22 -0
- package/esm/context/ChartApi.js +1 -0
- package/esm/context/ChartProvider/ChartContext.js +2 -0
- package/esm/context/index.d.ts +2 -1
- package/esm/context/useChartApiContext.d.ts +1 -1
- package/esm/hooks/useInteractionItemProps.d.ts +14 -9
- package/esm/hooks/useInteractionItemProps.js +28 -28
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -2
- package/esm/internals/components/NotRendered.d.ts +9 -0
- package/esm/internals/components/NotRendered.js +10 -0
- package/esm/internals/index.d.ts +6 -0
- package/esm/internals/index.js +6 -0
- package/esm/internals/plugins/corePlugins/corePlugins.d.ts +3 -2
- package/esm/internals/plugins/corePlugins/corePlugins.js +2 -1
- package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +1 -1
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +1 -1
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +3 -3
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +2 -2
- package/esm/internals/plugins/corePlugins/useChartId/useChartId.js +2 -0
- package/esm/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/index.d.ts +2 -0
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/index.js +1 -0
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.d.ts +3 -0
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +77 -0
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +31 -0
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.js +1 -0
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +4 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +44 -33
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +5 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +7 -7
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +5 -5
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -6
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +52 -36
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -5
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +6 -6
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +47 -30
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +1 -1
- package/esm/internals/store/useCharts.d.ts +1 -1
- package/esm/locales/elGR.d.ts +19 -0
- package/esm/locales/elGR.js +15 -0
- package/esm/locales/enUS.d.ts +3 -0
- package/esm/locales/enUS.js +8 -2
- package/esm/locales/frFR.d.ts +3 -0
- package/esm/locales/frFR.js +7 -0
- package/esm/locales/index.d.ts +1 -0
- package/esm/locales/index.js +1 -0
- package/esm/locales/ptBR.d.ts +3 -0
- package/esm/locales/ptBR.js +7 -1
- package/esm/locales/ptPT.d.ts +3 -0
- package/esm/locales/ptPT.js +7 -1
- package/esm/locales/utils/chartsLocaleTextApi.d.ts +17 -0
- package/esm/locales/utils/getChartsLocalization.d.ts +3 -0
- package/esm/locales/utils/imageMimeTypes.d.ts +2 -0
- package/esm/locales/utils/imageMimeTypes.js +5 -0
- package/esm/models/slots/chartsBaseSlotProps.d.ts +4 -0
- package/hooks/useInteractionItemProps.d.ts +14 -9
- package/hooks/useInteractionItemProps.js +29 -28
- package/index.d.ts +2 -1
- package/index.js +37 -11
- package/internals/components/NotRendered.d.ts +9 -0
- package/internals/components/NotRendered.js +16 -0
- package/internals/index.d.ts +6 -0
- package/internals/index.js +56 -0
- package/internals/plugins/corePlugins/corePlugins.d.ts +3 -2
- package/internals/plugins/corePlugins/corePlugins.js +2 -1
- package/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +1 -1
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +3 -3
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +2 -2
- package/internals/plugins/corePlugins/useChartId/useChartId.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/index.d.ts +2 -0
- package/internals/plugins/corePlugins/useChartInteractionListener/index.js +12 -0
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +84 -0
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +31 -0
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.js +5 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +44 -33
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +5 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +7 -7
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +5 -5
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -6
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +52 -36
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -5
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +6 -6
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +46 -30
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +1 -1
- package/internals/store/useCharts.d.ts +1 -1
- package/locales/elGR.d.ts +19 -0
- package/locales/elGR.js +21 -0
- package/locales/enUS.d.ts +3 -0
- package/locales/enUS.js +8 -2
- package/locales/frFR.d.ts +3 -0
- package/locales/frFR.js +7 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +11 -0
- package/locales/ptBR.d.ts +3 -0
- package/locales/ptBR.js +7 -1
- package/locales/ptPT.d.ts +3 -0
- package/locales/ptPT.js +7 -1
- package/locales/utils/chartsLocaleTextApi.d.ts +17 -0
- package/locales/utils/getChartsLocalization.d.ts +3 -0
- package/locales/utils/imageMimeTypes.d.ts +2 -0
- package/locales/utils/imageMimeTypes.js +11 -0
- package/models/slots/chartsBaseSlotProps.d.ts +4 -0
- package/package.json +3 -2
package/ScatterChart/Scatter.js
CHANGED
|
@@ -12,15 +12,15 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _useSlotProps2 = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
15
|
-
var _useScale = require("../hooks/useScale");
|
|
16
15
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
17
16
|
var _useStore = require("../internals/store/useStore");
|
|
18
17
|
var _useSelector = require("../internals/store/useSelector");
|
|
19
18
|
var _useItemHighlightedGetter = require("../hooks/useItemHighlightedGetter");
|
|
20
19
|
var _useChartVoronoi = require("../internals/plugins/featurePlugins/useChartVoronoi");
|
|
21
|
-
var _ChartProvider = require("../context/ChartProvider");
|
|
22
20
|
var _ScatterMarker = require("./ScatterMarker");
|
|
23
21
|
var _scatterClasses = require("./scatterClasses");
|
|
22
|
+
var _useScatterPlotData = require("./useScatterPlotData");
|
|
23
|
+
var _ChartProvider = require("../context/ChartProvider");
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
const _excluded = ["ownerState"];
|
|
26
26
|
/**
|
|
@@ -55,37 +55,7 @@ function Scatter(props) {
|
|
|
55
55
|
isFaded,
|
|
56
56
|
isHighlighted
|
|
57
57
|
} = (0, _useItemHighlightedGetter.useItemHighlightedGetter)();
|
|
58
|
-
const
|
|
59
|
-
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
60
|
-
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
61
|
-
const temp = [];
|
|
62
|
-
for (let i = 0; i < series.data.length; i += 1) {
|
|
63
|
-
const scatterPoint = series.data[i];
|
|
64
|
-
const x = getXPosition(scatterPoint.x);
|
|
65
|
-
const y = getYPosition(scatterPoint.y);
|
|
66
|
-
const isInRange = instance.isPointInside(x, y);
|
|
67
|
-
if (isInRange) {
|
|
68
|
-
const currentItem = {
|
|
69
|
-
seriesId: series.id,
|
|
70
|
-
dataIndex: i
|
|
71
|
-
};
|
|
72
|
-
const isItemHighlighted = isHighlighted(currentItem);
|
|
73
|
-
temp.push({
|
|
74
|
-
x,
|
|
75
|
-
y,
|
|
76
|
-
isHighlighted: isItemHighlighted,
|
|
77
|
-
isFaded: !isItemHighlighted && isFaded(currentItem),
|
|
78
|
-
id: scatterPoint.id,
|
|
79
|
-
seriesId: series.id,
|
|
80
|
-
type: 'scatter',
|
|
81
|
-
dataIndex: i,
|
|
82
|
-
color: colorGetter ? colorGetter(i) : color
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return temp;
|
|
87
|
-
}, [xScale, yScale, series.data, series.id, isHighlighted, isFaded, colorGetter, color, instance]);
|
|
88
|
-
const interactionItemProps = (0, _useInteractionItemProps.useInteractionAllItemProps)(cleanData, skipInteractionHandlers);
|
|
58
|
+
const scatterPlotData = (0, _useScatterPlotData.useScatterPlotData)(series, xScale, yScale, instance.isPointInside);
|
|
89
59
|
const Marker = slots?.marker ?? _ScatterMarker.ScatterMarker;
|
|
90
60
|
const _useSlotProps = (0, _useSlotProps2.default)({
|
|
91
61
|
elementType: Marker,
|
|
@@ -101,21 +71,25 @@ function Scatter(props) {
|
|
|
101
71
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
102
72
|
"data-series": series.id,
|
|
103
73
|
className: classes.root,
|
|
104
|
-
children:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
74
|
+
children: scatterPlotData.map((dataPoint, i) => {
|
|
75
|
+
const isItemHighlighted = isHighlighted(dataPoint);
|
|
76
|
+
const isItemFaded = !isItemHighlighted && isFaded(dataPoint);
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Marker, (0, _extends2.default)({
|
|
78
|
+
dataIndex: dataPoint.dataIndex,
|
|
79
|
+
color: colorGetter ? colorGetter(i) : color,
|
|
80
|
+
isHighlighted: isItemHighlighted,
|
|
81
|
+
isFaded: isItemFaded,
|
|
82
|
+
x: dataPoint.x,
|
|
83
|
+
y: dataPoint.y,
|
|
84
|
+
onClick: onItemClick && (event => onItemClick(event, {
|
|
85
|
+
type: 'scatter',
|
|
86
|
+
seriesId: series.id,
|
|
87
|
+
dataIndex: dataPoint.dataIndex
|
|
88
|
+
})),
|
|
89
|
+
"data-highlighted": isItemHighlighted || undefined,
|
|
90
|
+
"data-faded": isItemFaded || undefined
|
|
91
|
+
}, skipInteractionHandlers ? undefined : (0, _useInteractionItemProps.getInteractionItemProps)(instance, dataPoint), markerProps), dataPoint.id ?? dataPoint.dataIndex);
|
|
92
|
+
})
|
|
119
93
|
});
|
|
120
94
|
}
|
|
121
95
|
process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SeriesId } from "../models/seriesType/common.js";
|
|
2
|
+
import { D3Scale } from "../models/axis.js";
|
|
3
|
+
import { DefaultizedScatterSeriesType, ScatterValueType } from "../models/index.js";
|
|
4
|
+
export declare function useScatterPlotData(series: DefaultizedScatterSeriesType, xScale: D3Scale, yScale: D3Scale, isPointInside: (x: number, y: number) => boolean): (ScatterValueType & {
|
|
5
|
+
dataIndex: number;
|
|
6
|
+
seriesId: SeriesId;
|
|
7
|
+
type: "scatter";
|
|
8
|
+
})[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useScatterPlotData = useScatterPlotData;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _hooks = require("../hooks");
|
|
10
|
+
function useScatterPlotData(series, xScale, yScale, isPointInside) {
|
|
11
|
+
return React.useMemo(() => {
|
|
12
|
+
const getXPosition = (0, _hooks.getValueToPositionMapper)(xScale);
|
|
13
|
+
const getYPosition = (0, _hooks.getValueToPositionMapper)(yScale);
|
|
14
|
+
const temp = [];
|
|
15
|
+
for (let i = 0; i < series.data.length; i += 1) {
|
|
16
|
+
const scatterPoint = series.data[i];
|
|
17
|
+
const x = getXPosition(scatterPoint.x);
|
|
18
|
+
const y = getYPosition(scatterPoint.y);
|
|
19
|
+
const isInRange = isPointInside(x, y);
|
|
20
|
+
if (isInRange) {
|
|
21
|
+
temp.push({
|
|
22
|
+
x,
|
|
23
|
+
y,
|
|
24
|
+
id: scatterPoint.id,
|
|
25
|
+
seriesId: series.id,
|
|
26
|
+
type: 'scatter',
|
|
27
|
+
dataIndex: i
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return temp;
|
|
32
|
+
}, [xScale, yScale, series.data, series.id, isPointInside]);
|
|
33
|
+
}
|
package/Toolbar/ToolbarButton.js
CHANGED
|
@@ -51,10 +51,12 @@ process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
|
|
|
51
51
|
// ----------------------------------------------------------------------
|
|
52
52
|
className: _propTypes.default.string,
|
|
53
53
|
disabled: _propTypes.default.bool,
|
|
54
|
+
id: _propTypes.default.string,
|
|
54
55
|
/**
|
|
55
56
|
* A function to customize the rendering of the component.
|
|
56
57
|
*/
|
|
57
58
|
render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
59
|
+
size: _propTypes.default.oneOf(['large', 'medium', 'small']),
|
|
58
60
|
style: _propTypes.default.object,
|
|
59
61
|
tabIndex: _propTypes.default.number
|
|
60
62
|
} : void 0;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PieChartPluginSignatures } from "../PieChart/PieChart.plugins.js";
|
|
2
|
+
import type { BarChartPluginsSignatures } from "../BarChart/BarChart.plugins.js";
|
|
3
|
+
import type { ScatterChartPluginsSignatures } from "../ScatterChart/ScatterChart.plugins.js";
|
|
4
|
+
import type { LineChartPluginsSignatures } from "../LineChart/LineChart.plugins.js";
|
|
5
|
+
import type { AllPluginSignatures, DefaultPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
6
|
+
import type { ChartAnyPluginSignature } from "../internals/plugins/models/plugin.js";
|
|
7
|
+
import type { ChartPublicAPI } from "../internals/plugins/models/index.js";
|
|
8
|
+
export type PluginsPerSeriesType = {
|
|
9
|
+
line: LineChartPluginsSignatures;
|
|
10
|
+
scatter: ScatterChartPluginsSignatures;
|
|
11
|
+
bar: BarChartPluginsSignatures;
|
|
12
|
+
pie: PieChartPluginSignatures;
|
|
13
|
+
composition: DefaultPluginSignatures;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The API of the chart `apiRef` object.
|
|
17
|
+
* The chart type can be passed as the first generic parameter to narrow down the API to the specific chart type.
|
|
18
|
+
* @example ChartApi<'bar'>
|
|
19
|
+
* If the chart is being created using composition, the `composition` value can be used.
|
|
20
|
+
* @example ChartApi<'composition'>
|
|
21
|
+
*/
|
|
22
|
+
export type ChartApi<TSeries extends keyof PluginsPerSeriesType | undefined = undefined, TSignatures extends readonly ChartAnyPluginSignature[] = (TSeries extends keyof PluginsPerSeriesType ? PluginsPerSeriesType[TSeries] : AllPluginSignatures)> = ChartPublicAPI<TSignatures>;
|
package/context/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export type { HighlightScope, FadeOptions, HighlightItemData, HighlightOptions } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
2
|
-
export * from "./useChartApiContext.js";
|
|
2
|
+
export * from "./useChartApiContext.js";
|
|
3
|
+
export type { ChartApi } from "./ChartApi.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ChartApi } from "
|
|
2
|
+
import { ChartApi } from "./ChartApi.js";
|
|
3
3
|
/**
|
|
4
4
|
* The `useChartApiContext` hook provides access to the chart API.
|
|
5
5
|
* This is only available when the chart is rendered within a chart or a `ChartDataProvider` component.
|
|
@@ -14,6 +14,8 @@ export function AnimatedBarElement(props) {
|
|
|
14
14
|
const animatedProps = useAnimateBar(props);
|
|
15
15
|
return /*#__PURE__*/_jsx("rect", _extends({}, other, {
|
|
16
16
|
filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
|
|
17
|
-
opacity: ownerState.isFaded ? 0.3 : 1
|
|
17
|
+
opacity: ownerState.isFaded ? 0.3 : 1,
|
|
18
|
+
"data-highlighted": ownerState.isHighlighted || undefined,
|
|
19
|
+
"data-faded": ownerState.isFaded || undefined
|
|
18
20
|
}, animatedProps));
|
|
19
21
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ProcessedBarSeriesData } from "../types.js";
|
|
3
3
|
import { BarLabelItemProps } from "./BarLabelItem.js";
|
|
4
4
|
type BarLabelPlotProps = {
|
|
5
|
-
bars:
|
|
5
|
+
bars: ProcessedBarSeriesData[];
|
|
6
6
|
skipAnimation?: boolean;
|
|
7
7
|
barLabel?: BarLabelItemProps['barLabel'];
|
|
8
8
|
};
|
|
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["bars", "skipAnimation"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { BarLabelItem } from "./BarLabelItem.js";
|
|
6
|
+
import { useUtilityClasses } from "../barClasses.js";
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
/**
|
|
8
9
|
* @ignore - internal component.
|
|
@@ -13,33 +14,40 @@ function BarLabelPlot(props) {
|
|
|
13
14
|
skipAnimation
|
|
14
15
|
} = props,
|
|
15
16
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
17
|
+
const classes = useUtilityClasses();
|
|
16
18
|
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
17
|
-
children: bars.
|
|
18
|
-
xOrigin,
|
|
19
|
-
yOrigin,
|
|
20
|
-
x,
|
|
21
|
-
y,
|
|
19
|
+
children: bars.flatMap(({
|
|
22
20
|
seriesId,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
21
|
+
data
|
|
22
|
+
}) => /*#__PURE__*/_jsx("g", {
|
|
23
|
+
className: classes.seriesLabels,
|
|
24
|
+
"data-series": seriesId,
|
|
25
|
+
children: data.map(({
|
|
26
|
+
xOrigin,
|
|
27
|
+
yOrigin,
|
|
28
|
+
x,
|
|
29
|
+
y,
|
|
30
|
+
dataIndex,
|
|
31
|
+
color,
|
|
32
|
+
value,
|
|
33
|
+
width,
|
|
34
|
+
height,
|
|
35
|
+
layout
|
|
36
|
+
}) => /*#__PURE__*/_jsx(BarLabelItem, _extends({
|
|
37
|
+
seriesId: seriesId,
|
|
38
|
+
dataIndex: dataIndex,
|
|
39
|
+
value: value,
|
|
40
|
+
color: color,
|
|
41
|
+
xOrigin: xOrigin,
|
|
42
|
+
yOrigin: yOrigin,
|
|
43
|
+
x: x,
|
|
44
|
+
y: y,
|
|
45
|
+
width: width,
|
|
46
|
+
height: height,
|
|
47
|
+
skipAnimation: skipAnimation ?? false,
|
|
48
|
+
layout: layout ?? 'vertical'
|
|
49
|
+
}, other), dataIndex))
|
|
50
|
+
}, seriesId))
|
|
43
51
|
});
|
|
44
52
|
}
|
|
45
53
|
export { BarLabelPlot };
|
package/esm/BarChart/BarPlot.js
CHANGED
|
@@ -8,155 +8,14 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
9
|
import { barElementClasses } from "./barElementClasses.js";
|
|
10
10
|
import { BarElement } from "./BarElement.js";
|
|
11
|
-
import
|
|
12
|
-
import { useChartId, useDrawingArea, useXAxes, useYAxes } from "../hooks/index.js";
|
|
11
|
+
import { useDrawingArea, useXAxes, useYAxes } from "../hooks/index.js";
|
|
13
12
|
import { BarClipPath } from "./BarClipPath.js";
|
|
14
13
|
import { BarLabelPlot } from "./BarLabel/BarLabelPlot.js";
|
|
15
|
-
import { checkScaleErrors } from "./checkScaleErrors.js";
|
|
16
|
-
import { useBarSeriesContext } from "../hooks/useBarSeries.js";
|
|
17
14
|
import { useSkipAnimation } from "../hooks/useSkipAnimation.js";
|
|
18
15
|
import { useInternalIsZoomInteracting } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* Solution of the equations
|
|
22
|
-
* W = barWidth * N + offset * (N-1)
|
|
23
|
-
* offset / (offset + barWidth) = r
|
|
24
|
-
* @param bandWidth The width available to place bars.
|
|
25
|
-
* @param numberOfGroups The number of bars to place in that space.
|
|
26
|
-
* @param gapRatio The ratio of the gap between bars over the bar width.
|
|
27
|
-
* @returns The bar width and the offset between bars.
|
|
28
|
-
*/
|
|
16
|
+
import { useBarPlotData } from "./useBarPlotData.js";
|
|
17
|
+
import { useUtilityClasses } from "./barClasses.js";
|
|
29
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
|
-
function getBandSize({
|
|
31
|
-
bandWidth: W,
|
|
32
|
-
numberOfGroups: N,
|
|
33
|
-
gapRatio: r
|
|
34
|
-
}) {
|
|
35
|
-
if (r === 0) {
|
|
36
|
-
return {
|
|
37
|
-
barWidth: W / N,
|
|
38
|
-
offset: 0
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
const barWidth = W / (N + (N - 1) * r);
|
|
42
|
-
const offset = r * barWidth;
|
|
43
|
-
return {
|
|
44
|
-
barWidth,
|
|
45
|
-
offset
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
const useAggregatedData = () => {
|
|
49
|
-
const seriesData = useBarSeriesContext() ?? {
|
|
50
|
-
series: {},
|
|
51
|
-
stackingGroups: [],
|
|
52
|
-
seriesOrder: []
|
|
53
|
-
};
|
|
54
|
-
const drawingArea = useDrawingArea();
|
|
55
|
-
const chartId = useChartId();
|
|
56
|
-
const {
|
|
57
|
-
series,
|
|
58
|
-
stackingGroups
|
|
59
|
-
} = seriesData;
|
|
60
|
-
const {
|
|
61
|
-
xAxis,
|
|
62
|
-
xAxisIds
|
|
63
|
-
} = useXAxes();
|
|
64
|
-
const {
|
|
65
|
-
yAxis,
|
|
66
|
-
yAxisIds
|
|
67
|
-
} = useYAxes();
|
|
68
|
-
const defaultXAxisId = xAxisIds[0];
|
|
69
|
-
const defaultYAxisId = yAxisIds[0];
|
|
70
|
-
const masks = {};
|
|
71
|
-
const data = stackingGroups.flatMap(({
|
|
72
|
-
ids: groupIds
|
|
73
|
-
}, groupIndex) => {
|
|
74
|
-
const xMin = drawingArea.left;
|
|
75
|
-
const xMax = drawingArea.left + drawingArea.width;
|
|
76
|
-
const yMin = drawingArea.top;
|
|
77
|
-
const yMax = drawingArea.top + drawingArea.height;
|
|
78
|
-
return groupIds.flatMap(seriesId => {
|
|
79
|
-
const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
|
|
80
|
-
const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
|
|
81
|
-
const xAxisConfig = xAxis[xAxisId];
|
|
82
|
-
const yAxisConfig = yAxis[yAxisId];
|
|
83
|
-
const verticalLayout = series[seriesId].layout === 'vertical';
|
|
84
|
-
checkScaleErrors(verticalLayout, seriesId, series[seriesId], xAxisId, xAxis, yAxisId, yAxis);
|
|
85
|
-
const baseScaleConfig = verticalLayout ? xAxisConfig : yAxisConfig;
|
|
86
|
-
const xScale = xAxisConfig.scale;
|
|
87
|
-
const yScale = yAxisConfig.scale;
|
|
88
|
-
const colorGetter = getColor(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
89
|
-
const bandWidth = baseScaleConfig.scale.bandwidth();
|
|
90
|
-
const {
|
|
91
|
-
barWidth,
|
|
92
|
-
offset
|
|
93
|
-
} = getBandSize({
|
|
94
|
-
bandWidth,
|
|
95
|
-
numberOfGroups: stackingGroups.length,
|
|
96
|
-
gapRatio: baseScaleConfig.barGapRatio
|
|
97
|
-
});
|
|
98
|
-
const barOffset = groupIndex * (barWidth + offset);
|
|
99
|
-
const {
|
|
100
|
-
stackedData,
|
|
101
|
-
data: currentSeriesData,
|
|
102
|
-
layout
|
|
103
|
-
} = series[seriesId];
|
|
104
|
-
return baseScaleConfig.data.map((baseValue, dataIndex) => {
|
|
105
|
-
if (currentSeriesData[dataIndex] == null) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
const values = stackedData[dataIndex];
|
|
109
|
-
const valueCoordinates = values.map(v => verticalLayout ? yScale(v) : xScale(v));
|
|
110
|
-
const minValueCoord = Math.round(Math.min(...valueCoordinates));
|
|
111
|
-
const maxValueCoord = Math.round(Math.max(...valueCoordinates));
|
|
112
|
-
const stackId = series[seriesId].stack;
|
|
113
|
-
const result = {
|
|
114
|
-
seriesId,
|
|
115
|
-
dataIndex,
|
|
116
|
-
layout,
|
|
117
|
-
x: verticalLayout ? xScale(baseValue) + barOffset : minValueCoord,
|
|
118
|
-
y: verticalLayout ? minValueCoord : yScale(baseValue) + barOffset,
|
|
119
|
-
xOrigin: xScale(0) ?? 0,
|
|
120
|
-
yOrigin: yScale(0) ?? 0,
|
|
121
|
-
height: verticalLayout ? maxValueCoord - minValueCoord : barWidth,
|
|
122
|
-
width: verticalLayout ? barWidth : maxValueCoord - minValueCoord,
|
|
123
|
-
color: colorGetter(dataIndex),
|
|
124
|
-
value: currentSeriesData[dataIndex],
|
|
125
|
-
maskId: `${chartId}_${stackId || seriesId}_${groupIndex}_${dataIndex}`
|
|
126
|
-
};
|
|
127
|
-
if (result.x > xMax || result.x + result.width < xMin || result.y > yMax || result.y + result.height < yMin) {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
if (!masks[result.maskId]) {
|
|
131
|
-
masks[result.maskId] = {
|
|
132
|
-
id: result.maskId,
|
|
133
|
-
width: 0,
|
|
134
|
-
height: 0,
|
|
135
|
-
hasNegative: false,
|
|
136
|
-
hasPositive: false,
|
|
137
|
-
layout: result.layout,
|
|
138
|
-
xOrigin: xScale(0),
|
|
139
|
-
yOrigin: yScale(0),
|
|
140
|
-
x: 0,
|
|
141
|
-
y: 0
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
const mask = masks[result.maskId];
|
|
145
|
-
mask.width = result.layout === 'vertical' ? result.width : mask.width + result.width;
|
|
146
|
-
mask.height = result.layout === 'vertical' ? mask.height + result.height : result.height;
|
|
147
|
-
mask.x = Math.min(mask.x === 0 ? Infinity : mask.x, result.x);
|
|
148
|
-
mask.y = Math.min(mask.y === 0 ? Infinity : mask.y, result.y);
|
|
149
|
-
mask.hasNegative = mask.hasNegative || (result.value ?? 0) < 0;
|
|
150
|
-
mask.hasPositive = mask.hasPositive || (result.value ?? 0) > 0;
|
|
151
|
-
return result;
|
|
152
|
-
}).filter(rectangle => rectangle !== null);
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
return {
|
|
156
|
-
completedData: data,
|
|
157
|
-
masksData: Object.values(masks)
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
19
|
const BarPlotRoot = styled('g', {
|
|
161
20
|
name: 'MuiBarPlot',
|
|
162
21
|
slot: 'Root'
|
|
@@ -178,10 +37,6 @@ const BarPlotRoot = styled('g', {
|
|
|
178
37
|
* - [BarPlot API](https://mui.com/x/api/charts/bar-plot/)
|
|
179
38
|
*/
|
|
180
39
|
function BarPlot(props) {
|
|
181
|
-
const {
|
|
182
|
-
completedData,
|
|
183
|
-
masksData
|
|
184
|
-
} = useAggregatedData();
|
|
185
40
|
const {
|
|
186
41
|
skipAnimation: inSkipAnimation,
|
|
187
42
|
onItemClick,
|
|
@@ -191,8 +46,20 @@ function BarPlot(props) {
|
|
|
191
46
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
192
47
|
const isZoomInteracting = useInternalIsZoomInteracting();
|
|
193
48
|
const skipAnimation = useSkipAnimation(isZoomInteracting || inSkipAnimation);
|
|
49
|
+
const {
|
|
50
|
+
xAxis: xAxes
|
|
51
|
+
} = useXAxes();
|
|
52
|
+
const {
|
|
53
|
+
yAxis: yAxes
|
|
54
|
+
} = useYAxes();
|
|
55
|
+
const {
|
|
56
|
+
completedData,
|
|
57
|
+
masksData
|
|
58
|
+
} = useBarPlotData(useDrawingArea(), xAxes, yAxes);
|
|
194
59
|
const withoutBorderRadius = !borderRadius || borderRadius <= 0;
|
|
60
|
+
const classes = useUtilityClasses();
|
|
195
61
|
return /*#__PURE__*/_jsxs(BarPlotRoot, {
|
|
62
|
+
className: classes.root,
|
|
196
63
|
children: [!withoutBorderRadius && masksData.map(({
|
|
197
64
|
id,
|
|
198
65
|
x,
|
|
@@ -217,45 +84,53 @@ function BarPlot(props) {
|
|
|
217
84
|
}, id);
|
|
218
85
|
}), completedData.map(({
|
|
219
86
|
seriesId,
|
|
220
|
-
|
|
221
|
-
color,
|
|
222
|
-
maskId,
|
|
223
|
-
layout,
|
|
224
|
-
x,
|
|
225
|
-
xOrigin,
|
|
226
|
-
y,
|
|
227
|
-
yOrigin,
|
|
228
|
-
width,
|
|
229
|
-
height
|
|
87
|
+
data
|
|
230
88
|
}) => {
|
|
231
|
-
const barElement = /*#__PURE__*/_jsx(BarElement, _extends({
|
|
232
|
-
id: seriesId,
|
|
233
|
-
dataIndex: dataIndex,
|
|
234
|
-
color: color,
|
|
235
|
-
skipAnimation: skipAnimation ?? false,
|
|
236
|
-
layout: layout ?? 'vertical',
|
|
237
|
-
x: x,
|
|
238
|
-
xOrigin: xOrigin,
|
|
239
|
-
y: y,
|
|
240
|
-
yOrigin: yOrigin,
|
|
241
|
-
width: width,
|
|
242
|
-
height: height
|
|
243
|
-
}, other, {
|
|
244
|
-
onClick: onItemClick && (event => {
|
|
245
|
-
onItemClick(event, {
|
|
246
|
-
type: 'bar',
|
|
247
|
-
seriesId,
|
|
248
|
-
dataIndex
|
|
249
|
-
});
|
|
250
|
-
})
|
|
251
|
-
}), `${seriesId}-${dataIndex}`);
|
|
252
|
-
if (withoutBorderRadius) {
|
|
253
|
-
return barElement;
|
|
254
|
-
}
|
|
255
89
|
return /*#__PURE__*/_jsx("g", {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
90
|
+
"data-series": seriesId,
|
|
91
|
+
className: classes.series,
|
|
92
|
+
children: data.map(({
|
|
93
|
+
dataIndex,
|
|
94
|
+
color,
|
|
95
|
+
maskId,
|
|
96
|
+
layout,
|
|
97
|
+
x,
|
|
98
|
+
xOrigin,
|
|
99
|
+
y,
|
|
100
|
+
yOrigin,
|
|
101
|
+
width,
|
|
102
|
+
height
|
|
103
|
+
}) => {
|
|
104
|
+
const barElement = /*#__PURE__*/_jsx(BarElement, _extends({
|
|
105
|
+
id: seriesId,
|
|
106
|
+
dataIndex: dataIndex,
|
|
107
|
+
color: color,
|
|
108
|
+
skipAnimation: skipAnimation ?? false,
|
|
109
|
+
layout: layout ?? 'vertical',
|
|
110
|
+
x: x,
|
|
111
|
+
xOrigin: xOrigin,
|
|
112
|
+
y: y,
|
|
113
|
+
yOrigin: yOrigin,
|
|
114
|
+
width: width,
|
|
115
|
+
height: height
|
|
116
|
+
}, other, {
|
|
117
|
+
onClick: onItemClick && (event => {
|
|
118
|
+
onItemClick(event, {
|
|
119
|
+
type: 'bar',
|
|
120
|
+
seriesId,
|
|
121
|
+
dataIndex
|
|
122
|
+
});
|
|
123
|
+
})
|
|
124
|
+
}), dataIndex);
|
|
125
|
+
if (withoutBorderRadius) {
|
|
126
|
+
return barElement;
|
|
127
|
+
}
|
|
128
|
+
return /*#__PURE__*/_jsx("g", {
|
|
129
|
+
clipPath: `url(#${maskId})`,
|
|
130
|
+
children: barElement
|
|
131
|
+
}, dataIndex);
|
|
132
|
+
})
|
|
133
|
+
}, seriesId);
|
|
259
134
|
}), barLabel && /*#__PURE__*/_jsx(BarLabelPlot, _extends({
|
|
260
135
|
bars: completedData,
|
|
261
136
|
skipAnimation: skipAnimation,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface BarClasses {
|
|
2
|
+
/** Styles applied to the bar plot element. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** Styles applied to the group surrounding a series' bar elements. */
|
|
5
|
+
series: string;
|
|
6
|
+
/** Styles applied to the group surrounding a series' labels. */
|
|
7
|
+
seriesLabels: string;
|
|
8
|
+
}
|
|
9
|
+
export type BarClassKey = keyof BarClasses;
|
|
10
|
+
export declare function getBarUtilityClass(slot: string): string;
|
|
11
|
+
export declare const barClasses: BarClasses;
|
|
12
|
+
export declare const useUtilityClasses: (classes?: Partial<BarClasses>) => Record<"root" | "series" | "seriesLabels", string>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
3
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
4
|
+
export function getBarUtilityClass(slot) {
|
|
5
|
+
return generateUtilityClass('MuiBar', slot);
|
|
6
|
+
}
|
|
7
|
+
export const barClasses = generateUtilityClasses('MuiBar', ['root', 'series', 'seriesLabels']);
|
|
8
|
+
export const useUtilityClasses = classes => {
|
|
9
|
+
const slots = {
|
|
10
|
+
root: ['root'],
|
|
11
|
+
series: ['series'],
|
|
12
|
+
seriesLabels: ['seriesLabels']
|
|
13
|
+
};
|
|
14
|
+
return composeClasses(slots, getBarUtilityClass, classes);
|
|
15
|
+
};
|
package/esm/BarChart/index.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export * from "./BarChart.js";
|
|
|
2
2
|
export * from "./BarPlot.js";
|
|
3
3
|
export * from "./BarElement.js";
|
|
4
4
|
export * from "./BarLabel/index.js";
|
|
5
|
-
export * from "./barElementClasses.js";
|
|
5
|
+
export * from "./barElementClasses.js";
|
|
6
|
+
export { barClasses, getBarUtilityClass } from "./barClasses.js";
|
|
7
|
+
export type { BarClassKey, BarClasses } from "./barClasses.js";
|
package/esm/BarChart/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export * from "./BarChart.js";
|
|
|
2
2
|
export * from "./BarPlot.js";
|
|
3
3
|
export * from "./BarElement.js";
|
|
4
4
|
export * from "./BarLabel/index.js";
|
|
5
|
-
export * from "./barElementClasses.js";
|
|
5
|
+
export * from "./barElementClasses.js";
|
|
6
|
+
export { barClasses, getBarUtilityClass } from "./barClasses.js";
|
package/esm/BarChart/types.d.ts
CHANGED
|
@@ -9,7 +9,11 @@ export type AnimationData = {
|
|
|
9
9
|
xOrigin: number;
|
|
10
10
|
layout: BarSeriesType['layout'];
|
|
11
11
|
};
|
|
12
|
-
export interface
|
|
12
|
+
export interface ProcessedBarSeriesData {
|
|
13
|
+
seriesId: SeriesId;
|
|
14
|
+
data: ProcessedBarData[];
|
|
15
|
+
}
|
|
16
|
+
export interface ProcessedBarData extends AnimationData {
|
|
13
17
|
seriesId: SeriesId;
|
|
14
18
|
dataIndex: number;
|
|
15
19
|
color: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChartsXAxisProps, ChartsYAxisProps } from "../models/axis.js";
|
|
2
|
+
import { ChartDrawingArea } from "../hooks/index.js";
|
|
3
|
+
import { MaskData, ProcessedBarSeriesData } from "./types.js";
|
|
4
|
+
import { ComputedAxisConfig } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.js";
|
|
5
|
+
export declare function useBarPlotData(drawingArea: ChartDrawingArea, xAxes: ComputedAxisConfig<ChartsXAxisProps>, yAxes: ComputedAxisConfig<ChartsYAxisProps>): {
|
|
6
|
+
completedData: ProcessedBarSeriesData[];
|
|
7
|
+
masksData: MaskData[];
|
|
8
|
+
};
|