@mui/x-charts 8.3.1 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +9 -2
- package/BarChart/BarChart.js +11 -3
- package/BarChart/useBarChartProps.js +1 -1
- package/CHANGELOG.md +213 -0
- package/ChartContainer/ChartContainer.d.ts +21 -2
- package/ChartContainer/ChartContainer.js +17 -1
- package/ChartContainer/useChartContainerProps.js +7 -3
- package/ChartDataProvider/ChartDataProvider.d.ts +11 -1
- package/ChartDataProvider/ChartDataProvider.js +19 -2
- package/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
- package/ChartDataProvider/useChartDataProviderProps.js +7 -3
- package/ChartsAxis/axisClasses.d.ts +5 -0
- package/ChartsAxis/axisClasses.js +1 -1
- package/ChartsLegend/ChartsLegend.js +1 -0
- package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
- package/ChartsSurface/ChartsSurface.js +1 -0
- package/ChartsXAxis/ChartsXAxis.js +7 -16
- package/ChartsYAxis/ChartsYAxis.js +4 -8
- package/Gauge/Gauge.js +1 -0
- package/Gauge/GaugeContainer.js +1 -0
- package/Gauge/GaugeProvider.js +1 -3
- package/LineChart/AnimatedLine.js +1 -0
- package/LineChart/LineChart.d.ts +9 -2
- package/LineChart/LineChart.js +11 -3
- package/LineChart/LineHighlightPlot.js +1 -4
- package/LineChart/MarkPlot.js +1 -4
- package/LineChart/useLineChartProps.js +1 -1
- package/PieChart/PieArc.js +1 -0
- package/PieChart/PieArcLabel.js +1 -0
- package/PieChart/PieChart.d.ts +10 -3
- package/PieChart/PieChart.js +18 -9
- package/RadarChart/RadarChart.d.ts +21 -3
- package/RadarChart/RadarChart.js +20 -4
- package/RadarChart/RadarChart.plugins.d.ts +5 -0
- package/RadarChart/RadarChart.plugins.js +10 -0
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
- package/RadarChart/RadarDataProvider/RadarDataProvider.js +6 -116
- package/RadarChart/index.d.ts +2 -0
- package/RadarChart/index.js +15 -1
- package/RadarChart/useRadarChartProps.d.ts +2 -1
- package/RadarChart/useRadarChartProps.js +3 -1
- package/ScatterChart/Scatter.js +3 -11
- package/ScatterChart/ScatterChart.d.ts +9 -2
- package/ScatterChart/ScatterChart.js +13 -5
- package/ScatterChart/useScatterChartProps.js +4 -2
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +31 -26
- package/Toolbar/Toolbar.d.ts +9 -3
- package/Toolbar/Toolbar.js +23 -7
- package/Toolbar/Toolbar.types.d.ts +15 -0
- package/Toolbar/Toolbar.types.js +5 -0
- package/Toolbar/ToolbarButton.d.ts +8 -2
- package/Toolbar/ToolbarButton.js +25 -6
- package/Toolbar/chartToolbarClasses.d.ts +6 -0
- package/Toolbar/chartToolbarClasses.js +9 -0
- package/Toolbar/index.d.ts +3 -1
- package/Toolbar/index.js +22 -0
- package/Toolbar/internals/ChartsToolbar.d.ts +6 -0
- package/Toolbar/internals/ChartsToolbar.js +14 -0
- package/context/ChartProvider/ChartContext.js +1 -3
- package/context/ChartsSlotsContext.d.ts +20 -0
- package/context/ChartsSlotsContext.js +44 -0
- package/context/index.d.ts +2 -1
- package/context/index.js +11 -0
- package/context/useChartApiContext.d.ts +10 -0
- package/context/useChartApiContext.js +27 -0
- package/esm/BarChart/BarChart.d.ts +9 -2
- package/esm/BarChart/BarChart.js +11 -3
- package/esm/BarChart/useBarChartProps.js +1 -1
- package/esm/ChartContainer/ChartContainer.d.ts +21 -2
- package/esm/ChartContainer/ChartContainer.js +17 -1
- package/esm/ChartContainer/useChartContainerProps.js +7 -3
- package/esm/ChartDataProvider/ChartDataProvider.d.ts +11 -1
- package/esm/ChartDataProvider/ChartDataProvider.js +19 -2
- package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
- package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -3
- package/esm/ChartsAxis/axisClasses.d.ts +5 -0
- package/esm/ChartsAxis/axisClasses.js +1 -1
- package/esm/ChartsLegend/ChartsLegend.js +1 -0
- package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
- package/esm/ChartsSurface/ChartsSurface.js +1 -0
- package/esm/ChartsXAxis/ChartsXAxis.js +7 -16
- package/esm/ChartsYAxis/ChartsYAxis.js +4 -8
- package/esm/Gauge/Gauge.js +1 -0
- package/esm/Gauge/GaugeContainer.js +1 -0
- package/esm/Gauge/GaugeProvider.js +1 -3
- package/esm/LineChart/AnimatedLine.js +1 -0
- package/esm/LineChart/LineChart.d.ts +9 -2
- package/esm/LineChart/LineChart.js +11 -3
- package/esm/LineChart/LineHighlightPlot.js +1 -4
- package/esm/LineChart/MarkPlot.js +1 -4
- package/esm/LineChart/useLineChartProps.js +1 -1
- package/esm/PieChart/PieArc.js +1 -0
- package/esm/PieChart/PieArcLabel.js +1 -0
- package/esm/PieChart/PieChart.d.ts +10 -3
- package/esm/PieChart/PieChart.js +16 -7
- package/esm/RadarChart/RadarChart.d.ts +21 -3
- package/esm/RadarChart/RadarChart.js +20 -4
- package/esm/RadarChart/RadarChart.plugins.d.ts +5 -0
- package/esm/RadarChart/RadarChart.plugins.js +4 -0
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +5 -115
- package/esm/RadarChart/index.d.ts +2 -0
- package/esm/RadarChart/index.js +2 -0
- package/esm/RadarChart/useRadarChartProps.d.ts +2 -1
- package/esm/RadarChart/useRadarChartProps.js +3 -1
- package/esm/ScatterChart/Scatter.js +3 -11
- package/esm/ScatterChart/ScatterChart.d.ts +9 -2
- package/esm/ScatterChart/ScatterChart.js +13 -5
- package/esm/ScatterChart/useScatterChartProps.js +4 -2
- package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/esm/SparkLineChart/SparkLineChart.js +31 -26
- package/esm/Toolbar/Toolbar.d.ts +9 -3
- package/esm/Toolbar/Toolbar.js +22 -7
- package/esm/Toolbar/Toolbar.types.d.ts +15 -0
- package/esm/Toolbar/Toolbar.types.js +1 -0
- package/esm/Toolbar/ToolbarButton.d.ts +8 -2
- package/esm/Toolbar/ToolbarButton.js +24 -5
- package/esm/Toolbar/chartToolbarClasses.d.ts +6 -0
- package/esm/Toolbar/chartToolbarClasses.js +2 -0
- package/esm/Toolbar/index.d.ts +3 -1
- package/esm/Toolbar/index.js +3 -1
- package/esm/Toolbar/internals/ChartsToolbar.d.ts +6 -0
- package/esm/Toolbar/internals/ChartsToolbar.js +8 -0
- package/esm/context/ChartProvider/ChartContext.js +1 -3
- package/esm/context/ChartsSlotsContext.d.ts +20 -0
- package/esm/context/ChartsSlotsContext.js +35 -0
- package/esm/context/index.d.ts +2 -1
- package/esm/context/index.js +1 -0
- package/esm/context/useChartApiContext.d.ts +10 -0
- package/esm/context/useChartApiContext.js +21 -0
- package/esm/hooks/index.d.ts +1 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useTicks.js +2 -6
- package/esm/index.js +1 -1
- package/esm/internals/constants.d.ts +3 -1
- package/esm/internals/constants.js +2 -1
- package/esm/internals/consumeSlots.js +2 -1
- package/esm/internals/consumeThemeProps.js +3 -1
- package/esm/internals/dateHelpers.d.ts +15 -0
- package/esm/internals/dateHelpers.js +20 -0
- package/esm/internals/domUtils.d.ts +1 -2
- package/esm/internals/domUtils.js +8 -19
- package/esm/internals/index.d.ts +4 -1
- package/esm/internals/index.js +4 -1
- package/esm/internals/material/index.d.ts +2 -0
- package/esm/internals/plugins/allPlugins.d.ts +1 -0
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -8
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +5 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +8 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +17 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -8
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
- package/esm/models/index.d.ts +2 -2
- package/esm/models/index.js +1 -0
- package/esm/models/slots/chartsBaseSlotProps.d.ts +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- package/hooks/useTicks.js +2 -6
- package/index.js +1 -1
- package/internals/constants.d.ts +3 -1
- package/internals/constants.js +3 -2
- package/internals/consumeSlots.js +2 -1
- package/internals/consumeThemeProps.js +3 -1
- package/internals/dateHelpers.d.ts +15 -0
- package/internals/dateHelpers.js +28 -0
- package/internals/domUtils.d.ts +1 -2
- package/internals/domUtils.js +8 -20
- package/internals/index.d.ts +4 -1
- package/internals/index.js +44 -8
- package/internals/material/index.d.ts +2 -0
- package/internals/plugins/allPlugins.d.ts +1 -0
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +5 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +7 -8
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +6 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +17 -0
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +5 -11
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
- package/models/index.d.ts +2 -2
- package/models/index.js +11 -0
- package/models/slots/chartsBaseSlotProps.d.ts +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createDateFormatter = createDateFormatter;
|
|
7
|
+
exports.isDateData = void 0;
|
|
8
|
+
var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the provided data array contains Date objects.
|
|
11
|
+
* @param data The data array to check.
|
|
12
|
+
* @returns A type predicate indicating if the data is an array of Date objects.
|
|
13
|
+
*/
|
|
14
|
+
const isDateData = data => data?.[0] instanceof Date;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Creates a formatter function for date values.
|
|
18
|
+
* @param axis The axis configuration.
|
|
19
|
+
* @param range The range for the time scale.
|
|
20
|
+
* @returns A formatter function for date values.
|
|
21
|
+
*/
|
|
22
|
+
exports.isDateData = isDateData;
|
|
23
|
+
function createDateFormatter(axis, range) {
|
|
24
|
+
const timeScale = (0, _d3Scale.scaleTime)(axis.data, range);
|
|
25
|
+
return (v, {
|
|
26
|
+
location
|
|
27
|
+
}) => location === 'tick' ? timeScale.tickFormat(axis.tickNumber)(v) : `${v.toLocaleString()}`;
|
|
28
|
+
}
|
package/internals/domUtils.d.ts
CHANGED
|
@@ -14,5 +14,4 @@ export declare const getStyleString: (style: React.CSSProperties) => string;
|
|
|
14
14
|
export declare const getStringSize: (text: string | number, style?: React.CSSProperties) => {
|
|
15
15
|
width: number;
|
|
16
16
|
height: number;
|
|
17
|
-
};
|
|
18
|
-
export declare function unstable_cleanupDOM(): void;
|
|
17
|
+
};
|
package/internals/domUtils.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.getStyleString = exports.getStringSize = exports.MEASUREMENT_SPAN_ID = void 0;
|
|
8
|
-
exports.unstable_cleanupDOM = unstable_cleanupDOM;
|
|
9
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
9
|
// DOM utils taken from
|
|
11
10
|
// https://github.com/recharts/recharts/blob/master/src/util/DOMUtils.ts
|
|
@@ -13,10 +12,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
12
|
function isSsr() {
|
|
14
13
|
return typeof window === 'undefined';
|
|
15
14
|
}
|
|
16
|
-
const stringCache =
|
|
17
|
-
widthCache: {},
|
|
18
|
-
cacheCount: 0
|
|
19
|
-
};
|
|
15
|
+
const stringCache = new Map();
|
|
20
16
|
const MAX_CACHE_NUM = 2000;
|
|
21
17
|
const SPAN_STYLE = {
|
|
22
18
|
position: 'absolute',
|
|
@@ -84,8 +80,9 @@ const getStringSize = (text, style = {}) => {
|
|
|
84
80
|
const str = `${text}`;
|
|
85
81
|
const styleString = getStyleString(style);
|
|
86
82
|
const cacheKey = `${str}-${styleString}`;
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
const size = stringCache.get(cacheKey);
|
|
84
|
+
if (size) {
|
|
85
|
+
return size;
|
|
89
86
|
}
|
|
90
87
|
try {
|
|
91
88
|
let measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
|
|
@@ -108,12 +105,9 @@ const getStringSize = (text, style = {}) => {
|
|
|
108
105
|
width: rect.width,
|
|
109
106
|
height: rect.height
|
|
110
107
|
};
|
|
111
|
-
stringCache.
|
|
112
|
-
if (stringCache.
|
|
113
|
-
stringCache.
|
|
114
|
-
stringCache.widthCache = {};
|
|
115
|
-
} else {
|
|
116
|
-
stringCache.cacheCount += 1;
|
|
108
|
+
stringCache.set(cacheKey, result);
|
|
109
|
+
if (stringCache.size + 1 > MAX_CACHE_NUM) {
|
|
110
|
+
stringCache.clear();
|
|
117
111
|
}
|
|
118
112
|
if (process.env.NODE_ENV === 'test') {
|
|
119
113
|
// In test environment, we clean the measurement span immediately
|
|
@@ -135,10 +129,4 @@ const getStringSize = (text, style = {}) => {
|
|
|
135
129
|
};
|
|
136
130
|
}
|
|
137
131
|
};
|
|
138
|
-
|
|
139
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
140
|
-
exports.getStringSize = getStringSize;
|
|
141
|
-
function unstable_cleanupDOM() {
|
|
142
|
-
// const measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
|
|
143
|
-
// measurementSpan?.remove();
|
|
144
|
-
}
|
|
132
|
+
exports.getStringSize = getStringSize;
|
package/internals/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
|
7
7
|
export { useScatterChartProps } from "../ScatterChart/useScatterChartProps.js";
|
|
8
8
|
export { useLineChartProps } from "../LineChart/useLineChartProps.js";
|
|
9
9
|
export { useBarChartProps } from "../BarChart/useBarChartProps.js";
|
|
10
|
+
export { useRadarChartProps } from "../RadarChart/useRadarChartProps.js";
|
|
10
11
|
export * from "../ChartContainer/useChartContainerProps.js";
|
|
11
12
|
export * from "../ChartDataProvider/useChartDataProviderProps.js";
|
|
12
13
|
export * from "./createSeriesSelectorOfType.js";
|
|
@@ -26,20 +27,22 @@ export * from "./store/useSelector.js";
|
|
|
26
27
|
export * from "../BarChart/BarChart.plugins.js";
|
|
27
28
|
export * from "../LineChart/LineChart.plugins.js";
|
|
28
29
|
export * from "../ScatterChart/ScatterChart.plugins.js";
|
|
30
|
+
export * from "../RadarChart/RadarChart.plugins.js";
|
|
29
31
|
export * from "./defaultizeValueFormatter.js";
|
|
30
32
|
export * from "./configInit.js";
|
|
31
33
|
export * from "./getLabel.js";
|
|
32
34
|
export * from "./getSVGPoint.js";
|
|
33
35
|
export * from "./isDefined.js";
|
|
34
|
-
export { unstable_cleanupDOM } from "./domUtils.js";
|
|
35
36
|
export * from "./getScale.js";
|
|
36
37
|
export * from "./stackSeries.js";
|
|
37
38
|
export * from "./getCurve.js";
|
|
38
39
|
export * from "./consumeSlots.js";
|
|
39
40
|
export * from "./consumeThemeProps.js";
|
|
40
41
|
export * from "./defaultizeMargin.js";
|
|
42
|
+
export * from "./dateHelpers.js";
|
|
41
43
|
export { getAxisExtremum } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js";
|
|
42
44
|
export * from "../context/ChartProvider/index.js";
|
|
45
|
+
export * from "../context/ChartsSlotsContext.js";
|
|
43
46
|
export * from "../models/seriesType/config.js";
|
|
44
47
|
export * from "../models/seriesType/common.js";
|
|
45
48
|
export * from "../models/z-axis.js";
|
package/internals/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var _exportNames = {
|
|
|
10
10
|
useScatterChartProps: true,
|
|
11
11
|
useLineChartProps: true,
|
|
12
12
|
useBarChartProps: true,
|
|
13
|
-
|
|
13
|
+
useRadarChartProps: true,
|
|
14
14
|
getAxisExtremum: true
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "getAxisExtremum", {
|
|
@@ -19,12 +19,6 @@ Object.defineProperty(exports, "getAxisExtremum", {
|
|
|
19
19
|
return _getAxisExtremum.getAxisExtremum;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
Object.defineProperty(exports, "unstable_cleanupDOM", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () {
|
|
25
|
-
return _domUtils.unstable_cleanupDOM;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
22
|
Object.defineProperty(exports, "useBarChartProps", {
|
|
29
23
|
enumerable: true,
|
|
30
24
|
get: function () {
|
|
@@ -49,6 +43,12 @@ Object.defineProperty(exports, "useLineChartProps", {
|
|
|
49
43
|
return _useLineChartProps.useLineChartProps;
|
|
50
44
|
}
|
|
51
45
|
});
|
|
46
|
+
Object.defineProperty(exports, "useRadarChartProps", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return _useRadarChartProps.useRadarChartProps;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
52
|
Object.defineProperty(exports, "useScatterChartProps", {
|
|
53
53
|
enumerable: true,
|
|
54
54
|
get: function () {
|
|
@@ -103,6 +103,7 @@ var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
|
103
103
|
var _useScatterChartProps = require("../ScatterChart/useScatterChartProps");
|
|
104
104
|
var _useLineChartProps = require("../LineChart/useLineChartProps");
|
|
105
105
|
var _useBarChartProps = require("../BarChart/useBarChartProps");
|
|
106
|
+
var _useRadarChartProps = require("../RadarChart/useRadarChartProps");
|
|
106
107
|
var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
|
|
107
108
|
Object.keys(_useChartContainerProps).forEach(function (key) {
|
|
108
109
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -331,6 +332,18 @@ Object.keys(_ScatterChart).forEach(function (key) {
|
|
|
331
332
|
}
|
|
332
333
|
});
|
|
333
334
|
});
|
|
335
|
+
var _RadarChart = require("../RadarChart/RadarChart.plugins");
|
|
336
|
+
Object.keys(_RadarChart).forEach(function (key) {
|
|
337
|
+
if (key === "default" || key === "__esModule") return;
|
|
338
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
339
|
+
if (key in exports && exports[key] === _RadarChart[key]) return;
|
|
340
|
+
Object.defineProperty(exports, key, {
|
|
341
|
+
enumerable: true,
|
|
342
|
+
get: function () {
|
|
343
|
+
return _RadarChart[key];
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
});
|
|
334
347
|
var _defaultizeValueFormatter = require("./defaultizeValueFormatter");
|
|
335
348
|
Object.keys(_defaultizeValueFormatter).forEach(function (key) {
|
|
336
349
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -391,7 +404,6 @@ Object.keys(_isDefined).forEach(function (key) {
|
|
|
391
404
|
}
|
|
392
405
|
});
|
|
393
406
|
});
|
|
394
|
-
var _domUtils = require("./domUtils");
|
|
395
407
|
var _getScale = require("./getScale");
|
|
396
408
|
Object.keys(_getScale).forEach(function (key) {
|
|
397
409
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -464,6 +476,18 @@ Object.keys(_defaultizeMargin).forEach(function (key) {
|
|
|
464
476
|
}
|
|
465
477
|
});
|
|
466
478
|
});
|
|
479
|
+
var _dateHelpers = require("./dateHelpers");
|
|
480
|
+
Object.keys(_dateHelpers).forEach(function (key) {
|
|
481
|
+
if (key === "default" || key === "__esModule") return;
|
|
482
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
483
|
+
if (key in exports && exports[key] === _dateHelpers[key]) return;
|
|
484
|
+
Object.defineProperty(exports, key, {
|
|
485
|
+
enumerable: true,
|
|
486
|
+
get: function () {
|
|
487
|
+
return _dateHelpers[key];
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
});
|
|
467
491
|
var _getAxisExtremum = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum");
|
|
468
492
|
var _ChartProvider = require("../context/ChartProvider");
|
|
469
493
|
Object.keys(_ChartProvider).forEach(function (key) {
|
|
@@ -477,6 +501,18 @@ Object.keys(_ChartProvider).forEach(function (key) {
|
|
|
477
501
|
}
|
|
478
502
|
});
|
|
479
503
|
});
|
|
504
|
+
var _ChartsSlotsContext = require("../context/ChartsSlotsContext");
|
|
505
|
+
Object.keys(_ChartsSlotsContext).forEach(function (key) {
|
|
506
|
+
if (key === "default" || key === "__esModule") return;
|
|
507
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
508
|
+
if (key in exports && exports[key] === _ChartsSlotsContext[key]) return;
|
|
509
|
+
Object.defineProperty(exports, key, {
|
|
510
|
+
enumerable: true,
|
|
511
|
+
get: function () {
|
|
512
|
+
return _ChartsSlotsContext[key];
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
});
|
|
480
516
|
var _config = require("../models/seriesType/config");
|
|
481
517
|
Object.keys(_config).forEach(function (key) {
|
|
482
518
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
1
2
|
import { ChartsBaseSlots } from "../../models/slots/chartsBaseSlots.js";
|
|
2
3
|
import { ChartsIconSlots } from "../../models/slots/chartsIconSlots.js";
|
|
3
4
|
export type ChartsSlots = ChartsBaseSlots & ChartsIconSlots;
|
|
5
|
+
export type ChartsSlotProps = { [key in keyof ChartsSlots]: React.ComponentProps<ChartsSlots[key]> };
|
|
4
6
|
export declare const defaultSlotsMaterial: ChartsSlots;
|
|
@@ -6,4 +6,5 @@ import { UseChartPolarAxisSignature } from "./featurePlugins/useChartPolarAxis/i
|
|
|
6
6
|
import { UseChartVoronoiSignature } from "./featurePlugins/useChartVoronoi/index.js";
|
|
7
7
|
import { UseChartZAxisSignature } from "./featurePlugins/useChartZAxis/index.js";
|
|
8
8
|
export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVoronoiSignature];
|
|
9
|
+
export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVoronoiSignature];
|
|
9
10
|
export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartVoronoiSignature>];
|
|
@@ -11,6 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
13
13
|
var _ownerWindow = _interopRequireDefault(require("@mui/utils/ownerWindow"));
|
|
14
|
+
var _useSelector = require("../../../store/useSelector");
|
|
14
15
|
var _constants = require("../../../../constants");
|
|
15
16
|
var _useChartDimensions = require("./useChartDimensions.selectors");
|
|
16
17
|
var _defaultizeMargin = require("../../../defaultizeMargin");
|
|
@@ -150,28 +151,21 @@ const useChartDimensions = ({
|
|
|
150
151
|
stateRef.current.displayError = false;
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
const drawingArea = (0, _useSelector.useSelector)(store, _useChartDimensions.selectorChartDrawingArea);
|
|
155
|
+
const isXInside = React.useCallback(x => x >= drawingArea.left - 1 && x <= drawingArea.left + drawingArea.width, [drawingArea.left, drawingArea.width]);
|
|
156
|
+
const isYInside = React.useCallback(y => y >= drawingArea.top - 1 && y <= drawingArea.top + drawingArea.height, [drawingArea.height, drawingArea.top]);
|
|
157
|
+
const isPointInside = React.useCallback((x, y, targetElement) => {
|
|
157
158
|
// For element allowed to overflow, wrapping them in <g data-drawing-container /> make them fully part of the drawing area.
|
|
158
|
-
if (
|
|
159
|
+
if (targetElement && targetElement.closest('[data-drawing-container]')) {
|
|
159
160
|
return true;
|
|
160
161
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const isInsideY = y >= drawingArea.top - 1 && y <= drawingArea.top + drawingArea.height;
|
|
164
|
-
if (options?.direction === 'x') {
|
|
165
|
-
return isInsideX;
|
|
166
|
-
}
|
|
167
|
-
if (options?.direction === 'y') {
|
|
168
|
-
return isInsideY;
|
|
169
|
-
}
|
|
170
|
-
return isInsideX && isInsideY;
|
|
171
|
-
}, [store.value]);
|
|
162
|
+
return isXInside(x) && isYInside(y);
|
|
163
|
+
}, [isXInside, isYInside]);
|
|
172
164
|
return {
|
|
173
165
|
instance: {
|
|
174
|
-
isPointInside
|
|
166
|
+
isPointInside,
|
|
167
|
+
isXInside,
|
|
168
|
+
isYInside
|
|
175
169
|
}
|
|
176
170
|
};
|
|
177
171
|
};
|
|
@@ -65,21 +65,24 @@ export interface UseChartDimensionsState {
|
|
|
65
65
|
export interface UseChartDimensionsInstance {
|
|
66
66
|
/**
|
|
67
67
|
* Checks if a point is inside the drawing area.
|
|
68
|
-
* @param {
|
|
69
|
-
* @param {number}
|
|
70
|
-
* @param {
|
|
71
|
-
* @param {Object} options The options of the check.
|
|
72
|
-
* @param {Element} [options.targetElement] The element to check if it is allowed to overflow the drawing area.
|
|
73
|
-
* @param {'x' | 'y'} [options.direction] The direction to check.
|
|
68
|
+
* @param {number} x The x coordinate of the point.
|
|
69
|
+
* @param {number} y The y coordinate of the point.
|
|
70
|
+
* @param {Element} targetElement The element to check if it is allowed to overflow the drawing area.
|
|
74
71
|
* @returns {boolean} `true` if the point is inside the drawing area, `false` otherwise.
|
|
75
72
|
*/
|
|
76
|
-
isPointInside: (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
isPointInside: (x: number, y: number, targetElement?: Element) => boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Checks if the x coordinate is inside the drawing area.
|
|
76
|
+
* @param {number} x The x coordinate of the point.
|
|
77
|
+
* @returns {boolean} `true` if the point is inside the drawing area, `false` otherwise.
|
|
78
|
+
*/
|
|
79
|
+
isXInside: (x: number) => boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Checks if the y coordinate is inside the drawing area.
|
|
82
|
+
* @param {number} y The y coordinate of the point.
|
|
83
|
+
* @returns {boolean} `true` if the point is inside the drawing area, `false` otherwise.
|
|
84
|
+
*/
|
|
85
|
+
isYInside: (y: number) => boolean;
|
|
83
86
|
}
|
|
84
87
|
export type UseChartDimensionsSignature = ChartPluginSignature<{
|
|
85
88
|
params: UseChartDimensionsParameters;
|
|
@@ -11,6 +11,7 @@ var _axis = require("../../../../models/axis");
|
|
|
11
11
|
var _colorScale = require("../../../colorScale");
|
|
12
12
|
var _ticks = require("../../../ticks");
|
|
13
13
|
var _getScale = require("../../../getScale");
|
|
14
|
+
var _dateHelpers = require("../../../dateHelpers");
|
|
14
15
|
var _zoom = require("./zoom");
|
|
15
16
|
var _getAxisExtremum = require("./getAxisExtremum");
|
|
16
17
|
var _getAxisTriggerTooltip = require("./getAxisTriggerTooltip");
|
|
@@ -20,13 +21,6 @@ axis) {
|
|
|
20
21
|
const range = axisDirection === 'x' ? [drawingArea.left, drawingArea.left + drawingArea.width] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
21
22
|
return axis.reverse ? [range[1], range[0]] : range;
|
|
22
23
|
}
|
|
23
|
-
const isDateData = data => data?.[0] instanceof Date;
|
|
24
|
-
function createDateFormatter(axis, range) {
|
|
25
|
-
const timeScale = (0, _d3Scale.scaleTime)(axis.data, range);
|
|
26
|
-
return (v, {
|
|
27
|
-
location
|
|
28
|
-
}) => location === 'tick' ? timeScale.tickFormat(axis.tickNumber)(v) : `${v.toLocaleString()}`;
|
|
29
|
-
}
|
|
30
24
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
31
25
|
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
32
26
|
function computeAxisValue({
|
|
@@ -77,8 +71,8 @@ function computeAxisValue({
|
|
|
77
71
|
values: axis.data
|
|
78
72
|
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
79
73
|
});
|
|
80
|
-
if (isDateData(axis.data)) {
|
|
81
|
-
const dateFormatter = createDateFormatter(axis, scaleRange);
|
|
74
|
+
if ((0, _dateHelpers.isDateData)(axis.data)) {
|
|
75
|
+
const dateFormatter = (0, _dateHelpers.createDateFormatter)(axis, scaleRange);
|
|
82
76
|
completeAxis[axis.id].valueFormatter = axis.valueFormatter ?? dateFormatter;
|
|
83
77
|
}
|
|
84
78
|
}
|
|
@@ -97,8 +91,8 @@ function computeAxisValue({
|
|
|
97
91
|
values: axis.data
|
|
98
92
|
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
99
93
|
});
|
|
100
|
-
if (isDateData(axis.data)) {
|
|
101
|
-
const dateFormatter = createDateFormatter(axis, scaleRange);
|
|
94
|
+
if ((0, _dateHelpers.isDateData)(axis.data)) {
|
|
95
|
+
const dateFormatter = (0, _dateHelpers.createDateFormatter)(axis, scaleRange);
|
|
102
96
|
completeAxis[axis.id].valueFormatter = axis.valueFormatter ?? dateFormatter;
|
|
103
97
|
}
|
|
104
98
|
}
|
|
@@ -7,9 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.defaultizeXAxis = defaultizeXAxis;
|
|
8
8
|
exports.defaultizeYAxis = defaultizeYAxis;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _constants = require("../../../constants");
|
|
11
10
|
var _defaultizeZoom = require("./defaultizeZoom");
|
|
12
|
-
var
|
|
11
|
+
var _constants = require("../../../../constants");
|
|
13
12
|
function defaultizeXAxis(inAxes, dataset) {
|
|
14
13
|
const offsets = {
|
|
15
14
|
top: 0,
|
|
@@ -17,7 +16,7 @@ function defaultizeXAxis(inAxes, dataset) {
|
|
|
17
16
|
none: 0
|
|
18
17
|
};
|
|
19
18
|
const inputAxes = inAxes && inAxes.length > 0 ? inAxes : [{
|
|
20
|
-
id:
|
|
19
|
+
id: _constants.DEFAULT_X_AXIS_KEY,
|
|
21
20
|
scaleType: 'linear'
|
|
22
21
|
}];
|
|
23
22
|
const parsedAxes = inputAxes.map((axisConfig, index) => {
|
|
@@ -26,7 +25,7 @@ function defaultizeXAxis(inAxes, dataset) {
|
|
|
26
25
|
// The first x-axis is defaultized to the bottom
|
|
27
26
|
const defaultPosition = index === 0 ? 'bottom' : 'none';
|
|
28
27
|
const position = axisConfig.position ?? defaultPosition;
|
|
29
|
-
const defaultHeight =
|
|
28
|
+
const defaultHeight = _constants.DEFAULT_AXIS_SIZE_HEIGHT + (axisConfig.label ? _constants.AXIS_LABEL_DEFAULT_HEIGHT : 0);
|
|
30
29
|
const id = axisConfig.id ?? `defaultized-x-axis-${index}`;
|
|
31
30
|
const sharedConfig = (0, _extends2.default)({
|
|
32
31
|
offset: offsets[position]
|
|
@@ -41,7 +40,7 @@ function defaultizeXAxis(inAxes, dataset) {
|
|
|
41
40
|
if (position !== 'none') {
|
|
42
41
|
offsets[position] += sharedConfig.height;
|
|
43
42
|
if (sharedConfig.zoom?.slider.enabled) {
|
|
44
|
-
offsets[position] +=
|
|
43
|
+
offsets[position] += sharedConfig.zoom.slider.size;
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
|
|
@@ -67,7 +66,7 @@ function defaultizeYAxis(inAxes, dataset) {
|
|
|
67
66
|
none: 0
|
|
68
67
|
};
|
|
69
68
|
const inputAxes = inAxes && inAxes.length > 0 ? inAxes : [{
|
|
70
|
-
id:
|
|
69
|
+
id: _constants.DEFAULT_Y_AXIS_KEY,
|
|
71
70
|
scaleType: 'linear'
|
|
72
71
|
}];
|
|
73
72
|
const parsedAxes = inputAxes.map((axisConfig, index) => {
|
|
@@ -76,7 +75,7 @@ function defaultizeYAxis(inAxes, dataset) {
|
|
|
76
75
|
// The first y-axis is defaultized to the left
|
|
77
76
|
const defaultPosition = index === 0 ? 'left' : 'none';
|
|
78
77
|
const position = axisConfig.position ?? defaultPosition;
|
|
79
|
-
const defaultWidth =
|
|
78
|
+
const defaultWidth = _constants.DEFAULT_AXIS_SIZE_WIDTH + (axisConfig.label ? _constants.AXIS_LABEL_DEFAULT_HEIGHT : 0);
|
|
80
79
|
const id = axisConfig.id ?? `defaultized-y-axis-${index}`;
|
|
81
80
|
const sharedConfig = (0, _extends2.default)({
|
|
82
81
|
offset: offsets[position]
|
|
@@ -91,7 +90,7 @@ function defaultizeYAxis(inAxes, dataset) {
|
|
|
91
90
|
if (position !== 'none') {
|
|
92
91
|
offsets[position] += sharedConfig.width;
|
|
93
92
|
if (sharedConfig.zoom?.slider.enabled) {
|
|
94
|
-
offsets[position] +=
|
|
93
|
+
offsets[position] += sharedConfig.zoom.slider.size;
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { AxisId } from "../../../../models/axis.js";
|
|
2
2
|
import { DefaultizedZoomOptions } from "./useChartCartesianAxis.types.js";
|
|
3
3
|
import { ZoomOptions } from "./zoom.types.js";
|
|
4
|
+
export declare const defaultZoomOptions: {
|
|
5
|
+
minStart: number;
|
|
6
|
+
maxEnd: number;
|
|
7
|
+
step: number;
|
|
8
|
+
minSpan: number;
|
|
9
|
+
maxSpan: number;
|
|
10
|
+
panning: true;
|
|
11
|
+
filterMode: "keep";
|
|
12
|
+
slider: {
|
|
13
|
+
enabled: false;
|
|
14
|
+
size: number;
|
|
15
|
+
showTooltip: import("./zoom.types.js").ZoomSliderShowTooltip;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
4
18
|
export declare const defaultizeZoom: (zoom: boolean | ZoomOptions | undefined, axisId: AxisId, axisDirection: "x" | "y") => DefaultizedZoomOptions | undefined;
|
|
@@ -4,9 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.defaultizeZoom = void 0;
|
|
7
|
+
exports.defaultizeZoom = exports.defaultZoomOptions = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
|
|
9
|
+
var _constants = require("../../../constants");
|
|
10
|
+
const defaultZoomOptions = exports.defaultZoomOptions = {
|
|
10
11
|
minStart: 0,
|
|
11
12
|
maxEnd: 100,
|
|
12
13
|
step: 5,
|
|
@@ -15,7 +16,9 @@ const defaultZoomOptions = {
|
|
|
15
16
|
panning: true,
|
|
16
17
|
filterMode: 'keep',
|
|
17
18
|
slider: {
|
|
18
|
-
enabled: false
|
|
19
|
+
enabled: false,
|
|
20
|
+
size: _constants.DEFAULT_ZOOM_SLIDER_SIZE,
|
|
21
|
+
showTooltip: _constants.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP
|
|
19
22
|
}
|
|
20
23
|
};
|
|
21
24
|
const defaultizeZoom = (zoom, axisId, axisDirection) => {
|
package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js
CHANGED
|
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.selectorChartTopAxisSize = exports.selectorChartRightAxisSize = exports.selectorChartLeftAxisSize = exports.selectorChartBottomAxisSize = void 0;
|
|
7
|
-
var _constants = require("../../../constants");
|
|
8
7
|
var _useChartCartesianAxisLayout = require("./useChartCartesianAxisLayout.selectors");
|
|
9
8
|
var _selectors = require("../../utils/selectors");
|
|
10
|
-
const selectorChartLeftAxisSize = exports.selectorChartLeftAxisSize = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'left' ? acc + (axis.width || 0) + (axis.zoom?.slider.enabled ?
|
|
11
|
-
const selectorChartRightAxisSize = exports.selectorChartRightAxisSize = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'right' ? acc + (axis.width || 0) + (axis.zoom?.slider.enabled ?
|
|
12
|
-
const selectorChartTopAxisSize = exports.selectorChartTopAxisSize = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'top' ? acc + (axis.height || 0) + (axis.zoom?.slider.enabled ?
|
|
13
|
-
const selectorChartBottomAxisSize = exports.selectorChartBottomAxisSize = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'bottom' ? acc + (axis.height || 0) + (axis.zoom?.slider.enabled ?
|
|
9
|
+
const selectorChartLeftAxisSize = exports.selectorChartLeftAxisSize = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'left' ? acc + (axis.width || 0) + (axis.zoom?.slider.enabled ? axis.zoom.slider.size : 0) : acc, 0));
|
|
10
|
+
const selectorChartRightAxisSize = exports.selectorChartRightAxisSize = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'right' ? acc + (axis.width || 0) + (axis.zoom?.slider.enabled ? axis.zoom.slider.size : 0) : acc, 0));
|
|
11
|
+
const selectorChartTopAxisSize = exports.selectorChartTopAxisSize = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'top' ? acc + (axis.height || 0) + (axis.zoom?.slider.enabled ? axis.zoom.slider.size : 0) : acc, 0));
|
|
12
|
+
const selectorChartBottomAxisSize = exports.selectorChartBottomAxisSize = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'bottom' ? acc + (axis.height || 0) + (axis.zoom?.slider.enabled ? axis.zoom.slider.size : 0) : acc, 0));
|
|
@@ -78,9 +78,7 @@ const useChartCartesianAxis = ({
|
|
|
78
78
|
const handleMove = event => {
|
|
79
79
|
const target = 'targetTouches' in event ? event.targetTouches[0] : event;
|
|
80
80
|
const svgPoint = (0, _getSVGPoint.getSVGPoint)(element, target);
|
|
81
|
-
if (!instance.isPointInside(svgPoint, {
|
|
82
|
-
targetElement: event.target
|
|
83
|
-
})) {
|
|
81
|
+
if (!instance.isPointInside(svgPoint.x, svgPoint.y, event.target)) {
|
|
84
82
|
instance.cleanInteraction?.();
|
|
85
83
|
return;
|
|
86
84
|
}
|
package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ChartPluginSignature } from "../../models/index.js";
|
|
|
2
2
|
import type { ChartSeriesType, DatasetType } from "../../../../models/seriesType/config.js";
|
|
3
3
|
import type { ComputedAxis, ScaleName, AxisId, ChartsAxisData, YAxis, XAxis, DefaultedXAxis, DefaultedYAxis } from "../../../../models/axis.js";
|
|
4
4
|
import type { UseChartSeriesSignature } from "../../corePlugins/useChartSeries/index.js";
|
|
5
|
-
import type { ZoomData, ZoomOptions } from "./zoom.types.js";
|
|
5
|
+
import type { ZoomData, ZoomOptions, ZoomSliderShowTooltip } from "./zoom.types.js";
|
|
6
6
|
import type { UseChartInteractionSignature } from "../useChartInteraction/index.js";
|
|
7
7
|
import type { ChartsAxisProps } from "../../../../ChartsAxis/index.js";
|
|
8
8
|
/**
|
|
@@ -47,10 +47,13 @@ export type UseChartCartesianAxisDefaultizedParameters<S extends ScaleName = Sca
|
|
|
47
47
|
defaultizedXAxis: DefaultedXAxis<S>[];
|
|
48
48
|
defaultizedYAxis: DefaultedYAxis<S>[];
|
|
49
49
|
};
|
|
50
|
+
export interface DefaultedZoomSliderOptions extends Omit<NonNullable<Required<ZoomOptions['slider']>>, 'showTooltip'> {
|
|
51
|
+
showTooltip: ZoomSliderShowTooltip;
|
|
52
|
+
}
|
|
50
53
|
export interface DefaultizedZoomOptions extends Required<Omit<ZoomOptions, 'slider'>> {
|
|
51
54
|
axisId: AxisId;
|
|
52
55
|
axisDirection: 'x' | 'y';
|
|
53
|
-
slider:
|
|
56
|
+
slider: DefaultedZoomSliderOptions;
|
|
54
57
|
}
|
|
55
58
|
export interface UseChartCartesianAxisState {
|
|
56
59
|
/**
|
|
@@ -3238,4 +3238,87 @@ export declare const selectorChartYAxis: ((state: import("../../corePlugins/useC
|
|
|
3238
3238
|
} & {
|
|
3239
3239
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
3240
3240
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
3241
|
+
};
|
|
3242
|
+
export declare const selectorChartRawAxis: ((state: any, axisId: AxisId) => import("../../../index.js").DefaultedXAxis | import("../../../index.js").DefaultedYAxis | undefined) & {
|
|
3243
|
+
clearCache: () => void;
|
|
3244
|
+
resultsCount: () => number;
|
|
3245
|
+
resetResultsCount: () => void;
|
|
3246
|
+
} & {
|
|
3247
|
+
resultFunc: (resultFuncArgs_0: import("../../../index.js").DefaultedXAxis[] | undefined, resultFuncArgs_1: import("../../../index.js").DefaultedYAxis[] | undefined, resultFuncArgs_2: AxisId) => import("../../../index.js").DefaultedXAxis | import("../../../index.js").DefaultedYAxis | undefined;
|
|
3248
|
+
memoizedResultFunc: ((resultFuncArgs_0: import("../../../index.js").DefaultedXAxis[] | undefined, resultFuncArgs_1: import("../../../index.js").DefaultedYAxis[] | undefined, resultFuncArgs_2: AxisId) => import("../../../index.js").DefaultedXAxis | import("../../../index.js").DefaultedYAxis | undefined) & {
|
|
3249
|
+
clearCache: () => void;
|
|
3250
|
+
resultsCount: () => number;
|
|
3251
|
+
resetResultsCount: () => void;
|
|
3252
|
+
};
|
|
3253
|
+
lastResult: () => import("../../../index.js").DefaultedXAxis | import("../../../index.js").DefaultedYAxis | undefined;
|
|
3254
|
+
dependencies: [((state: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
3255
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
3256
|
+
}) => import("../../../index.js").DefaultedXAxis[] | undefined) & {
|
|
3257
|
+
clearCache: () => void;
|
|
3258
|
+
resultsCount: () => number;
|
|
3259
|
+
resetResultsCount: () => void;
|
|
3260
|
+
} & {
|
|
3261
|
+
resultFunc: (resultFuncArgs_0: {
|
|
3262
|
+
x: import("../../../index.js").DefaultedXAxis[];
|
|
3263
|
+
y: import("../../../index.js").DefaultedYAxis[];
|
|
3264
|
+
} | undefined) => import("../../../index.js").DefaultedXAxis[] | undefined;
|
|
3265
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
3266
|
+
x: import("../../../index.js").DefaultedXAxis[];
|
|
3267
|
+
y: import("../../../index.js").DefaultedYAxis[];
|
|
3268
|
+
} | undefined) => import("../../../index.js").DefaultedXAxis[] | undefined) & {
|
|
3269
|
+
clearCache: () => void;
|
|
3270
|
+
resultsCount: () => number;
|
|
3271
|
+
resetResultsCount: () => void;
|
|
3272
|
+
};
|
|
3273
|
+
lastResult: () => import("../../../index.js").DefaultedXAxis[] | undefined;
|
|
3274
|
+
dependencies: [(state: ChartState<[], [UseChartCartesianAxisSignature]>) => {
|
|
3275
|
+
x: import("../../../index.js").DefaultedXAxis[];
|
|
3276
|
+
y: import("../../../index.js").DefaultedYAxis[];
|
|
3277
|
+
} | undefined];
|
|
3278
|
+
recomputations: () => number;
|
|
3279
|
+
resetRecomputations: () => void;
|
|
3280
|
+
dependencyRecomputations: () => number;
|
|
3281
|
+
resetDependencyRecomputations: () => void;
|
|
3282
|
+
} & {
|
|
3283
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
3284
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
3285
|
+
}, ((state: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
3286
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
3287
|
+
}) => import("../../../index.js").DefaultedYAxis[] | undefined) & {
|
|
3288
|
+
clearCache: () => void;
|
|
3289
|
+
resultsCount: () => number;
|
|
3290
|
+
resetResultsCount: () => void;
|
|
3291
|
+
} & {
|
|
3292
|
+
resultFunc: (resultFuncArgs_0: {
|
|
3293
|
+
x: import("../../../index.js").DefaultedXAxis[];
|
|
3294
|
+
y: import("../../../index.js").DefaultedYAxis[];
|
|
3295
|
+
} | undefined) => import("../../../index.js").DefaultedYAxis[] | undefined;
|
|
3296
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
3297
|
+
x: import("../../../index.js").DefaultedXAxis[];
|
|
3298
|
+
y: import("../../../index.js").DefaultedYAxis[];
|
|
3299
|
+
} | undefined) => import("../../../index.js").DefaultedYAxis[] | undefined) & {
|
|
3300
|
+
clearCache: () => void;
|
|
3301
|
+
resultsCount: () => number;
|
|
3302
|
+
resetResultsCount: () => void;
|
|
3303
|
+
};
|
|
3304
|
+
lastResult: () => import("../../../index.js").DefaultedYAxis[] | undefined;
|
|
3305
|
+
dependencies: [(state: ChartState<[], [UseChartCartesianAxisSignature]>) => {
|
|
3306
|
+
x: import("../../../index.js").DefaultedXAxis[];
|
|
3307
|
+
y: import("../../../index.js").DefaultedYAxis[];
|
|
3308
|
+
} | undefined];
|
|
3309
|
+
recomputations: () => number;
|
|
3310
|
+
resetRecomputations: () => void;
|
|
3311
|
+
dependencyRecomputations: () => number;
|
|
3312
|
+
resetDependencyRecomputations: () => void;
|
|
3313
|
+
} & {
|
|
3314
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
3315
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
3316
|
+
}, (state: any, axisId: AxisId) => AxisId];
|
|
3317
|
+
recomputations: () => number;
|
|
3318
|
+
resetRecomputations: () => void;
|
|
3319
|
+
dependencyRecomputations: () => number;
|
|
3320
|
+
resetDependencyRecomputations: () => void;
|
|
3321
|
+
} & {
|
|
3322
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
3323
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
3241
3324
|
};
|