@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
|
@@ -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>];
|
|
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
6
6
|
import ownerWindow from '@mui/utils/ownerWindow';
|
|
7
|
+
import { useSelector } from "../../../store/useSelector.js";
|
|
7
8
|
import { DEFAULT_MARGINS } from "../../../../constants/index.js";
|
|
8
9
|
import { selectorChartDrawingArea } from "./useChartDimensions.selectors.js";
|
|
9
10
|
import { defaultizeMargin } from "../../../defaultizeMargin.js";
|
|
@@ -143,28 +144,21 @@ export const useChartDimensions = ({
|
|
|
143
144
|
stateRef.current.displayError = false;
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
const drawingArea = useSelector(store, selectorChartDrawingArea);
|
|
148
|
+
const isXInside = React.useCallback(x => x >= drawingArea.left - 1 && x <= drawingArea.left + drawingArea.width, [drawingArea.left, drawingArea.width]);
|
|
149
|
+
const isYInside = React.useCallback(y => y >= drawingArea.top - 1 && y <= drawingArea.top + drawingArea.height, [drawingArea.height, drawingArea.top]);
|
|
150
|
+
const isPointInside = React.useCallback((x, y, targetElement) => {
|
|
150
151
|
// For element allowed to overflow, wrapping them in <g data-drawing-container /> make them fully part of the drawing area.
|
|
151
|
-
if (
|
|
152
|
+
if (targetElement && targetElement.closest('[data-drawing-container]')) {
|
|
152
153
|
return true;
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const isInsideY = y >= drawingArea.top - 1 && y <= drawingArea.top + drawingArea.height;
|
|
157
|
-
if (options?.direction === 'x') {
|
|
158
|
-
return isInsideX;
|
|
159
|
-
}
|
|
160
|
-
if (options?.direction === 'y') {
|
|
161
|
-
return isInsideY;
|
|
162
|
-
}
|
|
163
|
-
return isInsideX && isInsideY;
|
|
164
|
-
}, [store.value]);
|
|
155
|
+
return isXInside(x) && isYInside(y);
|
|
156
|
+
}, [isXInside, isYInside]);
|
|
165
157
|
return {
|
|
166
158
|
instance: {
|
|
167
|
-
isPointInside
|
|
159
|
+
isPointInside,
|
|
160
|
+
isXInside,
|
|
161
|
+
isYInside
|
|
168
162
|
}
|
|
169
163
|
};
|
|
170
164
|
};
|
|
@@ -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;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { scaleBand, scalePoint
|
|
2
|
+
import { scaleBand, scalePoint } from '@mui/x-charts-vendor/d3-scale';
|
|
3
3
|
import { isBandScaleConfig, isPointScaleConfig } from "../../../../models/axis.js";
|
|
4
4
|
import { getColorScale, getOrdinalColorScale } from "../../../colorScale.js";
|
|
5
5
|
import { getTickNumber, scaleTickNumberByRange } from "../../../ticks.js";
|
|
6
6
|
import { getScale } from "../../../getScale.js";
|
|
7
|
+
import { isDateData, createDateFormatter } from "../../../dateHelpers.js";
|
|
7
8
|
import { zoomScaleRange } from "./zoom.js";
|
|
8
9
|
import { getAxisExtremum } from "./getAxisExtremum.js";
|
|
9
10
|
import { getAxisTriggerTooltip } from "./getAxisTriggerTooltip.js";
|
|
@@ -13,13 +14,6 @@ axis) {
|
|
|
13
14
|
const range = axisDirection === 'x' ? [drawingArea.left, drawingArea.left + drawingArea.width] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
14
15
|
return axis.reverse ? [range[1], range[0]] : range;
|
|
15
16
|
}
|
|
16
|
-
const isDateData = data => data?.[0] instanceof Date;
|
|
17
|
-
function createDateFormatter(axis, range) {
|
|
18
|
-
const timeScale = scaleTime(axis.data, range);
|
|
19
|
-
return (v, {
|
|
20
|
-
location
|
|
21
|
-
}) => location === 'tick' ? timeScale.tickFormat(axis.tickNumber)(v) : `${v.toLocaleString()}`;
|
|
22
|
-
}
|
|
23
17
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
24
18
|
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
25
19
|
export function computeAxisValue({
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { ZOOM_SLIDER_SIZE } from "../../../constants.js";
|
|
3
2
|
import { defaultizeZoom } from "./defaultizeZoom.js";
|
|
4
3
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY, DEFAULT_AXIS_SIZE_HEIGHT, DEFAULT_AXIS_SIZE_WIDTH, AXIS_LABEL_DEFAULT_HEIGHT } from "../../../../constants/index.js";
|
|
5
4
|
export function defaultizeXAxis(inAxes, dataset) {
|
|
@@ -33,7 +32,7 @@ export function defaultizeXAxis(inAxes, dataset) {
|
|
|
33
32
|
if (position !== 'none') {
|
|
34
33
|
offsets[position] += sharedConfig.height;
|
|
35
34
|
if (sharedConfig.zoom?.slider.enabled) {
|
|
36
|
-
offsets[position] +=
|
|
35
|
+
offsets[position] += sharedConfig.zoom.slider.size;
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
|
|
@@ -83,7 +82,7 @@ export function defaultizeYAxis(inAxes, dataset) {
|
|
|
83
82
|
if (position !== 'none') {
|
|
84
83
|
offsets[position] += sharedConfig.width;
|
|
85
84
|
if (sharedConfig.zoom?.slider.enabled) {
|
|
86
|
-
offsets[position] +=
|
|
85
|
+
offsets[position] += sharedConfig.zoom.slider.size;
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
88
|
|
|
@@ -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;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
|
|
2
|
+
import { DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP, DEFAULT_ZOOM_SLIDER_SIZE } from "../../../constants.js";
|
|
3
|
+
export const defaultZoomOptions = {
|
|
3
4
|
minStart: 0,
|
|
4
5
|
maxEnd: 100,
|
|
5
6
|
step: 5,
|
|
@@ -8,7 +9,9 @@ const defaultZoomOptions = {
|
|
|
8
9
|
panning: true,
|
|
9
10
|
filterMode: 'keep',
|
|
10
11
|
slider: {
|
|
11
|
-
enabled: false
|
|
12
|
+
enabled: false,
|
|
13
|
+
size: DEFAULT_ZOOM_SLIDER_SIZE,
|
|
14
|
+
showTooltip: DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP
|
|
12
15
|
}
|
|
13
16
|
};
|
|
14
17
|
export const defaultizeZoom = (zoom, axisId, axisDirection) => {
|
package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ZOOM_SLIDER_SIZE } from "../../../constants.js";
|
|
2
1
|
import { selectorChartRawXAxis, selectorChartRawYAxis } from "./useChartCartesianAxisLayout.selectors.js";
|
|
3
2
|
import { createSelector } from "../../utils/selectors.js";
|
|
4
|
-
export const selectorChartLeftAxisSize = createSelector([selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'left' ? acc + (axis.width || 0) + (axis.zoom?.slider.enabled ?
|
|
5
|
-
export const selectorChartRightAxisSize = createSelector([selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'right' ? acc + (axis.width || 0) + (axis.zoom?.slider.enabled ?
|
|
6
|
-
export const selectorChartTopAxisSize = createSelector([selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'top' ? acc + (axis.height || 0) + (axis.zoom?.slider.enabled ?
|
|
7
|
-
export const selectorChartBottomAxisSize = createSelector([selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'bottom' ? acc + (axis.height || 0) + (axis.zoom?.slider.enabled ?
|
|
3
|
+
export const selectorChartLeftAxisSize = createSelector([selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'left' ? acc + (axis.width || 0) + (axis.zoom?.slider.enabled ? axis.zoom.slider.size : 0) : acc, 0));
|
|
4
|
+
export const selectorChartRightAxisSize = createSelector([selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'right' ? acc + (axis.width || 0) + (axis.zoom?.slider.enabled ? axis.zoom.slider.size : 0) : acc, 0));
|
|
5
|
+
export const selectorChartTopAxisSize = createSelector([selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'top' ? acc + (axis.height || 0) + (axis.zoom?.slider.enabled ? axis.zoom.slider.size : 0) : acc, 0));
|
|
6
|
+
export const selectorChartBottomAxisSize = createSelector([selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'bottom' ? acc + (axis.height || 0) + (axis.zoom?.slider.enabled ? axis.zoom.slider.size : 0) : acc, 0));
|
|
@@ -71,9 +71,7 @@ export const useChartCartesianAxis = ({
|
|
|
71
71
|
const handleMove = event => {
|
|
72
72
|
const target = 'targetTouches' in event ? event.targetTouches[0] : event;
|
|
73
73
|
const svgPoint = getSVGPoint(element, target);
|
|
74
|
-
if (!instance.isPointInside(svgPoint, {
|
|
75
|
-
targetElement: event.target
|
|
76
|
-
})) {
|
|
74
|
+
if (!instance.isPointInside(svgPoint.x, svgPoint.y, event.target)) {
|
|
77
75
|
instance.cleanInteraction?.();
|
|
78
76
|
return;
|
|
79
77
|
}
|
package/esm/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
|
};
|
|
@@ -87,4 +87,11 @@ export const selectorChartYAxis = createSelector([selectorChartRawYAxis, selecto
|
|
|
87
87
|
zoomMap,
|
|
88
88
|
zoomOptions,
|
|
89
89
|
getFilters
|
|
90
|
-
}));
|
|
90
|
+
}));
|
|
91
|
+
export const selectorChartRawAxis = createSelector([selectorChartRawXAxis, selectorChartRawYAxis, (state, axisId) => axisId], (xAxes, yAxes, axisId) => {
|
|
92
|
+
const axis = xAxes?.find(a => a.id === axisId) ?? yAxes?.find(a => a.id === axisId) ?? null;
|
|
93
|
+
if (!axis) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
return axis;
|
|
97
|
+
});
|
|
@@ -15,6 +15,7 @@ export type ZoomData = {
|
|
|
15
15
|
end: number;
|
|
16
16
|
};
|
|
17
17
|
export type ZoomFilterMode = 'keep' | 'discard';
|
|
18
|
+
export type ZoomSliderShowTooltip = 'always' | 'hover' | 'never';
|
|
18
19
|
export interface ZoomOptions {
|
|
19
20
|
/**
|
|
20
21
|
* The starting percentage of the zoom range. In the range of 0 to 100.
|
|
@@ -77,6 +78,22 @@ export interface ZoomSliderOptions {
|
|
|
77
78
|
* If `true`, the slider will be shown.
|
|
78
79
|
*/
|
|
79
80
|
enabled?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The size reserved for the zoom slider. The actual size of the slider might be smaller, so
|
|
83
|
+
* increasing this value effectively increases the margin around the slider.
|
|
84
|
+
* This means the height for the x-axis and the width for the y-axis.
|
|
85
|
+
*
|
|
86
|
+
* @default 28
|
|
87
|
+
*/
|
|
88
|
+
size?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Defines when the tooltip with the zoom values should be shown.
|
|
91
|
+
* - 'always': The tooltip is always shown.
|
|
92
|
+
* - 'hover': The tooltip is shown when hovering over the track or thumb.
|
|
93
|
+
* - 'never': The tooltip is never shown.
|
|
94
|
+
* @default 'hover'
|
|
95
|
+
*/
|
|
96
|
+
showTooltip?: ZoomSliderShowTooltip;
|
|
80
97
|
}
|
|
81
98
|
export type ZoomAxisFilters = Record<AxisId, ExtremumFilter>;
|
|
82
99
|
export type GetZoomAxisFilters = (params: {
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { useAssertModelConsistency } from '@mui/x-internals/useAssertModelConsistency';
|
|
3
3
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
4
4
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
5
|
+
import { fastObjectShallowCompare } from '@mui/x-internals/fastObjectShallowCompare';
|
|
5
6
|
export const useChartHighlight = ({
|
|
6
7
|
store,
|
|
7
8
|
params
|
|
@@ -29,6 +30,10 @@ export const useChartHighlight = ({
|
|
|
29
30
|
}));
|
|
30
31
|
});
|
|
31
32
|
const setHighlight = useEventCallback(newItem => {
|
|
33
|
+
const prevItem = store.getSnapshot().highlight.item;
|
|
34
|
+
if (fastObjectShallowCompare(prevItem, newItem)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
32
37
|
params.onHighlightChange?.(newItem);
|
|
33
38
|
store.update(prev => _extends({}, prev, {
|
|
34
39
|
highlight: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
3
|
+
import { fastObjectShallowCompare } from '@mui/x-internals/fastObjectShallowCompare';
|
|
3
4
|
export const useChartInteraction = ({
|
|
4
5
|
store
|
|
5
6
|
}) => {
|
|
@@ -36,11 +37,16 @@ export const useChartInteraction = ({
|
|
|
36
37
|
});
|
|
37
38
|
});
|
|
38
39
|
const setItemInteraction = useEventCallback(newItem => {
|
|
39
|
-
store.update(prev =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
40
|
+
store.update(prev => {
|
|
41
|
+
if (fastObjectShallowCompare(prev.interaction.item, newItem)) {
|
|
42
|
+
return prev;
|
|
43
|
+
}
|
|
44
|
+
return _extends({}, prev, {
|
|
45
|
+
interaction: _extends({}, prev.interaction, {
|
|
46
|
+
item: newItem
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
});
|
|
44
50
|
});
|
|
45
51
|
const setPointerCoordinate = useEventCallback(coordinate => {
|
|
46
52
|
store.update(prev => _extends({}, prev, {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { scaleBand, scalePoint
|
|
2
|
+
import { scaleBand, scalePoint } from '@mui/x-charts-vendor/d3-scale';
|
|
3
3
|
import { isBandScaleConfig, isPointScaleConfig } from "../../../../models/axis.js";
|
|
4
4
|
import { getColorScale, getOrdinalColorScale } from "../../../colorScale.js";
|
|
5
5
|
import { getTickNumber, scaleTickNumberByRange } from "../../../ticks.js";
|
|
6
6
|
import { getScale } from "../../../getScale.js";
|
|
7
|
+
import { isDateData, createDateFormatter } from "../../../dateHelpers.js";
|
|
7
8
|
import { getAxisExtremum } from "./getAxisExtremum.js";
|
|
8
9
|
import { deg2rad } from "../../../angleConversion.js";
|
|
9
10
|
import { getAxisTriggerTooltip } from "./getAxisTriggerTooltip.js";
|
|
@@ -22,13 +23,6 @@ function getRange(drawingArea, axisDirection, axis) {
|
|
|
22
23
|
}
|
|
23
24
|
return [0, Math.min(drawingArea.height, drawingArea.width) / 2];
|
|
24
25
|
}
|
|
25
|
-
const isDateData = data => data?.[0] instanceof Date;
|
|
26
|
-
function createDateFormatter(axis, range) {
|
|
27
|
-
const timeScale = scaleTime(axis.data, range);
|
|
28
|
-
return (v, {
|
|
29
|
-
location
|
|
30
|
-
}) => location === 'tick' ? timeScale.tickFormat(axis.tickNumber)(v) : `${v.toLocaleString()}`;
|
|
31
|
-
}
|
|
32
26
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
33
27
|
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
34
28
|
export function computeAxisValue({
|
|
@@ -97,9 +97,7 @@ export const useChartPolarAxis = ({
|
|
|
97
97
|
mousePosition.current.y = svgPoint.y;
|
|
98
98
|
|
|
99
99
|
// Test if it's in the drawing area
|
|
100
|
-
if (!instance.isPointInside(svgPoint, {
|
|
101
|
-
targetElement: event.target
|
|
102
|
-
})) {
|
|
100
|
+
if (!instance.isPointInside(svgPoint.x, svgPoint.y, event.target)) {
|
|
103
101
|
if (mousePosition.current.isInChart) {
|
|
104
102
|
instance?.cleanInteraction();
|
|
105
103
|
mousePosition.current.isInChart = false;
|
|
@@ -71,10 +71,7 @@ export const useChartVoronoi = ({
|
|
|
71
71
|
}) => {
|
|
72
72
|
const pointX = getXPosition(x);
|
|
73
73
|
const pointY = getYPosition(y);
|
|
74
|
-
if (!instance.isPointInside({
|
|
75
|
-
x: pointX,
|
|
76
|
-
y: pointY
|
|
77
|
-
})) {
|
|
74
|
+
if (!instance.isPointInside(pointX, pointY)) {
|
|
78
75
|
// If the point is not displayed we move them to a trash coordinate.
|
|
79
76
|
// This avoids managing index mapping before/after filtering.
|
|
80
77
|
// The trash point is far enough such that any point in the drawing area will be closer to the mouse than the trash coordinate.
|
|
@@ -100,7 +97,7 @@ export const useChartVoronoi = ({
|
|
|
100
97
|
function getClosestPoint(event) {
|
|
101
98
|
// Get mouse coordinate in global SVG space
|
|
102
99
|
const svgPoint = getSVGPoint(element, event);
|
|
103
|
-
if (!instance.isPointInside(svgPoint)) {
|
|
100
|
+
if (!instance.isPointInside(svgPoint.x, svgPoint.y)) {
|
|
104
101
|
lastFind.current = undefined;
|
|
105
102
|
return 'outside-chart';
|
|
106
103
|
}
|
package/esm/models/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./seriesType/index.js";
|
|
2
2
|
export * from "./stacking.js";
|
|
3
|
+
export * from "./slots/index.js";
|
|
3
4
|
export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis } from "./axis.js";
|
|
4
5
|
export type { PropsFromSlot } from '@mui/x-internals/slots';
|
|
5
6
|
export type { Position } from "./position.js";
|
|
6
|
-
export type { CurveType } from "./curve.js";
|
|
7
|
-
export type { ChartBaseCommonProps, ChartBaseIconProps, ChartsIconSlots, ChartsBaseSlots } from "./slots/index.js";
|
|
7
|
+
export type { CurveType } from "./curve.js";
|
package/esm/models/index.js
CHANGED
package/hooks/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./useScatterSeries.js";
|
|
|
10
10
|
export * from "./usePieSeries.js";
|
|
11
11
|
export * from "./useBarSeries.js";
|
|
12
12
|
export * from "./useLineSeries.js";
|
|
13
|
+
export * from "./useRadarSeries.js";
|
|
13
14
|
export * from "./useItemHighlighted.js";
|
|
14
15
|
export * from "./useItemHighlightedGetter.js";
|
|
15
16
|
export * from "./useLegend.js";
|
package/hooks/index.js
CHANGED
|
@@ -163,6 +163,18 @@ Object.keys(_useLineSeries).forEach(function (key) {
|
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
165
|
});
|
|
166
|
+
var _useRadarSeries = require("./useRadarSeries");
|
|
167
|
+
Object.keys(_useRadarSeries).forEach(function (key) {
|
|
168
|
+
if (key === "default" || key === "__esModule") return;
|
|
169
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
170
|
+
if (key in exports && exports[key] === _useRadarSeries[key]) return;
|
|
171
|
+
Object.defineProperty(exports, key, {
|
|
172
|
+
enumerable: true,
|
|
173
|
+
get: function () {
|
|
174
|
+
return _useRadarSeries[key];
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
});
|
|
166
178
|
var _useItemHighlighted = require("./useItemHighlighted");
|
|
167
179
|
Object.keys(_useItemHighlighted).forEach(function (key) {
|
|
168
180
|
if (key === "default" || key === "__esModule") return;
|
package/hooks/useTicks.js
CHANGED
|
@@ -78,12 +78,8 @@ function useTicks(options) {
|
|
|
78
78
|
for (let i = 0; i < ticks.length; i += 1) {
|
|
79
79
|
const value = ticks[i];
|
|
80
80
|
const offset = scale(value);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
y: offset
|
|
84
|
-
}, {
|
|
85
|
-
direction
|
|
86
|
-
})) {
|
|
81
|
+
const isInside = direction === 'x' ? instance.isXInside(offset) : instance.isYInside(offset);
|
|
82
|
+
if (isInside) {
|
|
87
83
|
visibleTicks.push({
|
|
88
84
|
value,
|
|
89
85
|
formattedValue: valueFormatter?.(value, {
|
package/index.js
CHANGED
package/internals/constants.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { ZoomSliderShowTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/zoom.types.js";
|
|
1
2
|
/** Margin in the opposite direction of the axis, i.e., horizontal if the axis is vertical and vice versa. */
|
|
2
3
|
export declare const ZOOM_SLIDER_MARGIN = 4;
|
|
3
4
|
/** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const DEFAULT_ZOOM_SLIDER_SIZE: number;
|
|
6
|
+
export declare const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP: ZoomSliderShowTooltip;
|
package/internals/constants.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.ZOOM_SLIDER_MARGIN = exports.DEFAULT_ZOOM_SLIDER_SIZE = exports.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = void 0;
|
|
7
7
|
/** Margin in the opposite direction of the axis, i.e., horizontal if the axis is vertical and vice versa. */
|
|
8
8
|
const ZOOM_SLIDER_MARGIN = exports.ZOOM_SLIDER_MARGIN = 4;
|
|
9
9
|
|
|
10
10
|
/** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
|
|
11
|
-
const
|
|
11
|
+
const DEFAULT_ZOOM_SLIDER_SIZE = exports.DEFAULT_ZOOM_SLIDER_SIZE = 20 + 2 * ZOOM_SLIDER_MARGIN;
|
|
12
|
+
const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = exports.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = 'hover';
|
|
@@ -102,4 +102,5 @@ const consumeSlots = (name, slotPropName, options, InComponent) => {
|
|
|
102
102
|
}
|
|
103
103
|
return /*#__PURE__*/React.forwardRef(ConsumeSlotsInternal);
|
|
104
104
|
};
|
|
105
|
-
exports.consumeSlots = consumeSlots;
|
|
105
|
+
exports.consumeSlots = consumeSlots;
|
|
106
|
+
if (process.env.NODE_ENV !== "production") consumeSlots.displayName = "consumeSlots";
|
|
@@ -67,6 +67,7 @@ const consumeThemeProps = (name, options, InComponent) => /*#__PURE__*/React.for
|
|
|
67
67
|
const theme = (0, _styles.useTheme)();
|
|
68
68
|
const classes = options.classesResolver?.(outProps, theme);
|
|
69
69
|
const OutComponent = /*#__PURE__*/React.forwardRef(InComponent);
|
|
70
|
+
if (process.env.NODE_ENV !== "production") OutComponent.displayName = "OutComponent";
|
|
70
71
|
if (process.env.NODE_ENV !== 'production') {
|
|
71
72
|
OutComponent.displayName = `consumeThemeProps(${name})`;
|
|
72
73
|
}
|
|
@@ -75,4 +76,5 @@ const consumeThemeProps = (name, options, InComponent) => /*#__PURE__*/React.for
|
|
|
75
76
|
ref: ref
|
|
76
77
|
}));
|
|
77
78
|
});
|
|
78
|
-
exports.consumeThemeProps = consumeThemeProps;
|
|
79
|
+
exports.consumeThemeProps = consumeThemeProps;
|
|
80
|
+
if (process.env.NODE_ENV !== "production") consumeThemeProps.displayName = "consumeThemeProps";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AxisConfig } from "../models/index.js";
|
|
2
|
+
import { ChartsAxisProps } from "../models/axis.js";
|
|
3
|
+
/**
|
|
4
|
+
* Checks if the provided data array contains Date objects.
|
|
5
|
+
* @param data The data array to check.
|
|
6
|
+
* @returns A type predicate indicating if the data is an array of Date objects.
|
|
7
|
+
*/
|
|
8
|
+
export declare const isDateData: (data?: readonly any[]) => data is Date[];
|
|
9
|
+
/**
|
|
10
|
+
* Creates a formatter function for date values.
|
|
11
|
+
* @param axis The axis configuration.
|
|
12
|
+
* @param range The range for the time scale.
|
|
13
|
+
* @returns A formatter function for date values.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createDateFormatter(axis: AxisConfig<'band' | 'point', any, ChartsAxisProps>, range: number[]): AxisConfig<'band' | 'point', any, ChartsAxisProps>['valueFormatter'];
|