@mui/x-charts 7.0.0-beta.0 → 7.0.0-beta.2
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 +2 -1
- package/BarChart/BarChart.js +33 -12
- package/BarChart/BarElement.d.ts +20 -13
- package/BarChart/BarElement.js +7 -3
- package/BarChart/BarPlot.d.ts +11 -6
- package/BarChart/BarPlot.js +28 -15
- package/BarChart/formatter.js +1 -1
- package/CHANGELOG.md +406 -1
- package/ChartContainer/ChartContainer.js +6 -4
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsLegend/ChartsLegend.d.ts +5 -54
- package/ChartsLegend/ChartsLegend.js +2 -307
- package/ChartsLegend/DefaultChartsLegend.d.ts +60 -0
- package/ChartsLegend/DefaultChartsLegend.js +294 -0
- package/ChartsLegend/index.d.ts +1 -0
- package/ChartsLegend/index.js +11 -0
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.d.ts +20 -0
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +83 -0
- package/ChartsOnAxisClickHandler/index.d.ts +1 -0
- package/ChartsOnAxisClickHandler/index.js +16 -0
- package/ChartsOnAxisClickHandler/package.json +6 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/ChartsReferenceLine/common.d.ts +2 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +6 -5
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +7 -5
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/ChartsTooltip/utils.d.ts +4 -1
- package/ChartsTooltip/utils.js +15 -0
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +7 -0
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- package/ChartsXAxis/ChartsXAxis.js +13 -9
- package/ChartsYAxis/ChartsYAxis.js +1 -1
- package/LineChart/AnimatedArea.d.ts +1361 -0
- package/LineChart/AnimatedArea.js +111 -0
- package/LineChart/AnimatedLine.d.ts +1361 -0
- package/LineChart/AnimatedLine.js +113 -0
- package/LineChart/AreaElement.d.ts +19 -18
- package/LineChart/AreaElement.js +17 -34
- package/LineChart/AreaPlot.d.ts +12 -7
- package/LineChart/AreaPlot.js +91 -58
- package/LineChart/LineChart.d.ts +13 -4
- package/LineChart/LineChart.js +45 -14
- package/LineChart/LineElement.d.ts +19 -18
- package/LineChart/LineElement.js +16 -36
- package/LineChart/LineHighlightElement.d.ts +3 -2
- package/LineChart/LineHighlightElement.js +5 -3
- package/LineChart/LinePlot.d.ts +12 -7
- package/LineChart/LinePlot.js +89 -56
- package/LineChart/MarkElement.d.ts +8 -4
- package/LineChart/MarkElement.js +27 -13
- package/LineChart/MarkPlot.d.ts +8 -1
- package/LineChart/MarkPlot.js +80 -51
- package/LineChart/formatter.js +1 -1
- package/LineChart/index.d.ts +2 -0
- package/LineChart/index.js +22 -0
- package/PieChart/PieArc.d.ts +3 -2
- package/PieChart/PieArc.js +1 -0
- package/PieChart/PieArcLabel.d.ts +3 -2
- package/PieChart/PieArcLabel.js +1 -0
- package/PieChart/PieArcLabelPlot.d.ts +1 -1
- package/PieChart/PieArcLabelPlot.js +2 -2
- package/PieChart/PieArcPlot.d.ts +2 -2
- package/PieChart/PieArcPlot.js +7 -7
- package/PieChart/PieChart.d.ts +1 -1
- package/PieChart/PieChart.js +14 -12
- package/PieChart/PiePlot.d.ts +1 -1
- package/PieChart/PiePlot.js +4 -4
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/ScatterChart/Scatter.d.ts +7 -1
- package/ScatterChart/Scatter.js +17 -3
- package/ScatterChart/ScatterChart.d.ts +8 -2
- package/ScatterChart/ScatterChart.js +21 -10
- package/ScatterChart/ScatterPlot.d.ts +1 -1
- package/ScatterChart/ScatterPlot.js +10 -2
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +7 -4
- package/context/CartesianContextProvider.js +8 -6
- package/context/DrawingProvider.d.ts +6 -1
- package/context/DrawingProvider.js +9 -2
- package/context/InteractionProvider.d.ts +3 -3
- package/esm/BarChart/BarChart.js +33 -12
- package/esm/BarChart/BarElement.js +7 -3
- package/esm/BarChart/BarPlot.js +27 -15
- package/esm/BarChart/formatter.js +1 -1
- package/esm/ChartContainer/ChartContainer.js +6 -4
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsLegend/ChartsLegend.js +2 -307
- package/esm/ChartsLegend/DefaultChartsLegend.js +286 -0
- package/esm/ChartsLegend/index.js +1 -0
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +77 -0
- package/esm/ChartsOnAxisClickHandler/index.js +1 -0
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +6 -5
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +8 -5
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/esm/ChartsTooltip/utils.js +12 -0
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- package/esm/ChartsXAxis/ChartsXAxis.js +13 -9
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
- package/esm/LineChart/AnimatedArea.js +103 -0
- package/esm/LineChart/AnimatedLine.js +105 -0
- package/esm/LineChart/AreaElement.js +16 -33
- package/esm/LineChart/AreaPlot.js +92 -59
- package/esm/LineChart/LineChart.js +45 -14
- package/esm/LineChart/LineElement.js +16 -35
- package/esm/LineChart/LineHighlightElement.js +5 -3
- package/esm/LineChart/LinePlot.js +90 -57
- package/esm/LineChart/MarkElement.js +27 -13
- package/esm/LineChart/MarkPlot.js +80 -51
- package/esm/LineChart/formatter.js +1 -1
- package/esm/LineChart/index.js +2 -0
- package/esm/PieChart/PieArc.js +1 -0
- package/esm/PieChart/PieArcLabel.js +1 -0
- package/esm/PieChart/PieArcLabelPlot.js +2 -2
- package/esm/PieChart/PieArcPlot.js +7 -7
- package/esm/PieChart/PieChart.js +14 -12
- package/esm/PieChart/PiePlot.js +4 -4
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/esm/ScatterChart/Scatter.js +17 -3
- package/esm/ScatterChart/ScatterChart.js +21 -10
- package/esm/ScatterChart/ScatterPlot.js +10 -2
- package/esm/SparkLineChart/SparkLineChart.js +7 -4
- package/esm/context/CartesianContextProvider.js +8 -6
- package/esm/context/DrawingProvider.js +9 -2
- package/esm/hooks/useDrawingArea.js +7 -3
- package/esm/index.js +1 -0
- package/esm/internals/geometry.js +1 -1
- package/esm/internals/useAnimatedPath.js +29 -0
- package/esm/internals/utils.js +7 -0
- package/hooks/useDrawingArea.d.ts +2 -0
- package/hooks/useDrawingArea.js +7 -3
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/defaultizeColor.d.ts +16 -16
- package/internals/defaultizeValueFormatter.d.ts +4 -7
- package/internals/geometry.js +1 -1
- package/internals/stackSeries.d.ts +4 -7
- package/internals/useAnimatedPath.d.ts +1 -0
- package/internals/useAnimatedPath.js +38 -0
- package/internals/utils.d.ts +4 -0
- package/internals/utils.js +8 -0
- package/legacy/BarChart/BarChart.js +33 -12
- package/legacy/BarChart/BarElement.js +6 -2
- package/legacy/BarChart/BarPlot.js +28 -14
- package/legacy/BarChart/formatter.js +1 -1
- package/legacy/ChartContainer/ChartContainer.js +6 -4
- package/legacy/ChartsAxis/ChartsAxis.js +4 -4
- package/legacy/ChartsLegend/ChartsLegend.js +2 -323
- package/legacy/ChartsLegend/DefaultChartsLegend.js +302 -0
- package/legacy/ChartsLegend/index.js +1 -0
- package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +75 -0
- package/legacy/ChartsOnAxisClickHandler/index.js +1 -0
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +6 -7
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +8 -5
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/legacy/ChartsTooltip/utils.js +12 -0
- package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +88 -44
- package/legacy/ChartsXAxis/ChartsXAxis.js +12 -8
- package/legacy/ChartsYAxis/ChartsYAxis.js +1 -1
- package/legacy/LineChart/AnimatedArea.js +102 -0
- package/legacy/LineChart/AnimatedLine.js +104 -0
- package/legacy/LineChart/AreaElement.js +15 -35
- package/legacy/LineChart/AreaPlot.js +102 -66
- package/legacy/LineChart/LineChart.js +45 -14
- package/legacy/LineChart/LineElement.js +15 -37
- package/legacy/LineChart/LineHighlightElement.js +5 -3
- package/legacy/LineChart/LinePlot.js +97 -63
- package/legacy/LineChart/MarkElement.js +30 -12
- package/legacy/LineChart/MarkPlot.js +83 -53
- package/legacy/LineChart/formatter.js +1 -1
- package/legacy/LineChart/index.js +2 -0
- package/legacy/PieChart/PieArc.js +1 -0
- package/legacy/PieChart/PieArcLabel.js +1 -0
- package/legacy/PieChart/PieArcLabelPlot.js +2 -2
- package/legacy/PieChart/PieArcPlot.js +7 -7
- package/legacy/PieChart/PieChart.js +14 -12
- package/legacy/PieChart/PiePlot.js +4 -4
- package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/legacy/ScatterChart/Scatter.js +19 -3
- package/legacy/ScatterChart/ScatterChart.js +21 -10
- package/legacy/ScatterChart/ScatterPlot.js +10 -2
- package/legacy/SparkLineChart/SparkLineChart.js +8 -5
- package/legacy/context/CartesianContextProvider.js +8 -6
- package/legacy/context/DrawingProvider.js +11 -2
- package/legacy/hooks/useDrawingArea.js +7 -3
- package/legacy/index.js +2 -1
- package/legacy/internals/geometry.js +1 -1
- package/legacy/internals/useAnimatedPath.js +32 -0
- package/legacy/internals/utils.js +7 -0
- package/models/axis.d.ts +7 -2
- package/models/seriesType/common.d.ts +2 -1
- package/models/seriesType/config.d.ts +7 -12
- package/models/seriesType/line.d.ts +2 -2
- package/models/seriesType/pie.d.ts +7 -3
- package/models/seriesType/scatter.d.ts +5 -2
- package/modern/BarChart/BarChart.js +33 -12
- package/modern/BarChart/BarElement.js +7 -3
- package/modern/BarChart/BarPlot.js +27 -15
- package/modern/BarChart/formatter.js +1 -1
- package/modern/ChartContainer/ChartContainer.js +6 -4
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsLegend/ChartsLegend.js +2 -307
- package/modern/ChartsLegend/DefaultChartsLegend.js +286 -0
- package/modern/ChartsLegend/index.js +1 -0
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +75 -0
- package/modern/ChartsOnAxisClickHandler/index.js +1 -0
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +6 -5
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +7 -5
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/modern/ChartsTooltip/utils.js +12 -0
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- package/modern/ChartsXAxis/ChartsXAxis.js +13 -9
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
- package/modern/LineChart/AnimatedArea.js +103 -0
- package/modern/LineChart/AnimatedLine.js +105 -0
- package/modern/LineChart/AreaElement.js +16 -33
- package/modern/LineChart/AreaPlot.js +91 -58
- package/modern/LineChart/LineChart.js +45 -14
- package/modern/LineChart/LineElement.js +16 -35
- package/modern/LineChart/LineHighlightElement.js +5 -3
- package/modern/LineChart/LinePlot.js +89 -56
- package/modern/LineChart/MarkElement.js +27 -13
- package/modern/LineChart/MarkPlot.js +80 -51
- package/modern/LineChart/formatter.js +1 -1
- package/modern/LineChart/index.js +2 -0
- package/modern/PieChart/PieArc.js +1 -0
- package/modern/PieChart/PieArcLabel.js +1 -0
- package/modern/PieChart/PieArcLabelPlot.js +2 -2
- package/modern/PieChart/PieArcPlot.js +7 -7
- package/modern/PieChart/PieChart.js +14 -12
- package/modern/PieChart/PiePlot.js +4 -4
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/modern/ScatterChart/Scatter.js +17 -3
- package/modern/ScatterChart/ScatterChart.js +21 -10
- package/modern/ScatterChart/ScatterPlot.js +10 -2
- package/modern/SparkLineChart/SparkLineChart.js +7 -4
- package/modern/context/CartesianContextProvider.js +8 -6
- package/modern/context/DrawingProvider.js +9 -2
- package/modern/hooks/useDrawingArea.js +7 -3
- package/modern/index.js +2 -1
- package/modern/internals/geometry.js +1 -1
- package/modern/internals/useAnimatedPath.js +29 -0
- package/modern/internals/utils.js +7 -0
- package/package.json +6 -5
package/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './ChartsTooltip';
|
|
|
13
13
|
export * from './ChartsLegend';
|
|
14
14
|
export * from './ChartsAxisHighlight';
|
|
15
15
|
export * from './ChartsVoronoiHandler';
|
|
16
|
+
export * from './ChartsOnAxisClickHandler';
|
|
16
17
|
export * from './BarChart';
|
|
17
18
|
export * from './LineChart';
|
|
18
19
|
export * from './PieChart';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v7.0.0-beta.
|
|
2
|
+
* @mui/x-charts v7.0.0-beta.2
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -175,6 +175,17 @@ Object.keys(_ChartsVoronoiHandler).forEach(function (key) {
|
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
});
|
|
178
|
+
var _ChartsOnAxisClickHandler = require("./ChartsOnAxisClickHandler");
|
|
179
|
+
Object.keys(_ChartsOnAxisClickHandler).forEach(function (key) {
|
|
180
|
+
if (key === "default" || key === "__esModule") return;
|
|
181
|
+
if (key in exports && exports[key] === _ChartsOnAxisClickHandler[key]) return;
|
|
182
|
+
Object.defineProperty(exports, key, {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: function () {
|
|
185
|
+
return _ChartsOnAxisClickHandler[key];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
});
|
|
178
189
|
var _BarChart = require("./BarChart");
|
|
179
190
|
Object.keys(_BarChart).forEach(function (key) {
|
|
180
191
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -4,7 +4,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
4
4
|
color: string;
|
|
5
5
|
label?: string | undefined;
|
|
6
6
|
value: number;
|
|
7
|
-
id?:
|
|
7
|
+
id?: import("../models/seriesType").PieItemId | undefined;
|
|
8
8
|
}[];
|
|
9
9
|
type: "pie";
|
|
10
10
|
innerRadius?: string | number | undefined;
|
|
@@ -37,7 +37,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
37
37
|
arcLabelRadius?: number | undefined;
|
|
38
38
|
color?: string | undefined;
|
|
39
39
|
} | undefined;
|
|
40
|
-
id?:
|
|
40
|
+
id?: import("../models/seriesType/common").SeriesId | undefined;
|
|
41
41
|
color?: string | undefined;
|
|
42
42
|
valueFormatter?: (<V extends import("../models/helpers").MakeOptional<import("../models/seriesType").PieValueType, "id">>(value: V) => string) | undefined;
|
|
43
43
|
highlightScope?: Partial<import("..").HighlightScope> | undefined;
|
|
@@ -48,7 +48,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
48
48
|
label?: string | undefined;
|
|
49
49
|
layout?: "horizontal" | "vertical" | undefined;
|
|
50
50
|
stackOffset?: import("..").StackOffsetType | undefined;
|
|
51
|
-
id?:
|
|
51
|
+
id?: import("../models/seriesType/common").SeriesId | undefined;
|
|
52
52
|
color: string;
|
|
53
53
|
valueFormatter?: (<V_1 extends number | null>(value: V_1) => string) | undefined;
|
|
54
54
|
highlightScope?: Partial<import("..").HighlightScope> | undefined;
|
|
@@ -56,6 +56,18 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
56
56
|
yAxisKey?: string | undefined;
|
|
57
57
|
stack?: string | undefined;
|
|
58
58
|
stackOrder?: import("..").StackOrderType | undefined;
|
|
59
|
+
} | {
|
|
60
|
+
type: "scatter";
|
|
61
|
+
data: import("../models/seriesType").ScatterValueType[];
|
|
62
|
+
markerSize?: number | undefined;
|
|
63
|
+
label?: string | undefined;
|
|
64
|
+
disableHover?: boolean | undefined;
|
|
65
|
+
id?: import("../models/seriesType/common").SeriesId | undefined;
|
|
66
|
+
color: string;
|
|
67
|
+
valueFormatter?: (<V_2 extends import("../models/seriesType").ScatterValueType>(value: V_2) => string) | undefined;
|
|
68
|
+
highlightScope?: Partial<import("..").HighlightScope> | undefined;
|
|
69
|
+
xAxisKey?: string | undefined;
|
|
70
|
+
yAxisKey?: string | undefined;
|
|
59
71
|
} | {
|
|
60
72
|
type: "line";
|
|
61
73
|
data?: (number | null)[] | undefined;
|
|
@@ -68,23 +80,11 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
68
80
|
disableHighlight?: boolean | undefined;
|
|
69
81
|
connectNulls?: boolean | undefined;
|
|
70
82
|
stackOffset?: import("..").StackOffsetType | undefined;
|
|
71
|
-
id?:
|
|
83
|
+
id?: import("../models/seriesType/common").SeriesId | undefined;
|
|
72
84
|
color: string;
|
|
73
85
|
valueFormatter?: (<V_1 extends number | null>(value: V_1) => string) | undefined;
|
|
74
86
|
highlightScope?: Partial<import("..").HighlightScope> | undefined;
|
|
75
87
|
xAxisKey?: string | undefined;
|
|
76
88
|
yAxisKey?: string | undefined;
|
|
77
89
|
stackOrder?: import("..").StackOrderType | undefined;
|
|
78
|
-
} | {
|
|
79
|
-
type: "scatter";
|
|
80
|
-
data: import("../models/seriesType").ScatterValueType[];
|
|
81
|
-
markerSize?: number | undefined;
|
|
82
|
-
label?: string | undefined;
|
|
83
|
-
disableHover?: boolean | undefined;
|
|
84
|
-
id?: string | undefined;
|
|
85
|
-
color: string;
|
|
86
|
-
valueFormatter?: (<V_2 extends import("../models/seriesType").ScatterValueType>(value: V_2) => string) | undefined;
|
|
87
|
-
highlightScope?: Partial<import("..").HighlightScope> | undefined;
|
|
88
|
-
xAxisKey?: string | undefined;
|
|
89
|
-
yAxisKey?: string | undefined;
|
|
90
90
|
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
+
import { SeriesId } from '../models/seriesType/common';
|
|
1
2
|
declare function defaultizeValueFormatter<ISeries extends {
|
|
2
3
|
valueFormatter?: IFormatter;
|
|
3
|
-
}, IFormatter extends (v: any) => string>(series: {
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
[id: string]: ISeries & {
|
|
7
|
-
valueFormatter: IFormatter;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
4
|
+
}, IFormatter extends (v: any) => string>(series: Record<SeriesId, ISeries>, defaultValueFormatter: IFormatter): Record<SeriesId, ISeries & {
|
|
5
|
+
valueFormatter: IFormatter;
|
|
6
|
+
}>;
|
|
10
7
|
export default defaultizeValueFormatter;
|
package/internals/geometry.js
CHANGED
|
@@ -20,7 +20,7 @@ function getMinXTranslation(width, height, angle = 0) {
|
|
|
20
20
|
if (process.env.NODE_ENV !== 'production') {
|
|
21
21
|
if (!warnedOnce && angle > 90 && angle < -90) {
|
|
22
22
|
warnedOnce = true;
|
|
23
|
-
console.warn([`MUI X: It seems you applied an angle larger than 90° or smaller than -90° to an axis text.`, `This could cause some text overlapping.`, `If you encounter a use case where it's needed, please open an issue.`].join('\n'));
|
|
23
|
+
console.warn([`MUI X Charts: It seems you applied an angle larger than 90° or smaller than -90° to an axis text.`, `This could cause some text overlapping.`, `If you encounter a use case where it's needed, please open an issue.`].join('\n'));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
const standardAngle = Math.min(Math.abs(angle) % 180, Math.abs(Math.abs(angle) % 180 - 180) % 180); // Map from R to [0, 90]
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { Series } from 'd3-shape';
|
|
2
2
|
import type { BarSeriesType, LineSeriesType } from '../models/seriesType';
|
|
3
3
|
import type { StackOffsetType, StackOrderType } from '../models/stacking';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} | {
|
|
7
|
-
[id: string]: LineSeriesType;
|
|
8
|
-
};
|
|
4
|
+
import { SeriesId } from '../models/seriesType/common';
|
|
5
|
+
type StackableSeries = Record<SeriesId, BarSeriesType> | Record<SeriesId, LineSeriesType>;
|
|
9
6
|
type FormatterParams = {
|
|
10
7
|
series: StackableSeries;
|
|
11
|
-
seriesOrder:
|
|
8
|
+
seriesOrder: SeriesId[];
|
|
12
9
|
defaultStrategy?: {
|
|
13
10
|
stackOrder?: StackOrderType;
|
|
14
11
|
stackOffset?: StackOffsetType;
|
|
15
12
|
};
|
|
16
13
|
};
|
|
17
14
|
export type StackingGroupsType = {
|
|
18
|
-
ids:
|
|
15
|
+
ids: SeriesId[];
|
|
19
16
|
stackingOrder: (series: Series<any, any>) => number[];
|
|
20
17
|
stackingOffset: (series: Series<any, any>, order: Iterable<number>) => void;
|
|
21
18
|
}[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useAnimatedPath: (path: string, skipAnimation?: boolean) => import("@react-spring/core").Interpolation<string, any>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAnimatedPath = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _d3Interpolate = require("d3-interpolate");
|
|
9
|
+
var _web = require("@react-spring/web");
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function usePrevious(value) {
|
|
13
|
+
const ref = React.useRef(null);
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
ref.current = value;
|
|
16
|
+
}, [value]);
|
|
17
|
+
return ref.current;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Taken from Nivo
|
|
21
|
+
const useAnimatedPath = (path, skipAnimation) => {
|
|
22
|
+
const previousPath = usePrevious(path);
|
|
23
|
+
const interpolator = React.useMemo(() => previousPath ? (0, _d3Interpolate.interpolateString)(previousPath, path) : () => path, [previousPath, path]);
|
|
24
|
+
const {
|
|
25
|
+
value
|
|
26
|
+
} = (0, _web.useSpring)({
|
|
27
|
+
from: {
|
|
28
|
+
value: 0
|
|
29
|
+
},
|
|
30
|
+
to: {
|
|
31
|
+
value: 1
|
|
32
|
+
},
|
|
33
|
+
reset: true,
|
|
34
|
+
immediate: skipAnimation
|
|
35
|
+
});
|
|
36
|
+
return (0, _web.to)([value], interpolator);
|
|
37
|
+
};
|
|
38
|
+
exports.useAnimatedPath = useAnimatedPath;
|
package/internals/utils.d.ts
CHANGED
|
@@ -17,4 +17,8 @@ export declare function getSVGPoint(svg: SVGSVGElement, event: MouseEvent): DOMP
|
|
|
17
17
|
* @returns The numerical value associated to the provided value.
|
|
18
18
|
*/
|
|
19
19
|
export declare function getPercentageValue(value: number | string, refValue: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* Remove spaces to have viable ids
|
|
22
|
+
*/
|
|
23
|
+
export declare function cleanId(id: string): string;
|
|
20
24
|
export {};
|
package/internals/utils.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.cleanId = cleanId;
|
|
6
7
|
exports.getPercentageValue = getPercentageValue;
|
|
7
8
|
exports.getSVGPoint = getSVGPoint;
|
|
8
9
|
exports.getSymbol = getSymbol;
|
|
@@ -50,4 +51,11 @@ function getPercentageValue(value, refValue) {
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
throw Error(`MUI-Charts: Received an unknown value "${value}". It should be a number, or a string with a percentage value.`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Remove spaces to have viable ids
|
|
58
|
+
*/
|
|
59
|
+
function cleanId(id) {
|
|
60
|
+
return id.replace(' ', '_');
|
|
53
61
|
}
|
|
@@ -11,6 +11,7 @@ import { ChartsTooltip } from '../ChartsTooltip';
|
|
|
11
11
|
import { ChartsLegend } from '../ChartsLegend';
|
|
12
12
|
import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
13
13
|
import { ChartsClipPath } from '../ChartsClipPath';
|
|
14
|
+
import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
/**
|
|
@@ -43,6 +44,8 @@ var BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
43
44
|
rightAxis = props.rightAxis,
|
|
44
45
|
bottomAxis = props.bottomAxis,
|
|
45
46
|
skipAnimation = props.skipAnimation,
|
|
47
|
+
onItemClick = props.onItemClick,
|
|
48
|
+
onAxisClick = props.onAxisClick,
|
|
46
49
|
children = props.children,
|
|
47
50
|
slots = props.slots,
|
|
48
51
|
slotProps = props.slotProps;
|
|
@@ -88,13 +91,16 @@ var BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
88
91
|
colors: colors,
|
|
89
92
|
dataset: dataset,
|
|
90
93
|
sx: sx,
|
|
91
|
-
disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none',
|
|
92
|
-
children: [/*#__PURE__*/_jsx(
|
|
94
|
+
disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none' && !onAxisClick,
|
|
95
|
+
children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
|
|
96
|
+
onAxisClick: onAxisClick
|
|
97
|
+
}), /*#__PURE__*/_jsx("g", {
|
|
93
98
|
clipPath: "url(#".concat(clipPathId, ")"),
|
|
94
99
|
children: /*#__PURE__*/_jsx(BarPlot, {
|
|
95
100
|
slots: slots,
|
|
96
101
|
slotProps: slotProps,
|
|
97
|
-
skipAnimation: skipAnimation
|
|
102
|
+
skipAnimation: skipAnimation,
|
|
103
|
+
onItemClick: onItemClick
|
|
98
104
|
})
|
|
99
105
|
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
100
106
|
topAxis: topAxis,
|
|
@@ -136,7 +142,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
136
142
|
* @default xAxisIds[0] The id of the first provided axis
|
|
137
143
|
*/
|
|
138
144
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
139
|
-
axisId: PropTypes.string,
|
|
145
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
140
146
|
classes: PropTypes.object,
|
|
141
147
|
disableLine: PropTypes.bool,
|
|
142
148
|
disableTicks: PropTypes.bool,
|
|
@@ -187,7 +193,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
187
193
|
* @default yAxisIds[0] The id of the first provided axis
|
|
188
194
|
*/
|
|
189
195
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
190
|
-
axisId: PropTypes.string,
|
|
196
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
191
197
|
classes: PropTypes.object,
|
|
192
198
|
disableLine: PropTypes.bool,
|
|
193
199
|
disableTicks: PropTypes.bool,
|
|
@@ -234,13 +240,26 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
234
240
|
right: PropTypes.number,
|
|
235
241
|
top: PropTypes.number
|
|
236
242
|
}),
|
|
243
|
+
/**
|
|
244
|
+
* The function called for onClick events.
|
|
245
|
+
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
246
|
+
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
|
|
247
|
+
* @param {null | AxisData} data The data about the clicked axis and items associated with it.
|
|
248
|
+
*/
|
|
249
|
+
onAxisClick: PropTypes.func,
|
|
250
|
+
/**
|
|
251
|
+
* Callback fired when a bar item is clicked.
|
|
252
|
+
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
253
|
+
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
254
|
+
*/
|
|
255
|
+
onItemClick: PropTypes.func,
|
|
237
256
|
/**
|
|
238
257
|
* Indicate which axis to display the right of the charts.
|
|
239
258
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
240
259
|
* @default null
|
|
241
260
|
*/
|
|
242
261
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
243
|
-
axisId: PropTypes.string,
|
|
262
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
244
263
|
classes: PropTypes.object,
|
|
245
264
|
disableLine: PropTypes.bool,
|
|
246
265
|
disableTicks: PropTypes.bool,
|
|
@@ -263,7 +282,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
263
282
|
}), PropTypes.string]),
|
|
264
283
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
265
284
|
/**
|
|
266
|
-
* If `true`, animations are
|
|
285
|
+
* If `true`, animations are skipped.
|
|
267
286
|
* @default false
|
|
268
287
|
*/
|
|
269
288
|
skipAnimation: PropTypes.bool,
|
|
@@ -293,7 +312,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
293
312
|
* @default null
|
|
294
313
|
*/
|
|
295
314
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
296
|
-
axisId: PropTypes.string,
|
|
315
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
297
316
|
classes: PropTypes.object,
|
|
298
317
|
disableLine: PropTypes.bool,
|
|
299
318
|
disableTicks: PropTypes.bool,
|
|
@@ -330,7 +349,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
330
349
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
331
350
|
*/
|
|
332
351
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
333
|
-
axisId: PropTypes.string,
|
|
352
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
334
353
|
classes: PropTypes.object,
|
|
335
354
|
data: PropTypes.array,
|
|
336
355
|
dataKey: PropTypes.string,
|
|
@@ -338,13 +357,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
338
357
|
disableTicks: PropTypes.bool,
|
|
339
358
|
fill: PropTypes.string,
|
|
340
359
|
hideTooltip: PropTypes.bool,
|
|
341
|
-
id: PropTypes.string,
|
|
360
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
342
361
|
label: PropTypes.string,
|
|
343
362
|
labelFontSize: PropTypes.number,
|
|
344
363
|
labelStyle: PropTypes.object,
|
|
345
364
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
346
365
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
347
366
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
367
|
+
reverse: PropTypes.bool,
|
|
348
368
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
349
369
|
slotProps: PropTypes.object,
|
|
350
370
|
slots: PropTypes.object,
|
|
@@ -364,7 +384,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
364
384
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
365
385
|
*/
|
|
366
386
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
367
|
-
axisId: PropTypes.string,
|
|
387
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
368
388
|
classes: PropTypes.object,
|
|
369
389
|
data: PropTypes.array,
|
|
370
390
|
dataKey: PropTypes.string,
|
|
@@ -372,13 +392,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
372
392
|
disableTicks: PropTypes.bool,
|
|
373
393
|
fill: PropTypes.string,
|
|
374
394
|
hideTooltip: PropTypes.bool,
|
|
375
|
-
id: PropTypes.string,
|
|
395
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
376
396
|
label: PropTypes.string,
|
|
377
397
|
labelFontSize: PropTypes.number,
|
|
378
398
|
labelStyle: PropTypes.object,
|
|
379
399
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
380
400
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
381
401
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
402
|
+
reverse: PropTypes.bool,
|
|
382
403
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
383
404
|
slotProps: PropTypes.object,
|
|
384
405
|
slots: PropTypes.object,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "slots", "slotProps", "style"];
|
|
3
|
+
var _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "slots", "slotProps", "style", "onClick"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
@@ -51,6 +51,7 @@ function BarElement(props) {
|
|
|
51
51
|
slots = props.slots,
|
|
52
52
|
slotProps = props.slotProps,
|
|
53
53
|
style = props.style,
|
|
54
|
+
onClick = props.onClick,
|
|
54
55
|
other = _objectWithoutProperties(props, _excluded);
|
|
55
56
|
var getInteractionItemProps = useInteractionItemProps(highlightScope);
|
|
56
57
|
var _React$useContext = React.useContext(InteractionContext),
|
|
@@ -84,7 +85,9 @@ function BarElement(props) {
|
|
|
84
85
|
dataIndex: dataIndex
|
|
85
86
|
}), {
|
|
86
87
|
style: style,
|
|
87
|
-
className: classes.root
|
|
88
|
+
className: classes.root,
|
|
89
|
+
onClick: onClick,
|
|
90
|
+
cursor: onClick ? 'pointer' : 'unset'
|
|
88
91
|
}),
|
|
89
92
|
ownerState: ownerState
|
|
90
93
|
});
|
|
@@ -101,6 +104,7 @@ process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
|
|
|
101
104
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
102
105
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
103
106
|
}),
|
|
107
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
104
108
|
/**
|
|
105
109
|
* The props used for each component slot.
|
|
106
110
|
* @default {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
-
var _excluded = ["skipAnimation"];
|
|
4
|
+
var _excluded = ["skipAnimation", "onItemClick"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { useTransition } from '@react-spring/web';
|
|
@@ -10,7 +10,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
10
10
|
import { BarElement } from './BarElement';
|
|
11
11
|
import { isBandScaleConfig } from '../models/axis';
|
|
12
12
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
13
|
-
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
/**
|
|
15
15
|
* Solution of the equations
|
|
16
16
|
* W = barWidth * N + offset * (N-1)
|
|
@@ -20,7 +20,6 @@ import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
|
20
20
|
* @param gapRatio The ratio of the gap between bars over the bar width.
|
|
21
21
|
* @returns The bar width and the offset between bars.
|
|
22
22
|
*/
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
23
|
function getBandSize(_ref) {
|
|
25
24
|
var W = _ref.bandWidth,
|
|
26
25
|
N = _ref.numberOfGroups,
|
|
@@ -38,7 +37,7 @@ function getBandSize(_ref) {
|
|
|
38
37
|
offset: offset
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
|
-
var
|
|
40
|
+
var useAggregatedData = function useAggregatedData() {
|
|
42
41
|
var _React$useContext$bar;
|
|
43
42
|
var seriesData = (_React$useContext$bar = React.useContext(SeriesContext).bar) != null ? _React$useContext$bar : {
|
|
44
43
|
series: {},
|
|
@@ -97,20 +96,21 @@ var useCompletedData = function useCompletedData() {
|
|
|
97
96
|
color = _series$seriesId.color;
|
|
98
97
|
return stackedData.map(function (values, dataIndex) {
|
|
99
98
|
var _xAxis$xAxisKey$data, _yAxis$yAxisKey$data;
|
|
100
|
-
var
|
|
101
|
-
|
|
99
|
+
var valueCoordinates = values.map(function (v) {
|
|
100
|
+
return verticalLayout ? yScale(v) : xScale(v);
|
|
101
|
+
});
|
|
102
|
+
var minValueCoord = Math.min.apply(Math, _toConsumableArray(valueCoordinates));
|
|
103
|
+
var maxValueCoord = Math.max.apply(Math, _toConsumableArray(valueCoordinates));
|
|
102
104
|
return {
|
|
103
|
-
bottom: bottom,
|
|
104
|
-
top: top,
|
|
105
105
|
seriesId: seriesId,
|
|
106
106
|
dataIndex: dataIndex,
|
|
107
107
|
layout: series[seriesId].layout,
|
|
108
|
-
x: verticalLayout ? xScale((_xAxis$xAxisKey$data = xAxis[xAxisKey].data) == null ? void 0 : _xAxis$xAxisKey$data[dataIndex]) + barOffset :
|
|
109
|
-
y: verticalLayout ?
|
|
108
|
+
x: verticalLayout ? xScale((_xAxis$xAxisKey$data = xAxis[xAxisKey].data) == null ? void 0 : _xAxis$xAxisKey$data[dataIndex]) + barOffset : minValueCoord,
|
|
109
|
+
y: verticalLayout ? minValueCoord : yScale((_yAxis$yAxisKey$data = yAxis[yAxisKey].data) == null ? void 0 : _yAxis$yAxisKey$data[dataIndex]) + barOffset,
|
|
110
110
|
xOrigin: xScale(0),
|
|
111
111
|
yOrigin: yScale(0),
|
|
112
|
-
height: verticalLayout ?
|
|
113
|
-
width: verticalLayout ? barWidth :
|
|
112
|
+
height: verticalLayout ? maxValueCoord - minValueCoord : barWidth,
|
|
113
|
+
width: verticalLayout ? barWidth : maxValueCoord - minValueCoord,
|
|
114
114
|
color: color,
|
|
115
115
|
highlightScope: series[seriesId].highlightScope
|
|
116
116
|
};
|
|
@@ -164,8 +164,9 @@ var getInStyle = function getInStyle(_ref4) {
|
|
|
164
164
|
* - [BarPlot API](https://mui.com/x/api/charts/bar-plot/)
|
|
165
165
|
*/
|
|
166
166
|
function BarPlot(props) {
|
|
167
|
-
var completedData =
|
|
167
|
+
var completedData = useAggregatedData();
|
|
168
168
|
var skipAnimation = props.skipAnimation,
|
|
169
|
+
onItemClick = props.onItemClick,
|
|
169
170
|
other = _objectWithoutProperties(props, _excluded);
|
|
170
171
|
var transition = useTransition(completedData, {
|
|
171
172
|
keys: function keys(bar) {
|
|
@@ -189,6 +190,13 @@ function BarPlot(props) {
|
|
|
189
190
|
highlightScope: highlightScope,
|
|
190
191
|
color: color
|
|
191
192
|
}, other, {
|
|
193
|
+
onClick: onItemClick && function (event) {
|
|
194
|
+
onItemClick(event, {
|
|
195
|
+
type: 'bar',
|
|
196
|
+
seriesId: seriesId,
|
|
197
|
+
dataIndex: dataIndex
|
|
198
|
+
});
|
|
199
|
+
},
|
|
192
200
|
style: style
|
|
193
201
|
}));
|
|
194
202
|
})
|
|
@@ -200,7 +208,13 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
|
|
|
200
208
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
201
209
|
// ----------------------------------------------------------------------
|
|
202
210
|
/**
|
|
203
|
-
*
|
|
211
|
+
* Callback fired when a bar item is clicked.
|
|
212
|
+
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
213
|
+
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
214
|
+
*/
|
|
215
|
+
onItemClick: PropTypes.func,
|
|
216
|
+
/**
|
|
217
|
+
* If `true`, animations are skipped.
|
|
204
218
|
* @default false
|
|
205
219
|
*/
|
|
206
220
|
skipAnimation: PropTypes.bool,
|
|
@@ -71,7 +71,7 @@ var formatter = function formatter(params, dataset) {
|
|
|
71
71
|
seriesOrder: seriesOrder,
|
|
72
72
|
stackingGroups: stackingGroups,
|
|
73
73
|
series: defaultizeValueFormatter(completedSeries, function (v) {
|
|
74
|
-
return v
|
|
74
|
+
return v == null ? '' : v.toLocaleString();
|
|
75
75
|
})
|
|
76
76
|
};
|
|
77
77
|
};
|
|
@@ -120,7 +120,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
120
120
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
121
121
|
*/
|
|
122
122
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
123
|
-
axisId: PropTypes.string,
|
|
123
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
124
124
|
classes: PropTypes.object,
|
|
125
125
|
data: PropTypes.array,
|
|
126
126
|
dataKey: PropTypes.string,
|
|
@@ -128,13 +128,14 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
128
128
|
disableTicks: PropTypes.bool,
|
|
129
129
|
fill: PropTypes.string,
|
|
130
130
|
hideTooltip: PropTypes.bool,
|
|
131
|
-
id: PropTypes.string,
|
|
131
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
132
132
|
label: PropTypes.string,
|
|
133
133
|
labelFontSize: PropTypes.number,
|
|
134
134
|
labelStyle: PropTypes.object,
|
|
135
135
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
136
136
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
137
137
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
138
|
+
reverse: PropTypes.bool,
|
|
138
139
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
139
140
|
slotProps: PropTypes.object,
|
|
140
141
|
slots: PropTypes.object,
|
|
@@ -154,7 +155,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
154
155
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
155
156
|
*/
|
|
156
157
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
157
|
-
axisId: PropTypes.string,
|
|
158
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
158
159
|
classes: PropTypes.object,
|
|
159
160
|
data: PropTypes.array,
|
|
160
161
|
dataKey: PropTypes.string,
|
|
@@ -162,13 +163,14 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
162
163
|
disableTicks: PropTypes.bool,
|
|
163
164
|
fill: PropTypes.string,
|
|
164
165
|
hideTooltip: PropTypes.bool,
|
|
165
|
-
id: PropTypes.string,
|
|
166
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
166
167
|
label: PropTypes.string,
|
|
167
168
|
labelFontSize: PropTypes.number,
|
|
168
169
|
labelStyle: PropTypes.object,
|
|
169
170
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
170
171
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
171
172
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
173
|
+
reverse: PropTypes.bool,
|
|
172
174
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
173
175
|
slotProps: PropTypes.object,
|
|
174
176
|
slots: PropTypes.object,
|
|
@@ -99,7 +99,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
99
99
|
* @default xAxisIds[0] The id of the first provided axis
|
|
100
100
|
*/
|
|
101
101
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
102
|
-
axisId: PropTypes.string,
|
|
102
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
103
103
|
classes: PropTypes.object,
|
|
104
104
|
disableLine: PropTypes.bool,
|
|
105
105
|
disableTicks: PropTypes.bool,
|
|
@@ -126,7 +126,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
126
126
|
* @default yAxisIds[0] The id of the first provided axis
|
|
127
127
|
*/
|
|
128
128
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
129
|
-
axisId: PropTypes.string,
|
|
129
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
130
130
|
classes: PropTypes.object,
|
|
131
131
|
disableLine: PropTypes.bool,
|
|
132
132
|
disableTicks: PropTypes.bool,
|
|
@@ -153,7 +153,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
153
153
|
* @default null
|
|
154
154
|
*/
|
|
155
155
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
156
|
-
axisId: PropTypes.string,
|
|
156
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
157
157
|
classes: PropTypes.object,
|
|
158
158
|
disableLine: PropTypes.bool,
|
|
159
159
|
disableTicks: PropTypes.bool,
|
|
@@ -190,7 +190,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
190
190
|
* @default null
|
|
191
191
|
*/
|
|
192
192
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
193
|
-
axisId: PropTypes.string,
|
|
193
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
194
194
|
classes: PropTypes.object,
|
|
195
195
|
disableLine: PropTypes.bool,
|
|
196
196
|
disableTicks: PropTypes.bool,
|