@mui/x-charts 7.7.0 → 7.8.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.js +21 -104
- package/BarChart/BarElement.d.ts +225 -228
- package/BarChart/BarLabel/BarLabel.d.ts +225 -228
- package/BarChart/BarLabel/BarLabelPlot.d.ts +0 -3
- package/BarChart/BarLabel/BarLabelPlot.js +1 -24
- package/BarChart/BarLabel/getBarLabel.d.ts +1 -1
- package/BarChart/BarPlot.js +2 -2
- package/BarChart/checkScaleErrors.d.ts +5 -9
- package/BarChart/types.d.ts +2 -2
- package/BarChart/useBarChartProps.d.ts +34 -0
- package/BarChart/useBarChartProps.js +143 -0
- package/CHANGELOG.md +181 -0
- package/ChartContainer/ChartContainer.d.ts +2 -2
- package/ChartContainer/ChartContainer.js +6 -10
- package/ChartContainer/useChartContainerHooks.d.ts +11 -0
- package/ChartContainer/useChartContainerHooks.js +34 -0
- package/ChartContainer/usePluginsMerge.d.ts +1 -2
- package/ChartsAxis/ChartsAxis.js +2 -2
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +21 -6
- package/ChartsGrid/ChartsGrid.js +2 -2
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/ChartsReferenceLine/common.d.ts +0 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsTooltipTable.d.ts +0 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +4 -4
- package/ChartsXAxis/ChartsXAxis.js +2 -2
- package/ChartsYAxis/ChartsYAxis.js +5 -3
- package/Gauge/GaugeProvider.d.ts +1 -1
- package/LineChart/AnimatedArea.d.ts +225 -228
- package/LineChart/AnimatedLine.d.ts +225 -228
- package/LineChart/AreaPlot.js +2 -2
- package/LineChart/LineChart.js +24 -106
- package/LineChart/LineHighlightPlot.js +2 -2
- package/LineChart/LinePlot.js +2 -2
- package/LineChart/MarkPlot.js +2 -2
- package/LineChart/useLineChartProps.d.ts +40 -0
- package/LineChart/useLineChartProps.js +152 -0
- package/PieChart/PieArc.d.ts +0 -1
- package/PieChart/PieArcLabel.d.ts +0 -1
- package/PieChart/dataTransform/transition.d.ts +0 -1
- package/ResponsiveChartContainer/ResizableContainer.d.ts +1 -2
- package/ScatterChart/ScatterChart.js +20 -75
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/useScatterChartProps.d.ts +31 -0
- package/ScatterChart/useScatterChartProps.js +116 -0
- package/context/CartesianProvider/CartesianContext.d.ts +25 -0
- package/context/CartesianProvider/CartesianContext.js +21 -0
- package/context/CartesianProvider/CartesianProvider.d.ts +34 -0
- package/context/CartesianProvider/CartesianProvider.js +44 -0
- package/context/CartesianProvider/computeValue.d.ts +19 -0
- package/context/CartesianProvider/computeValue.js +104 -0
- package/context/CartesianProvider/getAxisExtremum.d.ts +4 -0
- package/context/CartesianProvider/getAxisExtremum.js +28 -0
- package/context/CartesianProvider/index.d.ts +9 -0
- package/context/CartesianProvider/index.js +51 -0
- package/context/CartesianProvider/normalizeAxis.d.ts +5 -0
- package/context/CartesianProvider/normalizeAxis.js +23 -0
- package/context/CartesianProvider/useCartesianContext.d.ts +2 -0
- package/context/CartesianProvider/useCartesianContext.js +17 -0
- package/context/ColorProvider.d.ts +2 -2
- package/esm/BarChart/BarChart.js +21 -104
- package/esm/BarChart/BarLabel/BarLabelPlot.js +0 -23
- package/esm/BarChart/BarPlot.js +2 -2
- package/esm/BarChart/useBarChartProps.js +135 -0
- package/esm/ChartContainer/ChartContainer.js +5 -9
- package/esm/ChartContainer/useChartContainerHooks.js +24 -0
- package/esm/ChartsAxis/ChartsAxis.js +2 -2
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +21 -6
- package/esm/ChartsGrid/ChartsGrid.js +2 -2
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +5 -3
- package/esm/LineChart/AreaPlot.js +2 -2
- package/esm/LineChart/LineChart.js +24 -106
- package/esm/LineChart/LineHighlightPlot.js +2 -2
- package/esm/LineChart/LinePlot.js +2 -2
- package/esm/LineChart/MarkPlot.js +2 -2
- package/esm/LineChart/useLineChartProps.js +144 -0
- package/esm/ScatterChart/ScatterChart.js +20 -75
- package/esm/ScatterChart/ScatterPlot.js +2 -2
- package/esm/ScatterChart/useScatterChartProps.js +108 -0
- package/esm/context/CartesianProvider/CartesianContext.js +13 -0
- package/esm/context/CartesianProvider/CartesianProvider.js +37 -0
- package/esm/context/CartesianProvider/computeValue.js +97 -0
- package/esm/context/CartesianProvider/getAxisExtremum.js +21 -0
- package/esm/context/CartesianProvider/index.js +10 -0
- package/esm/context/CartesianProvider/normalizeAxis.js +15 -0
- package/esm/context/CartesianProvider/useCartesianContext.js +8 -0
- package/esm/hooks/useAxisEvents.js +7 -10
- package/esm/hooks/useColorScale.js +3 -3
- package/esm/hooks/useScale.js +4 -5
- package/esm/hooks/useTicks.js +2 -1
- package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/esm/internals/getSVGPoint.js +11 -0
- package/esm/internals/index.js +8 -2
- package/esm/internals/utils.js +0 -12
- package/hooks/useAxisEvents.js +8 -11
- package/hooks/useChartDimensions.d.ts +1 -1
- package/hooks/useColor.d.ts +1 -1
- package/hooks/useColorScale.js +3 -3
- package/hooks/useDrawingArea.d.ts +2 -8
- package/hooks/useScale.js +4 -7
- package/hooks/useTicks.js +2 -1
- package/index.js +1 -1
- package/internals/components/AxisSharedComponents.d.ts +0 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +2 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/internals/defaultizeColor.d.ts +68 -68
- package/internals/getSVGPoint.d.ts +6 -0
- package/internals/getSVGPoint.js +17 -0
- package/internals/getWordsByLines.d.ts +0 -1
- package/internals/index.d.ts +9 -1
- package/internals/index.js +69 -5
- package/internals/useAnimatedPath.d.ts +0 -1
- package/internals/utils.d.ts +0 -6
- package/internals/utils.js +0 -13
- package/models/axis.d.ts +1 -2
- package/models/plugin.d.ts +4 -1
- package/modern/BarChart/BarChart.js +21 -104
- package/modern/BarChart/BarLabel/BarLabelPlot.js +0 -23
- package/modern/BarChart/BarPlot.js +2 -2
- package/modern/BarChart/useBarChartProps.js +135 -0
- package/modern/ChartContainer/ChartContainer.js +5 -9
- package/modern/ChartContainer/useChartContainerHooks.js +24 -0
- package/modern/ChartsAxis/ChartsAxis.js +2 -2
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +21 -6
- package/modern/ChartsGrid/ChartsGrid.js +2 -2
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +5 -3
- package/modern/LineChart/AreaPlot.js +2 -2
- package/modern/LineChart/LineChart.js +24 -106
- package/modern/LineChart/LineHighlightPlot.js +2 -2
- package/modern/LineChart/LinePlot.js +2 -2
- package/modern/LineChart/MarkPlot.js +2 -2
- package/modern/LineChart/useLineChartProps.js +144 -0
- package/modern/ScatterChart/ScatterChart.js +20 -75
- package/modern/ScatterChart/ScatterPlot.js +2 -2
- package/modern/ScatterChart/useScatterChartProps.js +108 -0
- package/modern/context/CartesianProvider/CartesianContext.js +13 -0
- package/modern/context/CartesianProvider/CartesianProvider.js +37 -0
- package/modern/context/CartesianProvider/computeValue.js +97 -0
- package/modern/context/CartesianProvider/getAxisExtremum.js +21 -0
- package/modern/context/CartesianProvider/index.js +10 -0
- package/modern/context/CartesianProvider/normalizeAxis.js +15 -0
- package/modern/context/CartesianProvider/useCartesianContext.js +8 -0
- package/modern/hooks/useAxisEvents.js +7 -10
- package/modern/hooks/useColorScale.js +3 -3
- package/modern/hooks/useScale.js +4 -5
- package/modern/hooks/useTicks.js +2 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/modern/internals/getSVGPoint.js +11 -0
- package/modern/internals/index.js +8 -2
- package/modern/internals/utils.js +0 -12
- package/package.json +3 -3
- package/context/CartesianContextProvider.d.ts +0 -61
- package/context/CartesianContextProvider.js +0 -220
- package/esm/context/CartesianContextProvider.js +0 -211
- package/modern/context/CartesianContextProvider.js +0 -211
|
@@ -2,92 +2,92 @@ import { AllSeriesType } from '../models/seriesType';
|
|
|
2
2
|
export declare function defaultizeColor(series: AllSeriesType, seriesIndex: number, colors?: string[]): {
|
|
3
3
|
data: {
|
|
4
4
|
color: string;
|
|
5
|
-
label?: string | ((location: "tooltip" | "legend" | "arc") => string)
|
|
5
|
+
label?: string | ((location: "tooltip" | "legend" | "arc") => string);
|
|
6
6
|
value: number;
|
|
7
7
|
id?: import("../models/seriesType").PieItemId | undefined;
|
|
8
8
|
}[];
|
|
9
9
|
type: "pie";
|
|
10
|
-
innerRadius?:
|
|
11
|
-
outerRadius?:
|
|
12
|
-
arcLabelRadius?:
|
|
13
|
-
cornerRadius?: number
|
|
14
|
-
startAngle?: number
|
|
15
|
-
endAngle?: number
|
|
16
|
-
paddingAngle?: number
|
|
17
|
-
sortingValues?: import("../models/seriesType").ChartsPieSorting
|
|
18
|
-
arcLabel?: "
|
|
19
|
-
label?: string
|
|
20
|
-
}) => string)
|
|
21
|
-
arcLabelMinAngle?: number
|
|
22
|
-
cx?:
|
|
23
|
-
cy?:
|
|
10
|
+
innerRadius?: number | string;
|
|
11
|
+
outerRadius?: number | string;
|
|
12
|
+
arcLabelRadius?: number | string;
|
|
13
|
+
cornerRadius?: number;
|
|
14
|
+
startAngle?: number;
|
|
15
|
+
endAngle?: number;
|
|
16
|
+
paddingAngle?: number;
|
|
17
|
+
sortingValues?: import("../models/seriesType").ChartsPieSorting;
|
|
18
|
+
arcLabel?: "formattedValue" | "label" | "value" | ((item: Omit<import("../models/seriesType").DefaultizedPieValueType, "label"> & {
|
|
19
|
+
label?: string;
|
|
20
|
+
}) => string);
|
|
21
|
+
arcLabelMinAngle?: number;
|
|
22
|
+
cx?: number | string;
|
|
23
|
+
cy?: number | string;
|
|
24
24
|
highlighted?: {
|
|
25
|
-
additionalRadius?: number
|
|
26
|
-
innerRadius?: number
|
|
27
|
-
outerRadius?: number
|
|
28
|
-
cornerRadius?: number
|
|
29
|
-
paddingAngle?: number
|
|
30
|
-
arcLabelRadius?: number
|
|
31
|
-
color?: string
|
|
32
|
-
}
|
|
25
|
+
additionalRadius?: number;
|
|
26
|
+
innerRadius?: number;
|
|
27
|
+
outerRadius?: number;
|
|
28
|
+
cornerRadius?: number;
|
|
29
|
+
paddingAngle?: number;
|
|
30
|
+
arcLabelRadius?: number;
|
|
31
|
+
color?: string;
|
|
32
|
+
};
|
|
33
33
|
faded?: {
|
|
34
|
-
additionalRadius?: number
|
|
35
|
-
innerRadius?: number
|
|
36
|
-
outerRadius?: number
|
|
37
|
-
cornerRadius?: number
|
|
38
|
-
paddingAngle?: number
|
|
39
|
-
arcLabelRadius?: number
|
|
40
|
-
color?: string
|
|
41
|
-
}
|
|
42
|
-
id?: import(".").SeriesId
|
|
43
|
-
color?: string
|
|
34
|
+
additionalRadius?: number;
|
|
35
|
+
innerRadius?: number;
|
|
36
|
+
outerRadius?: number;
|
|
37
|
+
cornerRadius?: number;
|
|
38
|
+
paddingAngle?: number;
|
|
39
|
+
arcLabelRadius?: number;
|
|
40
|
+
color?: string;
|
|
41
|
+
};
|
|
42
|
+
id?: import(".").SeriesId;
|
|
43
|
+
color?: string;
|
|
44
44
|
valueFormatter?: import(".").SeriesValueFormatter<import(".").MakeOptional<import("../models/seriesType").PieValueType, "id">> | undefined;
|
|
45
|
-
highlightScope?: Partial<import("..").HighlightScope
|
|
45
|
+
highlightScope?: Partial<import("..").HighlightScope>;
|
|
46
46
|
} | {
|
|
47
47
|
type: "bar";
|
|
48
|
-
data?: (number | null)[]
|
|
49
|
-
dataKey?: string
|
|
50
|
-
label?: string | ((location: "tooltip" | "legend") => string)
|
|
51
|
-
layout?: "horizontal" | "vertical"
|
|
52
|
-
stackOffset?: import("..").StackOffsetType
|
|
53
|
-
id?: import(".").SeriesId
|
|
48
|
+
data?: (number | null)[];
|
|
49
|
+
dataKey?: string;
|
|
50
|
+
label?: string | ((location: "tooltip" | "legend") => string);
|
|
51
|
+
layout?: "horizontal" | "vertical";
|
|
52
|
+
stackOffset?: import("..").StackOffsetType;
|
|
53
|
+
id?: import(".").SeriesId;
|
|
54
54
|
color: string;
|
|
55
55
|
valueFormatter?: import(".").SeriesValueFormatter<number | null> | undefined;
|
|
56
|
-
highlightScope?: Partial<import("..").HighlightScope
|
|
57
|
-
xAxisKey?: string
|
|
58
|
-
yAxisKey?: string
|
|
59
|
-
stack?: string
|
|
60
|
-
stackOrder?: import("..").StackOrderType
|
|
56
|
+
highlightScope?: Partial<import("..").HighlightScope>;
|
|
57
|
+
xAxisKey?: string;
|
|
58
|
+
yAxisKey?: string;
|
|
59
|
+
stack?: string;
|
|
60
|
+
stackOrder?: import("..").StackOrderType;
|
|
61
61
|
} | {
|
|
62
62
|
type: "line";
|
|
63
|
-
data?: (number | null)[]
|
|
64
|
-
dataKey?: string
|
|
65
|
-
stack?: string
|
|
66
|
-
area?: boolean
|
|
67
|
-
label?: string | ((location: "tooltip" | "legend") => string)
|
|
68
|
-
curve?: import("../models/seriesType").CurveType
|
|
69
|
-
showMark?: boolean | ((params: import("../models/seriesType").ShowMarkParams
|
|
70
|
-
disableHighlight?: boolean
|
|
71
|
-
connectNulls?: boolean
|
|
72
|
-
stackOffset?: import("..").StackOffsetType
|
|
73
|
-
id?: import(".").SeriesId
|
|
63
|
+
data?: (number | null)[];
|
|
64
|
+
dataKey?: string;
|
|
65
|
+
stack?: string;
|
|
66
|
+
area?: boolean;
|
|
67
|
+
label?: string | ((location: "tooltip" | "legend") => string);
|
|
68
|
+
curve?: import("../models/seriesType").CurveType;
|
|
69
|
+
showMark?: boolean | ((params: import("../models/seriesType").ShowMarkParams) => boolean);
|
|
70
|
+
disableHighlight?: boolean;
|
|
71
|
+
connectNulls?: boolean;
|
|
72
|
+
stackOffset?: import("..").StackOffsetType;
|
|
73
|
+
id?: import(".").SeriesId;
|
|
74
74
|
color: string;
|
|
75
75
|
valueFormatter?: import(".").SeriesValueFormatter<number | null> | undefined;
|
|
76
|
-
highlightScope?: Partial<import("..").HighlightScope
|
|
77
|
-
xAxisKey?: string
|
|
78
|
-
yAxisKey?: string
|
|
79
|
-
stackOrder?: import("..").StackOrderType
|
|
76
|
+
highlightScope?: Partial<import("..").HighlightScope>;
|
|
77
|
+
xAxisKey?: string;
|
|
78
|
+
yAxisKey?: string;
|
|
79
|
+
stackOrder?: import("..").StackOrderType;
|
|
80
80
|
} | {
|
|
81
81
|
type: "scatter";
|
|
82
82
|
data: import("../models/seriesType").ScatterValueType[];
|
|
83
|
-
markerSize?: number
|
|
84
|
-
label?: string | ((location: "tooltip" | "legend") => string)
|
|
85
|
-
disableHover?: boolean
|
|
86
|
-
zAxisKey?: string
|
|
87
|
-
id?: import(".").SeriesId
|
|
83
|
+
markerSize?: number;
|
|
84
|
+
label?: string | ((location: "tooltip" | "legend") => string);
|
|
85
|
+
disableHover?: boolean;
|
|
86
|
+
zAxisKey?: string;
|
|
87
|
+
id?: import(".").SeriesId;
|
|
88
88
|
color: string;
|
|
89
89
|
valueFormatter?: import(".").SeriesValueFormatter<import("../models/seriesType").ScatterValueType> | undefined;
|
|
90
|
-
highlightScope?: Partial<import("..").HighlightScope
|
|
91
|
-
xAxisKey?: string
|
|
92
|
-
yAxisKey?: string
|
|
90
|
+
highlightScope?: Partial<import("..").HighlightScope>;
|
|
91
|
+
xAxisKey?: string;
|
|
92
|
+
yAxisKey?: string;
|
|
93
93
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getSVGPoint = getSVGPoint;
|
|
7
|
+
/**
|
|
8
|
+
* Transform mouse event position to coordinates inside the SVG.
|
|
9
|
+
* @param svg The SVG element
|
|
10
|
+
* @param event The mouseEvent to transform
|
|
11
|
+
*/
|
|
12
|
+
function getSVGPoint(svg, event) {
|
|
13
|
+
const pt = svg.createSVGPoint();
|
|
14
|
+
pt.x = event.clientX;
|
|
15
|
+
pt.y = event.clientY;
|
|
16
|
+
return pt.matrixTransform(svg.getScreenCTM().inverse());
|
|
17
|
+
}
|
package/internals/index.d.ts
CHANGED
|
@@ -3,13 +3,21 @@ export * from '../ResponsiveChartContainer/useChartContainerDimensions';
|
|
|
3
3
|
export * from '../ResponsiveChartContainer/ResizableContainer';
|
|
4
4
|
export { useReducedMotion } from '../hooks/useReducedMotion';
|
|
5
5
|
export { useSeries } from '../hooks/useSeries';
|
|
6
|
+
export { useDrawingArea } from '../hooks/useDrawingArea';
|
|
7
|
+
export { useChartContainerHooks } from '../ChartContainer/useChartContainerHooks';
|
|
8
|
+
export { useScatterChartProps } from '../ScatterChart/useScatterChartProps';
|
|
9
|
+
export { useLineChartProps } from '../LineChart/useLineChartProps';
|
|
10
|
+
export { useBarChartProps } from '../BarChart/useBarChartProps';
|
|
6
11
|
export * from './defaultizeValueFormatter';
|
|
7
12
|
export * from './configInit';
|
|
8
|
-
export * from '
|
|
13
|
+
export * from './getSVGPoint';
|
|
14
|
+
export * from '../context/CartesianProvider';
|
|
9
15
|
export * from '../context/DrawingProvider';
|
|
16
|
+
export * from '../context/ColorProvider';
|
|
10
17
|
export * from '../context/InteractionProvider';
|
|
11
18
|
export * from '../context/SeriesContextProvider';
|
|
12
19
|
export * from '../context/ZAxisContextProvider';
|
|
20
|
+
export type * from '../context/context.types';
|
|
13
21
|
export * from '../models/seriesType/config';
|
|
14
22
|
export * from '../models/seriesType/common';
|
|
15
23
|
export * from '../models/helpers';
|
package/internals/index.js
CHANGED
|
@@ -5,14 +5,49 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
useReducedMotion: true,
|
|
8
|
-
useSeries: true
|
|
8
|
+
useSeries: true,
|
|
9
|
+
useDrawingArea: true,
|
|
10
|
+
useChartContainerHooks: true,
|
|
11
|
+
useScatterChartProps: true,
|
|
12
|
+
useLineChartProps: true,
|
|
13
|
+
useBarChartProps: true
|
|
9
14
|
};
|
|
15
|
+
Object.defineProperty(exports, "useBarChartProps", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () {
|
|
18
|
+
return _useBarChartProps.useBarChartProps;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "useChartContainerHooks", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _useChartContainerHooks.useChartContainerHooks;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "useDrawingArea", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () {
|
|
30
|
+
return _useDrawingArea.useDrawingArea;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "useLineChartProps", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return _useLineChartProps.useLineChartProps;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
10
39
|
Object.defineProperty(exports, "useReducedMotion", {
|
|
11
40
|
enumerable: true,
|
|
12
41
|
get: function () {
|
|
13
42
|
return _useReducedMotion.useReducedMotion;
|
|
14
43
|
}
|
|
15
44
|
});
|
|
45
|
+
Object.defineProperty(exports, "useScatterChartProps", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () {
|
|
48
|
+
return _useScatterChartProps.useScatterChartProps;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
16
51
|
Object.defineProperty(exports, "useSeries", {
|
|
17
52
|
enumerable: true,
|
|
18
53
|
get: function () {
|
|
@@ -57,6 +92,11 @@ Object.keys(_ResizableContainer).forEach(function (key) {
|
|
|
57
92
|
});
|
|
58
93
|
var _useReducedMotion = require("../hooks/useReducedMotion");
|
|
59
94
|
var _useSeries = require("../hooks/useSeries");
|
|
95
|
+
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
96
|
+
var _useChartContainerHooks = require("../ChartContainer/useChartContainerHooks");
|
|
97
|
+
var _useScatterChartProps = require("../ScatterChart/useScatterChartProps");
|
|
98
|
+
var _useLineChartProps = require("../LineChart/useLineChartProps");
|
|
99
|
+
var _useBarChartProps = require("../BarChart/useBarChartProps");
|
|
60
100
|
var _defaultizeValueFormatter = require("./defaultizeValueFormatter");
|
|
61
101
|
Object.keys(_defaultizeValueFormatter).forEach(function (key) {
|
|
62
102
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -81,15 +121,27 @@ Object.keys(_configInit).forEach(function (key) {
|
|
|
81
121
|
}
|
|
82
122
|
});
|
|
83
123
|
});
|
|
84
|
-
var
|
|
85
|
-
Object.keys(
|
|
124
|
+
var _getSVGPoint = require("./getSVGPoint");
|
|
125
|
+
Object.keys(_getSVGPoint).forEach(function (key) {
|
|
126
|
+
if (key === "default" || key === "__esModule") return;
|
|
127
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
128
|
+
if (key in exports && exports[key] === _getSVGPoint[key]) return;
|
|
129
|
+
Object.defineProperty(exports, key, {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
get: function () {
|
|
132
|
+
return _getSVGPoint[key];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
137
|
+
Object.keys(_CartesianProvider).forEach(function (key) {
|
|
86
138
|
if (key === "default" || key === "__esModule") return;
|
|
87
139
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
88
|
-
if (key in exports && exports[key] ===
|
|
140
|
+
if (key in exports && exports[key] === _CartesianProvider[key]) return;
|
|
89
141
|
Object.defineProperty(exports, key, {
|
|
90
142
|
enumerable: true,
|
|
91
143
|
get: function () {
|
|
92
|
-
return
|
|
144
|
+
return _CartesianProvider[key];
|
|
93
145
|
}
|
|
94
146
|
});
|
|
95
147
|
});
|
|
@@ -105,6 +157,18 @@ Object.keys(_DrawingProvider).forEach(function (key) {
|
|
|
105
157
|
}
|
|
106
158
|
});
|
|
107
159
|
});
|
|
160
|
+
var _ColorProvider = require("../context/ColorProvider");
|
|
161
|
+
Object.keys(_ColorProvider).forEach(function (key) {
|
|
162
|
+
if (key === "default" || key === "__esModule") return;
|
|
163
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
164
|
+
if (key in exports && exports[key] === _ColorProvider[key]) return;
|
|
165
|
+
Object.defineProperty(exports, key, {
|
|
166
|
+
enumerable: true,
|
|
167
|
+
get: function () {
|
|
168
|
+
return _ColorProvider[key];
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
108
172
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
109
173
|
Object.keys(_InteractionProvider).forEach(function (key) {
|
|
110
174
|
if (key === "default" || key === "__esModule") return;
|
package/internals/utils.d.ts
CHANGED
|
@@ -4,12 +4,6 @@ type Without<T, U> = {
|
|
|
4
4
|
[P in Exclude<keyof T, keyof U>]?: never;
|
|
5
5
|
};
|
|
6
6
|
export type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
|
7
|
-
/**
|
|
8
|
-
* Transform mouse event position to coordinates inside the SVG.
|
|
9
|
-
* @param svg The SVG element
|
|
10
|
-
* @param event The mouseEvent to transform
|
|
11
|
-
*/
|
|
12
|
-
export declare function getSVGPoint(svg: SVGSVGElement, event: Pick<MouseEvent, 'clientX' | 'clientY'>): DOMPoint;
|
|
13
7
|
/**
|
|
14
8
|
* Helper that converts values and percentages into values.
|
|
15
9
|
* @param value The value provided by the developer. Can either be a number or a string with '%' or 'px'.
|
package/internals/utils.js
CHANGED
|
@@ -5,25 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.cleanId = cleanId;
|
|
7
7
|
exports.getPercentageValue = getPercentageValue;
|
|
8
|
-
exports.getSVGPoint = getSVGPoint;
|
|
9
8
|
exports.getSymbol = getSymbol;
|
|
10
9
|
// Returns the index of a defined shape
|
|
11
10
|
function getSymbol(shape) {
|
|
12
11
|
const symbolNames = 'circle cross diamond square star triangle wye'.split(/ /);
|
|
13
12
|
return symbolNames.indexOf(shape) || 0;
|
|
14
13
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Transform mouse event position to coordinates inside the SVG.
|
|
17
|
-
* @param svg The SVG element
|
|
18
|
-
* @param event The mouseEvent to transform
|
|
19
|
-
*/
|
|
20
|
-
function getSVGPoint(svg, event) {
|
|
21
|
-
const pt = svg.createSVGPoint();
|
|
22
|
-
pt.x = event.clientX;
|
|
23
|
-
pt.y = event.clientY;
|
|
24
|
-
return pt.matrixTransform(svg.getScreenCTM().inverse());
|
|
25
|
-
}
|
|
26
|
-
|
|
27
14
|
/**
|
|
28
15
|
* Helper that converts values and percentages into values.
|
|
29
16
|
* @param value The value provided by the developer. Can either be a number or a string with '%' or 'px'.
|
package/models/axis.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { ScaleBand, ScaleLogarithmic, ScalePower, ScaleTime, ScaleLinear, ScalePoint, ScaleOrdinal, ScaleSequential, ScaleThreshold } from 'd3-scale';
|
|
3
2
|
import { ChartsAxisClasses } from '../ChartsAxis/axisClasses';
|
|
4
3
|
import type { TickParams } from '../hooks/useTicks';
|
|
@@ -126,7 +125,7 @@ export interface ChartsXAxisProps extends ChartsAxisProps {
|
|
|
126
125
|
*/
|
|
127
126
|
position?: 'top' | 'bottom';
|
|
128
127
|
}
|
|
129
|
-
export type ScaleName =
|
|
128
|
+
export type ScaleName = keyof AxisScaleConfig;
|
|
130
129
|
export type ContinuousScaleName = 'linear' | 'log' | 'pow' | 'sqrt' | 'time' | 'utc';
|
|
131
130
|
export interface AxisScaleConfig {
|
|
132
131
|
band: {
|
package/models/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChartSeriesType, ExtremumGetter, Formatter } from './seriesType/config';
|
|
1
|
+
import { CartesianChartSeriesType, ChartSeriesType, ExtremumGetter, Formatter } from './seriesType/config';
|
|
2
2
|
import { AxisDefaultized } from './axis';
|
|
3
3
|
import { DefaultizedSeriesType } from './seriesType';
|
|
4
4
|
import { ZAxisDefaultized } from './z-axis';
|
|
@@ -13,4 +13,7 @@ export type ChartsPluginType<T> = T extends ChartSeriesType ? {
|
|
|
13
13
|
xExtremumGetter?: ExtremumGetter<T>;
|
|
14
14
|
yExtremumGetter?: ExtremumGetter<T>;
|
|
15
15
|
} : never;
|
|
16
|
+
export type ExtremumGettersConfig<T extends ChartSeriesType = CartesianChartSeriesType> = {
|
|
17
|
+
[K in T]?: ExtremumGetter<K>;
|
|
18
|
+
};
|
|
16
19
|
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import useId from '@mui/utils/useId';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import { BarPlot } from './BarPlot';
|
|
6
5
|
import { ResponsiveChartContainer } from '../ResponsiveChartContainer';
|
|
7
6
|
import { ChartsAxis } from '../ChartsAxis';
|
|
8
|
-
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
9
7
|
import { ChartsTooltip } from '../ChartsTooltip';
|
|
10
8
|
import { ChartsLegend } from '../ChartsLegend';
|
|
11
9
|
import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
@@ -13,6 +11,7 @@ import { ChartsClipPath } from '../ChartsClipPath';
|
|
|
13
11
|
import { ChartsGrid } from '../ChartsGrid';
|
|
14
12
|
import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
|
|
15
13
|
import { ChartsOverlay } from '../ChartsOverlay/ChartsOverlay';
|
|
14
|
+
import { useBarChartProps } from './useBarChartProps';
|
|
16
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
16
|
/**
|
|
18
17
|
* Demos:
|
|
@@ -27,108 +26,26 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
27
26
|
*/
|
|
28
27
|
const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
29
28
|
const {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
onItemClick,
|
|
51
|
-
onAxisClick,
|
|
52
|
-
children,
|
|
53
|
-
slots,
|
|
54
|
-
slotProps,
|
|
55
|
-
loading,
|
|
56
|
-
barLabel,
|
|
57
|
-
highlightedItem,
|
|
58
|
-
onHighlightChange
|
|
59
|
-
} = props;
|
|
60
|
-
const id = useId();
|
|
61
|
-
const clipPathId = `${id}-clip-path`;
|
|
62
|
-
const hasHorizontalSeries = layout === 'horizontal' || layout === undefined && series.some(item => item.layout === 'horizontal');
|
|
63
|
-
const defaultAxisConfig = {
|
|
64
|
-
scaleType: 'band',
|
|
65
|
-
data: Array.from({
|
|
66
|
-
length: Math.max(...series.map(s => (s.data ?? dataset ?? []).length))
|
|
67
|
-
}, (_, index) => index)
|
|
68
|
-
};
|
|
69
|
-
const defaultizedAxisHighlight = _extends({}, hasHorizontalSeries ? {
|
|
70
|
-
y: 'band'
|
|
71
|
-
} : {
|
|
72
|
-
x: 'band'
|
|
73
|
-
}, axisHighlight);
|
|
74
|
-
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
|
|
75
|
-
ref: ref,
|
|
76
|
-
series: series.map(s => _extends({
|
|
77
|
-
type: 'bar'
|
|
78
|
-
}, s, {
|
|
79
|
-
layout: hasHorizontalSeries ? 'horizontal' : 'vertical'
|
|
80
|
-
})),
|
|
81
|
-
width: width,
|
|
82
|
-
height: height,
|
|
83
|
-
margin: margin,
|
|
84
|
-
xAxis: xAxis ?? (hasHorizontalSeries ? undefined : [_extends({
|
|
85
|
-
id: DEFAULT_X_AXIS_KEY
|
|
86
|
-
}, defaultAxisConfig)]),
|
|
87
|
-
yAxis: yAxis ?? (hasHorizontalSeries ? [_extends({
|
|
88
|
-
id: DEFAULT_Y_AXIS_KEY
|
|
89
|
-
}, defaultAxisConfig)] : undefined),
|
|
90
|
-
colors: colors,
|
|
91
|
-
dataset: dataset,
|
|
92
|
-
sx: sx,
|
|
93
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
94
|
-
highlightedItem: highlightedItem,
|
|
95
|
-
onHighlightChange: onHighlightChange,
|
|
96
|
-
children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
|
|
97
|
-
onAxisClick: onAxisClick
|
|
98
|
-
}), grid && /*#__PURE__*/_jsx(ChartsGrid, {
|
|
99
|
-
vertical: grid.vertical,
|
|
100
|
-
horizontal: grid.horizontal
|
|
101
|
-
}), /*#__PURE__*/_jsxs("g", {
|
|
102
|
-
clipPath: `url(#${clipPathId})`,
|
|
103
|
-
children: [/*#__PURE__*/_jsx(BarPlot, {
|
|
104
|
-
slots: slots,
|
|
105
|
-
slotProps: slotProps,
|
|
106
|
-
skipAnimation: skipAnimation,
|
|
107
|
-
onItemClick: onItemClick,
|
|
108
|
-
borderRadius: borderRadius,
|
|
109
|
-
barLabel: barLabel
|
|
110
|
-
}), /*#__PURE__*/_jsx(ChartsOverlay, {
|
|
111
|
-
loading: loading,
|
|
112
|
-
slots: slots,
|
|
113
|
-
slotProps: slotProps
|
|
114
|
-
})]
|
|
115
|
-
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
116
|
-
topAxis: topAxis,
|
|
117
|
-
leftAxis: leftAxis,
|
|
118
|
-
rightAxis: rightAxis,
|
|
119
|
-
bottomAxis: bottomAxis,
|
|
120
|
-
slots: slots,
|
|
121
|
-
slotProps: slotProps
|
|
122
|
-
}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
|
|
123
|
-
slots: slots,
|
|
124
|
-
slotProps: slotProps
|
|
125
|
-
})), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, defaultizedAxisHighlight)), !loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
|
|
126
|
-
slots: slots,
|
|
127
|
-
slotProps: slotProps
|
|
128
|
-
})), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
129
|
-
id: clipPathId
|
|
130
|
-
}), children]
|
|
131
|
-
});
|
|
29
|
+
chartContainerProps,
|
|
30
|
+
barPlotProps,
|
|
31
|
+
axisClickHandlerProps,
|
|
32
|
+
gridProps,
|
|
33
|
+
clipPathProps,
|
|
34
|
+
clipPathGroupProps,
|
|
35
|
+
overlayProps,
|
|
36
|
+
chartsAxisProps,
|
|
37
|
+
axisHighlightProps,
|
|
38
|
+
legendProps,
|
|
39
|
+
tooltipProps,
|
|
40
|
+
children
|
|
41
|
+
} = useBarChartProps(props);
|
|
42
|
+
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, _extends({
|
|
43
|
+
ref: ref
|
|
44
|
+
}, chartContainerProps, {
|
|
45
|
+
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), props.grid && /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
46
|
+
children: [/*#__PURE__*/_jsx(BarPlot, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps))]
|
|
47
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
48
|
+
}));
|
|
132
49
|
});
|
|
133
50
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
134
51
|
// ----------------------------- Warning --------------------------------
|
|
@@ -2,7 +2,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["bars", "skipAnimation"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import { useTransition } from '@react-spring/web';
|
|
7
6
|
import { BarLabelItem } from './BarLabelItem';
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -73,26 +72,4 @@ function BarLabelPlot(props) {
|
|
|
73
72
|
})))
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
|
-
process.env.NODE_ENV !== "production" ? BarLabelPlot.propTypes = {
|
|
77
|
-
// ----------------------------- Warning --------------------------------
|
|
78
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
79
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
80
|
-
// ----------------------------------------------------------------------
|
|
81
|
-
barLabel: PropTypes.oneOfType([PropTypes.oneOf(['value']), PropTypes.func]),
|
|
82
|
-
bars: PropTypes.arrayOf(PropTypes.shape({
|
|
83
|
-
color: PropTypes.string.isRequired,
|
|
84
|
-
dataIndex: PropTypes.number.isRequired,
|
|
85
|
-
height: PropTypes.number.isRequired,
|
|
86
|
-
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
87
|
-
maskId: PropTypes.string.isRequired,
|
|
88
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
89
|
-
value: PropTypes.number,
|
|
90
|
-
width: PropTypes.number.isRequired,
|
|
91
|
-
x: PropTypes.number.isRequired,
|
|
92
|
-
xOrigin: PropTypes.number.isRequired,
|
|
93
|
-
y: PropTypes.number.isRequired,
|
|
94
|
-
yOrigin: PropTypes.number.isRequired
|
|
95
|
-
})).isRequired,
|
|
96
|
-
skipAnimation: PropTypes.bool
|
|
97
|
-
} : void 0;
|
|
98
75
|
export { BarLabelPlot };
|
|
@@ -4,7 +4,7 @@ const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useTransition } from '@react-spring/web';
|
|
7
|
-
import {
|
|
7
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
8
8
|
import { BarElement } from './BarElement';
|
|
9
9
|
import getColor from './getColor';
|
|
10
10
|
import { useChartId } from '../hooks';
|
|
@@ -47,7 +47,7 @@ const useAggregatedData = () => {
|
|
|
47
47
|
stackingGroups: [],
|
|
48
48
|
seriesOrder: []
|
|
49
49
|
};
|
|
50
|
-
const axisData =
|
|
50
|
+
const axisData = useCartesianContext();
|
|
51
51
|
const chartId = useChartId();
|
|
52
52
|
const {
|
|
53
53
|
series,
|