@mui/x-charts 8.3.0 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.js +3 -2
- package/CHANGELOG.md +206 -10
- package/ChartContainer/ChartContainer.js +1 -1
- package/ChartsAxis/axisClasses.d.ts +5 -0
- package/ChartsAxis/axisClasses.js +1 -1
- package/ChartsGrid/ChartsHorizontalGrid.js +2 -1
- package/ChartsGrid/ChartsVerticalGrid.js +2 -1
- package/ChartsLegend/ChartsLegend.js +1 -0
- package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
- package/ChartsSurface/ChartsSurface.js +1 -0
- package/ChartsXAxis/ChartsXAxis.js +9 -17
- package/ChartsYAxis/ChartsYAxis.js +6 -9
- 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.js +3 -2
- package/LineChart/LineHighlightPlot.js +1 -4
- package/LineChart/MarkPlot.js +1 -4
- package/PieChart/PieArc.js +1 -0
- package/PieChart/PieArcLabel.js +1 -0
- package/PieChart/PieChart.js +7 -6
- package/RadarChart/RadarChart.js +3 -2
- package/ScatterChart/Scatter.js +3 -11
- package/ScatterChart/ScatterChart.js +5 -4
- package/SparkLineChart/SparkLineChart.js +31 -26
- package/Toolbar/ToolbarButton.js +1 -0
- package/context/ChartProvider/ChartContext.js +1 -3
- package/esm/BarChart/BarChart.js +3 -2
- package/esm/ChartContainer/ChartContainer.js +1 -1
- package/esm/ChartsAxis/axisClasses.d.ts +5 -0
- package/esm/ChartsAxis/axisClasses.js +1 -1
- package/esm/ChartsGrid/ChartsHorizontalGrid.js +2 -1
- package/esm/ChartsGrid/ChartsVerticalGrid.js +2 -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 +9 -17
- package/esm/ChartsYAxis/ChartsYAxis.js +6 -9
- 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.js +3 -2
- package/esm/LineChart/LineHighlightPlot.js +1 -4
- package/esm/LineChart/MarkPlot.js +1 -4
- package/esm/PieChart/PieArc.js +1 -0
- package/esm/PieChart/PieArcLabel.js +1 -0
- package/esm/PieChart/PieChart.js +5 -4
- package/esm/RadarChart/RadarChart.js +3 -2
- package/esm/ScatterChart/Scatter.js +3 -11
- package/esm/ScatterChart/ScatterChart.js +5 -4
- package/esm/SparkLineChart/SparkLineChart.js +31 -26
- package/esm/Toolbar/ToolbarButton.js +1 -0
- package/esm/context/ChartProvider/ChartContext.js +1 -3
- package/esm/hooks/useTicks.d.ts +1 -4
- package/esm/hooks/useTicks.js +29 -28
- package/esm/index.js +1 -1
- package/esm/internals/constants.d.ts +1 -1
- package/esm/internals/constants.js +1 -1
- package/esm/internals/consumeSlots.js +2 -1
- package/esm/internals/consumeThemeProps.js +3 -1
- 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 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +3 -1
- 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/zoom.types.d.ts +8 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
- package/esm/internals/ticks.d.ts +6 -0
- package/esm/internals/ticks.js +22 -0
- package/hooks/useTicks.d.ts +1 -4
- package/hooks/useTicks.js +29 -29
- package/index.js +1 -1
- package/internals/constants.d.ts +1 -1
- package/internals/constants.js +2 -2
- package/internals/consumeSlots.js +2 -1
- package/internals/consumeThemeProps.js +3 -1
- 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 +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +7 -8
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +8 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +3 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
- package/internals/ticks.d.ts +6 -0
- package/internals/ticks.js +29 -0
- package/package.json +3 -3
|
@@ -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;
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
|
|
10
10
|
var _axis = require("../../../../models/axis");
|
|
11
11
|
var _colorScale = require("../../../colorScale");
|
|
12
|
-
var
|
|
12
|
+
var _ticks = require("../../../ticks");
|
|
13
13
|
var _getScale = require("../../../getScale");
|
|
14
14
|
var _zoom = require("./zoom");
|
|
15
15
|
var _getAxisExtremum = require("./getAxisExtremum");
|
|
@@ -117,11 +117,11 @@ function computeAxisValue({
|
|
|
117
117
|
axisExtremums[0] = min;
|
|
118
118
|
axisExtremums[1] = max;
|
|
119
119
|
}
|
|
120
|
-
const rawTickNumber = (0,
|
|
120
|
+
const rawTickNumber = (0, _ticks.getTickNumber)((0, _extends2.default)({}, axis, {
|
|
121
121
|
range,
|
|
122
122
|
domain: axisExtremums
|
|
123
123
|
}));
|
|
124
|
-
const tickNumber =
|
|
124
|
+
const tickNumber = (0, _ticks.scaleTickNumberByRange)(rawTickNumber, zoomRange);
|
|
125
125
|
const zoomedRange = (0, _zoom.zoomScaleRange)(range, zoomRange);
|
|
126
126
|
const scale = (0, _getScale.getScale)(scaleType, axisExtremums, zoomedRange);
|
|
127
127
|
const finalScale = domainLimit === 'nice' ? scale.nice(rawTickNumber) : scale;
|
|
@@ -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
|
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.defaultizeZoom = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _constants = require("../../../constants");
|
|
9
10
|
const defaultZoomOptions = {
|
|
10
11
|
minStart: 0,
|
|
11
12
|
maxEnd: 100,
|
|
@@ -15,7 +16,8 @@ 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
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
23
|
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
|
}
|
|
@@ -77,6 +77,14 @@ export interface ZoomSliderOptions {
|
|
|
77
77
|
* If `true`, the slider will be shown.
|
|
78
78
|
*/
|
|
79
79
|
enabled?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The size reserved for the zoom slider. The actual size of the slider might be smaller, so
|
|
82
|
+
* increasing this value effectively increases the margin around the slider.
|
|
83
|
+
* This means the height for the x-axis and the width for the y-axis.
|
|
84
|
+
*
|
|
85
|
+
* @default 28
|
|
86
|
+
*/
|
|
87
|
+
size?: number;
|
|
80
88
|
}
|
|
81
89
|
export type ZoomAxisFilters = Record<AxisId, ExtremumFilter>;
|
|
82
90
|
export type GetZoomAxisFilters = (params: {
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
|
|
10
10
|
var _axis = require("../../../../models/axis");
|
|
11
11
|
var _colorScale = require("../../../colorScale");
|
|
12
|
-
var
|
|
12
|
+
var _ticks = require("../../../ticks");
|
|
13
13
|
var _getScale = require("../../../getScale");
|
|
14
14
|
var _getAxisExtremum = require("./getAxisExtremum");
|
|
15
15
|
var _angleConversion = require("../../../angleConversion");
|
|
@@ -112,11 +112,11 @@ function computeAxisValue({
|
|
|
112
112
|
axisExtremums[0] = min;
|
|
113
113
|
axisExtremums[1] = max;
|
|
114
114
|
}
|
|
115
|
-
const rawTickNumber = (0,
|
|
115
|
+
const rawTickNumber = (0, _ticks.getTickNumber)((0, _extends2.default)({}, axis, {
|
|
116
116
|
range,
|
|
117
117
|
domain: axisExtremums
|
|
118
118
|
}));
|
|
119
|
-
const tickNumber =
|
|
119
|
+
const tickNumber = (0, _ticks.scaleTickNumberByRange)(rawTickNumber, range);
|
|
120
120
|
const scale = (0, _getScale.getScale)(scaleType, axisExtremums, range);
|
|
121
121
|
const finalScale = domainLimit === 'nice' ? scale.nice(rawTickNumber) : scale;
|
|
122
122
|
const [minDomain, maxDomain] = finalScale.domain();
|
|
@@ -104,9 +104,7 @@ const useChartPolarAxis = ({
|
|
|
104
104
|
mousePosition.current.y = svgPoint.y;
|
|
105
105
|
|
|
106
106
|
// Test if it's in the drawing area
|
|
107
|
-
if (!instance.isPointInside(svgPoint, {
|
|
108
|
-
targetElement: event.target
|
|
109
|
-
})) {
|
|
107
|
+
if (!instance.isPointInside(svgPoint.x, svgPoint.y, event.target)) {
|
|
110
108
|
if (mousePosition.current.isInChart) {
|
|
111
109
|
instance?.cleanInteraction();
|
|
112
110
|
mousePosition.current.isInChart = false;
|
|
@@ -79,10 +79,7 @@ const useChartVoronoi = ({
|
|
|
79
79
|
}) => {
|
|
80
80
|
const pointX = getXPosition(x);
|
|
81
81
|
const pointY = getYPosition(y);
|
|
82
|
-
if (!instance.isPointInside({
|
|
83
|
-
x: pointX,
|
|
84
|
-
y: pointY
|
|
85
|
-
})) {
|
|
82
|
+
if (!instance.isPointInside(pointX, pointY)) {
|
|
86
83
|
// If the point is not displayed we move them to a trash coordinate.
|
|
87
84
|
// This avoids managing index mapping before/after filtering.
|
|
88
85
|
// The trash point is far enough such that any point in the drawing area will be closer to the mouse than the trash coordinate.
|
|
@@ -108,7 +105,7 @@ const useChartVoronoi = ({
|
|
|
108
105
|
function getClosestPoint(event) {
|
|
109
106
|
// Get mouse coordinate in global SVG space
|
|
110
107
|
const svgPoint = (0, _getSVGPoint.getSVGPoint)(element, event);
|
|
111
|
-
if (!instance.isPointInside(svgPoint)) {
|
|
108
|
+
if (!instance.isPointInside(svgPoint.x, svgPoint.y)) {
|
|
112
109
|
lastFind.current = undefined;
|
|
113
110
|
return 'outside-chart';
|
|
114
111
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTickNumber = getTickNumber;
|
|
7
|
+
exports.scaleTickNumberByRange = scaleTickNumberByRange;
|
|
8
|
+
function getTickNumber(params) {
|
|
9
|
+
const {
|
|
10
|
+
tickMaxStep,
|
|
11
|
+
tickMinStep,
|
|
12
|
+
tickNumber,
|
|
13
|
+
range,
|
|
14
|
+
domain
|
|
15
|
+
} = params;
|
|
16
|
+
const maxTicks = tickMinStep === undefined ? 999 : Math.floor(Math.abs(domain[1] - domain[0]) / tickMinStep);
|
|
17
|
+
const minTicks = tickMaxStep === undefined ? 2 : Math.ceil(Math.abs(domain[1] - domain[0]) / tickMaxStep);
|
|
18
|
+
const defaultizedTickNumber = tickNumber ?? Math.floor(Math.abs(range[1] - range[0]) / 50);
|
|
19
|
+
return Math.min(maxTicks, Math.max(minTicks, defaultizedTickNumber));
|
|
20
|
+
}
|
|
21
|
+
function scaleTickNumberByRange(tickNumber, range) {
|
|
22
|
+
const rangeGap = range[1] - range[0];
|
|
23
|
+
|
|
24
|
+
/* If the range start and end are the same, `tickNumber` will become infinity, so we default to 1. */
|
|
25
|
+
if (rangeGap === 0) {
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
return tickNumber / ((range[1] - range[0]) / 100);
|
|
29
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The community edition of MUI X Charts components.",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"prop-types": "^15.8.1",
|
|
37
37
|
"reselect": "^5.1.1",
|
|
38
38
|
"use-sync-external-store": "^1.5.0",
|
|
39
|
-
"@mui/x-charts-vendor": "8.
|
|
40
|
-
"@mui/x-internals": "8.
|
|
39
|
+
"@mui/x-charts-vendor": "8.4.0",
|
|
40
|
+
"@mui/x-internals": "8.4.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@emotion/react": "^11.9.0",
|