@mui/x-charts 8.15.0 → 8.16.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.plugins.d.ts +1 -1
- package/BarChart/BarChart.plugins.js +1 -1
- package/BarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/BarChart/seriesConfig/index.js +2 -0
- package/BarChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/BarChart/seriesConfig/tooltipPosition.js +67 -0
- package/BarChart/useBarPlotData.d.ts +17 -2
- package/BarChart/useBarPlotData.js +59 -34
- package/CHANGELOG.md +100 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +2 -1
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +2 -1
- package/ChartsTooltip/ChartsTooltip.js +9 -0
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +9 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +48 -22
- package/ChartsTooltip/useItemTooltip.js +7 -14
- package/ChartsWrapper/ChartsWrapper.js +2 -1
- package/ChartsXAxis/useAxisTicksProps.d.ts +81 -81
- package/ChartsYAxis/useAxisTicksProps.d.ts +81 -81
- package/LineChart/LineChart.plugins.d.ts +1 -1
- package/LineChart/LineChart.plugins.js +1 -1
- package/LineChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/LineChart/seriesConfig/index.js +2 -0
- package/LineChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/LineChart/seriesConfig/tooltipPosition.js +33 -0
- package/PieChart/seriesConfig/getSeriesWithDefaultValues.js +5 -6
- package/PieChart/seriesConfig/index.js +2 -0
- package/PieChart/seriesConfig/seriesProcessor.js +2 -1
- package/PieChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/PieChart/seriesConfig/tooltipPosition.js +75 -0
- package/RadarChart/RadarChart.plugins.d.ts +2 -2
- package/RadarChart/RadarChart.plugins.js +1 -1
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +1 -1
- package/RadarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/ScatterChart/ScatterChart.plugins.d.ts +1 -1
- package/ScatterChart/ScatterChart.plugins.js +1 -1
- package/ScatterChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/ScatterChart/seriesConfig/index.js +2 -0
- package/ScatterChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/ScatterChart/seriesConfig/tooltipPosition.js +33 -0
- package/context/ChartProvider/ChartProvider.js +1 -1
- package/esm/BarChart/BarChart.plugins.d.ts +1 -1
- package/esm/BarChart/BarChart.plugins.js +1 -1
- package/esm/BarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/BarChart/seriesConfig/index.js +2 -0
- package/esm/BarChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/BarChart/seriesConfig/tooltipPosition.js +61 -0
- package/esm/BarChart/useBarPlotData.d.ts +17 -2
- package/esm/BarChart/useBarPlotData.js +58 -34
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +1 -2
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +1 -2
- package/esm/ChartsTooltip/ChartsTooltip.js +9 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.d.ts +9 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +49 -23
- package/esm/ChartsTooltip/useItemTooltip.js +9 -16
- package/esm/ChartsWrapper/ChartsWrapper.js +2 -1
- package/esm/ChartsXAxis/useAxisTicksProps.d.ts +81 -81
- package/esm/ChartsYAxis/useAxisTicksProps.d.ts +81 -81
- package/esm/LineChart/LineChart.plugins.d.ts +1 -1
- package/esm/LineChart/LineChart.plugins.js +1 -1
- package/esm/LineChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/LineChart/seriesConfig/index.js +2 -0
- package/esm/LineChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/LineChart/seriesConfig/tooltipPosition.js +27 -0
- package/esm/PieChart/seriesConfig/getSeriesWithDefaultValues.js +5 -6
- package/esm/PieChart/seriesConfig/index.js +2 -0
- package/esm/PieChart/seriesConfig/seriesProcessor.js +2 -1
- package/esm/PieChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/PieChart/seriesConfig/tooltipPosition.js +69 -0
- package/esm/RadarChart/RadarChart.plugins.d.ts +2 -2
- package/esm/RadarChart/RadarChart.plugins.js +1 -1
- package/esm/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +1 -1
- package/esm/RadarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/ScatterChart/ScatterChart.plugins.d.ts +1 -1
- package/esm/ScatterChart/ScatterChart.plugins.js +1 -1
- package/esm/ScatterChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/ScatterChart/seriesConfig/index.js +2 -0
- package/esm/ScatterChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/ScatterChart/seriesConfig/tooltipPosition.js +27 -0
- package/esm/context/ChartProvider/ChartProvider.js +1 -1
- package/esm/hooks/useFocusedItem.d.ts +1 -1
- package/esm/hooks/useInteractionItemProps.js +6 -2
- package/esm/index.js +1 -1
- package/esm/internals/configInit.d.ts +1 -1
- package/esm/internals/getScale.js +1 -1
- package/esm/internals/index.d.ts +2 -1
- package/esm/internals/index.js +2 -1
- package/esm/internals/isCartesian.d.ts +3 -2
- package/esm/internals/isCartesian.js +3 -0
- package/esm/internals/plugins/allPlugins.d.ts +2 -2
- package/esm/internals/plugins/allPlugins.js +1 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +5 -3
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +20 -3
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +3 -3
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +11 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +1 -1
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +1 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +2 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +5 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.d.ts +14 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +40 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +4 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +5 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +8 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +21 -3
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +13 -6
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +4 -3
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +1 -1
- package/esm/internals/plugins/models/seriesConfig/index.d.ts +1 -0
- package/esm/internals/plugins/models/seriesConfig/index.js +1 -0
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
- package/esm/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +24 -0
- package/esm/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.js +1 -0
- package/esm/internals/scales/index.d.ts +3 -0
- package/esm/internals/scales/index.js +3 -0
- package/esm/internals/scales/scaleBand.d.ts +25 -0
- package/esm/internals/scales/scaleBand.js +159 -0
- package/esm/internals/scales/scalePoint.d.ts +25 -0
- package/esm/internals/scales/scalePoint.js +41 -0
- package/esm/internals/scales/scaleSymlog.d.ts +38 -0
- package/esm/internals/{symlogScale.js → scales/scaleSymlog.js} +40 -2
- package/esm/models/seriesType/common.d.ts +3 -2
- package/hooks/useFocusedItem.d.ts +1 -1
- package/hooks/useInteractionItemProps.js +6 -2
- package/index.js +1 -1
- package/internals/configInit.d.ts +1 -1
- package/internals/getScale.js +2 -2
- package/internals/index.d.ts +2 -1
- package/internals/index.js +12 -0
- package/internals/isCartesian.d.ts +3 -2
- package/internals/isCartesian.js +4 -0
- package/internals/plugins/allPlugins.d.ts +2 -2
- package/internals/plugins/allPlugins.js +1 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +5 -3
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +20 -3
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +3 -3
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +11 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +3 -3
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +2 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.js +12 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +2 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +5 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.d.ts +14 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +46 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +10 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +5 -4
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +7 -4
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +21 -3
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +14 -7
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +4 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +3 -3
- package/internals/plugins/models/seriesConfig/index.d.ts +1 -0
- package/internals/plugins/models/seriesConfig/index.js +11 -0
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
- package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +24 -0
- package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.js +5 -0
- package/internals/scales/index.d.ts +3 -0
- package/internals/scales/index.js +38 -0
- package/internals/scales/scaleBand.d.ts +25 -0
- package/internals/scales/scaleBand.js +167 -0
- package/internals/scales/scalePoint.d.ts +25 -0
- package/internals/scales/scalePoint.js +46 -0
- package/internals/scales/scaleSymlog.d.ts +38 -0
- package/internals/{symlogScale.js → scales/scaleSymlog.js} +39 -2
- package/models/seriesType/common.d.ts +3 -2
- package/package.json +4 -4
- package/esm/internals/symlogScale.d.ts +0 -2
- package/internals/symlogScale.d.ts +0 -2
|
@@ -5,5 +5,5 @@ import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/
|
|
|
5
5
|
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
6
6
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
7
7
|
import { UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
8
|
-
export type BarChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<'bar'>,
|
|
8
|
+
export type BarChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<'bar'>, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
|
|
9
9
|
export declare const BAR_CHART_PLUGINS: ConvertSignaturesIntoPlugins<BarChartPluginSignatures>;
|
|
@@ -10,4 +10,4 @@ var _useChartInteraction = require("../internals/plugins/featurePlugins/useChart
|
|
|
10
10
|
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
|
|
11
11
|
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
12
12
|
var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
|
|
13
|
-
const BAR_CHART_PLUGINS = exports.BAR_CHART_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush,
|
|
13
|
+
const BAR_CHART_PLUGINS = exports.BAR_CHART_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
|
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
|
|
10
|
-
return (0, _extends2.default)({
|
|
10
|
+
return (0, _extends2.default)({}, seriesData, {
|
|
11
11
|
id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
|
|
12
|
-
color: colors[seriesIndex % colors.length]
|
|
13
|
-
}
|
|
12
|
+
color: seriesData.color ?? colors[seriesIndex % colors.length]
|
|
13
|
+
});
|
|
14
14
|
};
|
|
15
15
|
var _default = exports.default = getSeriesWithDefaultValues;
|
|
@@ -11,12 +11,14 @@ var _seriesProcessor = _interopRequireDefault(require("./seriesProcessor"));
|
|
|
11
11
|
var _legend = _interopRequireDefault(require("./legend"));
|
|
12
12
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
13
13
|
var _tooltip = _interopRequireWildcard(require("./tooltip"));
|
|
14
|
+
var _tooltipPosition = _interopRequireDefault(require("./tooltipPosition"));
|
|
14
15
|
var _getSeriesWithDefaultValues = _interopRequireDefault(require("./getSeriesWithDefaultValues"));
|
|
15
16
|
const seriesConfig = exports.seriesConfig = {
|
|
16
17
|
seriesProcessor: _seriesProcessor.default,
|
|
17
18
|
colorProcessor: _getColor.default,
|
|
18
19
|
legendGetter: _legend.default,
|
|
19
20
|
tooltipGetter: _tooltip.default,
|
|
21
|
+
tooltipItemPositionGetter: _tooltipPosition.default,
|
|
20
22
|
axisTooltipGetter: _tooltip.axisTooltipGetter,
|
|
21
23
|
xExtremumGetter: _extremums.getExtremumX,
|
|
22
24
|
yExtremumGetter: _extremums.getExtremumY,
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _useBarPlotData = require("../useBarPlotData");
|
|
8
|
+
const tooltipItemPositionGetter = params => {
|
|
9
|
+
const {
|
|
10
|
+
series,
|
|
11
|
+
identifier,
|
|
12
|
+
axesConfig,
|
|
13
|
+
placement
|
|
14
|
+
} = params;
|
|
15
|
+
if (!identifier || identifier.dataIndex === undefined) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const itemSeries = series.bar?.series[identifier.seriesId];
|
|
19
|
+
if (series.bar == null || itemSeries == null) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (axesConfig.x === undefined || axesConfig.y === undefined) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const dimensions = (0, _useBarPlotData.getBarDimensions)({
|
|
26
|
+
verticalLayout: itemSeries.layout === 'vertical',
|
|
27
|
+
xAxisConfig: axesConfig.x,
|
|
28
|
+
yAxisConfig: axesConfig.y,
|
|
29
|
+
series: itemSeries,
|
|
30
|
+
dataIndex: identifier.dataIndex,
|
|
31
|
+
numberOfGroups: series.bar.stackingGroups.length,
|
|
32
|
+
groupIndex: series.bar.stackingGroups.findIndex(group => group.ids.includes(itemSeries.id))
|
|
33
|
+
});
|
|
34
|
+
if (dimensions == null) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const {
|
|
38
|
+
x,
|
|
39
|
+
y,
|
|
40
|
+
width,
|
|
41
|
+
height
|
|
42
|
+
} = dimensions;
|
|
43
|
+
switch (placement) {
|
|
44
|
+
case 'right':
|
|
45
|
+
return {
|
|
46
|
+
x: x + width,
|
|
47
|
+
y: y + height / 2
|
|
48
|
+
};
|
|
49
|
+
case 'bottom':
|
|
50
|
+
return {
|
|
51
|
+
x: x + width / 2,
|
|
52
|
+
y: y + height
|
|
53
|
+
};
|
|
54
|
+
case 'left':
|
|
55
|
+
return {
|
|
56
|
+
x,
|
|
57
|
+
y: y + height / 2
|
|
58
|
+
};
|
|
59
|
+
case 'top':
|
|
60
|
+
default:
|
|
61
|
+
return {
|
|
62
|
+
x: x + width / 2,
|
|
63
|
+
y
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var _default = exports.default = tooltipItemPositionGetter;
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
import { ChartsXAxisProps, ChartsYAxisProps } from "../models/axis.js";
|
|
1
|
+
import { ChartsXAxisProps, ChartsYAxisProps, ComputedAxis, ScaleName } from "../models/axis.js";
|
|
2
2
|
import { ChartDrawingArea } from "../hooks/index.js";
|
|
3
3
|
import { MaskData, ProcessedBarSeriesData } from "./types.js";
|
|
4
4
|
import { ComputedAxisConfig } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.js";
|
|
5
|
+
import { ChartSeriesDefaultized } from "../models/seriesType/config.js";
|
|
5
6
|
export declare function useBarPlotData(drawingArea: ChartDrawingArea, xAxes: ComputedAxisConfig<ChartsXAxisProps>, yAxes: ComputedAxisConfig<ChartsYAxisProps>): {
|
|
6
7
|
completedData: ProcessedBarSeriesData[];
|
|
7
8
|
masksData: MaskData[];
|
|
8
|
-
};
|
|
9
|
+
};
|
|
10
|
+
export declare function getBarDimensions(params: {
|
|
11
|
+
verticalLayout: boolean;
|
|
12
|
+
xAxisConfig: ComputedAxis<ScaleName, any, ChartsXAxisProps>;
|
|
13
|
+
yAxisConfig: ComputedAxis<ScaleName, any, ChartsYAxisProps>;
|
|
14
|
+
series: ChartSeriesDefaultized<'bar'>;
|
|
15
|
+
dataIndex: number;
|
|
16
|
+
numberOfGroups: number;
|
|
17
|
+
groupIndex: number;
|
|
18
|
+
}): {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
height: number;
|
|
22
|
+
width: number;
|
|
23
|
+
} | null;
|
|
@@ -4,7 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.getBarDimensions = getBarDimensions;
|
|
7
8
|
exports.useBarPlotData = useBarPlotData;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
10
|
var _getColor = _interopRequireDefault(require("./seriesConfig/getColor"));
|
|
9
11
|
var _hooks = require("../hooks");
|
|
10
12
|
var _checkScaleErrors = require("./checkScaleErrors");
|
|
@@ -42,50 +44,32 @@ function useBarPlotData(drawingArea, xAxes, yAxes) {
|
|
|
42
44
|
const xScale = xAxisConfig.scale;
|
|
43
45
|
const yScale = yAxisConfig.scale;
|
|
44
46
|
const colorGetter = (0, _getColor.default)(series[seriesId], xAxes[xAxisId], yAxes[yAxisId]);
|
|
45
|
-
const bandWidth = baseScaleConfig.scale.bandwidth();
|
|
46
|
-
const {
|
|
47
|
-
barWidth,
|
|
48
|
-
offset
|
|
49
|
-
} = getBandSize({
|
|
50
|
-
bandWidth,
|
|
51
|
-
numberOfGroups: stackingGroups.length,
|
|
52
|
-
gapRatio: baseScaleConfig.barGapRatio
|
|
53
|
-
});
|
|
54
|
-
const barOffset = groupIndex * (barWidth + offset);
|
|
55
|
-
const {
|
|
56
|
-
stackedData,
|
|
57
|
-
data: currentSeriesData,
|
|
58
|
-
layout,
|
|
59
|
-
minBarSize
|
|
60
|
-
} = series[seriesId];
|
|
61
47
|
const seriesDataPoints = [];
|
|
62
48
|
for (let dataIndex = 0; dataIndex < baseScaleConfig.data.length; dataIndex += 1) {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
49
|
+
const barDimensions = getBarDimensions({
|
|
50
|
+
verticalLayout,
|
|
51
|
+
xAxisConfig,
|
|
52
|
+
yAxisConfig,
|
|
53
|
+
series: series[seriesId],
|
|
54
|
+
dataIndex,
|
|
55
|
+
numberOfGroups: stackingGroups.length,
|
|
56
|
+
groupIndex
|
|
57
|
+
});
|
|
58
|
+
if (barDimensions == null) {
|
|
66
59
|
continue;
|
|
67
60
|
}
|
|
68
|
-
const values = stackedData[dataIndex];
|
|
69
|
-
const valueCoordinates = values.map(v => verticalLayout ? yScale(v) : xScale(v));
|
|
70
|
-
const minValueCoord = Math.round(Math.min(...valueCoordinates));
|
|
71
|
-
const maxValueCoord = Math.round(Math.max(...valueCoordinates));
|
|
72
61
|
const stackId = series[seriesId].stack;
|
|
73
|
-
const
|
|
74
|
-
const startCoordinate = shouldInvertStartCoordinate(verticalLayout, seriesValue, reverse) ? maxValueCoord - barSize : minValueCoord;
|
|
75
|
-
const result = {
|
|
62
|
+
const result = (0, _extends2.default)({
|
|
76
63
|
seriesId,
|
|
77
64
|
dataIndex,
|
|
78
|
-
layout,
|
|
79
|
-
x: verticalLayout ? xScale(baseValue) + barOffset : startCoordinate,
|
|
80
|
-
y: verticalLayout ? startCoordinate : yScale(baseValue) + barOffset,
|
|
65
|
+
layout: series[seriesId].layout,
|
|
81
66
|
xOrigin: xScale(0) ?? 0,
|
|
82
|
-
yOrigin: yScale(0) ?? 0
|
|
83
|
-
|
|
84
|
-
width: verticalLayout ? barWidth : barSize,
|
|
67
|
+
yOrigin: yScale(0) ?? 0
|
|
68
|
+
}, barDimensions, {
|
|
85
69
|
color: colorGetter(dataIndex),
|
|
86
|
-
value:
|
|
70
|
+
value: series[seriesId].data[dataIndex],
|
|
87
71
|
maskId: `${chartId}_${stackId || seriesId}_${groupIndex}_${dataIndex}`
|
|
88
|
-
};
|
|
72
|
+
});
|
|
89
73
|
if (result.x > xMax || result.x + result.width < xMin || result.y > yMax || result.y + result.height < yMin) {
|
|
90
74
|
continue;
|
|
91
75
|
}
|
|
@@ -157,4 +141,45 @@ function shouldInvertStartCoordinate(verticalLayout, baseValue, reverse) {
|
|
|
157
141
|
const isHorizontalAndNegative = !verticalLayout && baseValue < 0;
|
|
158
142
|
const invertStartCoordinate = isVerticalAndPositive || isHorizontalAndNegative;
|
|
159
143
|
return reverse ? !invertStartCoordinate : invertStartCoordinate;
|
|
144
|
+
}
|
|
145
|
+
function getBarDimensions(params) {
|
|
146
|
+
const {
|
|
147
|
+
verticalLayout,
|
|
148
|
+
xAxisConfig,
|
|
149
|
+
yAxisConfig,
|
|
150
|
+
series,
|
|
151
|
+
dataIndex,
|
|
152
|
+
numberOfGroups,
|
|
153
|
+
groupIndex
|
|
154
|
+
} = params;
|
|
155
|
+
const baseScaleConfig = verticalLayout ? xAxisConfig : yAxisConfig;
|
|
156
|
+
const reverse = (verticalLayout ? yAxisConfig.reverse : xAxisConfig.reverse) ?? false;
|
|
157
|
+
const {
|
|
158
|
+
barWidth,
|
|
159
|
+
offset
|
|
160
|
+
} = getBandSize({
|
|
161
|
+
bandWidth: baseScaleConfig.scale.bandwidth(),
|
|
162
|
+
numberOfGroups,
|
|
163
|
+
gapRatio: baseScaleConfig.barGapRatio
|
|
164
|
+
});
|
|
165
|
+
const barOffset = groupIndex * (barWidth + offset);
|
|
166
|
+
const xScale = xAxisConfig.scale;
|
|
167
|
+
const yScale = yAxisConfig.scale;
|
|
168
|
+
const baseValue = baseScaleConfig.data[dataIndex];
|
|
169
|
+
const seriesValue = series.data[dataIndex];
|
|
170
|
+
if (seriesValue == null) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
const values = series.stackedData[dataIndex];
|
|
174
|
+
const valueCoordinates = values.map(v => verticalLayout ? yScale(v) : xScale(v));
|
|
175
|
+
const minValueCoord = Math.round(Math.min(...valueCoordinates));
|
|
176
|
+
const maxValueCoord = Math.round(Math.max(...valueCoordinates));
|
|
177
|
+
const barSize = seriesValue === 0 ? 0 : Math.max(series.minBarSize, maxValueCoord - minValueCoord);
|
|
178
|
+
const startCoordinate = shouldInvertStartCoordinate(verticalLayout, seriesValue, reverse) ? maxValueCoord - barSize : minValueCoord;
|
|
179
|
+
return {
|
|
180
|
+
x: verticalLayout ? xScale(baseValue) + barOffset : startCoordinate,
|
|
181
|
+
y: verticalLayout ? startCoordinate : yScale(baseValue) + barOffset,
|
|
182
|
+
height: verticalLayout ? barSize : barWidth,
|
|
183
|
+
width: verticalLayout ? barWidth : barSize
|
|
184
|
+
};
|
|
160
185
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,106 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.16.0
|
|
9
|
+
|
|
10
|
+
_Oct 29, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 🖌️ Add `brush` zoom interaction to charts
|
|
15
|
+
- 🔁 [Server-side update](https://mui.com/x/react-data-grid/server-side-data/#updating-server-side-data) in a grid with tree data/row grouping and aggregation will trigger re-fetch for all parent levels of that row to update aggregated values. See the [demo](https://mui.com/x/react-data-grid/server-side-data/aggregation/#usage-with-tree-data).
|
|
16
|
+
|
|
17
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
18
|
+
@felix-wg, @frncesc, @sai6855
|
|
19
|
+
|
|
20
|
+
The following are all team members who have contributed to this release:
|
|
21
|
+
@alexfauquette, @arminmeh, @bernardobelchior, @brijeshb42, @flaviendelangle, @JCQuintas, @MBilalShafi, @mbrookes, @michelengelen, @noraleonte, @rita-codes
|
|
22
|
+
|
|
23
|
+
### Data Grid
|
|
24
|
+
|
|
25
|
+
#### `@mui/x-data-grid@8.16.0`
|
|
26
|
+
|
|
27
|
+
- [DataGrid] Ignore `Ctrl+A` key combination for the row selection in the community version (#20110) @felix-wg
|
|
28
|
+
- [DataGrid][l10n] Improve Spanish (es-ES) locale (#20134) @frncesc
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-pro@8.16.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid@8.16.0`, plus:
|
|
33
|
+
|
|
34
|
+
- [DataGridPro] Add explicit return type to `getVisibleRowsLookup()` to fix the build with `tsc` (#20116) @arminmeh
|
|
35
|
+
- [DataGridPro] Retain the expansion state with expansion configuration props (#20126) @MBilalShafi
|
|
36
|
+
|
|
37
|
+
#### `@mui/x-data-grid-premium@8.16.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
38
|
+
|
|
39
|
+
Same changes as in `@mui/x-data-grid-pro@8.16.0`, plus:
|
|
40
|
+
|
|
41
|
+
- [DataGridPremium] Export and restore chart integration state (#20079) @arminmeh
|
|
42
|
+
- [DataGridPremium] Fix grouping column `valueFormatter()` crash (#20070) @sai6855
|
|
43
|
+
- [DataGridPremium] Refetch aggregation data after row update with server-side aggregation (#20039) @arminmeh
|
|
44
|
+
|
|
45
|
+
### Date and Time Pickers
|
|
46
|
+
|
|
47
|
+
#### `@mui/x-date-pickers@8.16.0`
|
|
48
|
+
|
|
49
|
+
- [pickers] Prevent blur event propagation on individual sections (#19825) @michelengelen
|
|
50
|
+
|
|
51
|
+
#### `@mui/x-date-pickers-pro@8.16.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
52
|
+
|
|
53
|
+
Same changes as in `@mui/x-date-pickers@8.16.0`.
|
|
54
|
+
|
|
55
|
+
### Charts
|
|
56
|
+
|
|
57
|
+
#### `@mui/x-charts@8.16.0`
|
|
58
|
+
|
|
59
|
+
- [charts] Allow tooltip to anchor items (#19954) @alexfauquette
|
|
60
|
+
- [charts] Fix behavior of grouped axis (#20118) @JCQuintas
|
|
61
|
+
- [charts] Move scale symlog inside scales (#20137) @JCQuintas
|
|
62
|
+
- [charts] Fix AreaChartConnectNulls demo height not correctly resizing (#20078) @sai6855
|
|
63
|
+
- [charts] Fix charts resizing overflow (#20080) @alexfauquette
|
|
64
|
+
- [charts] Fix tooltip not showing on first render (#20115) @bernardobelchior
|
|
65
|
+
- [charts] Handle `undefined` id and color in series (#20087) @bernardobelchior
|
|
66
|
+
- [charts] Remove `useMemo` from isZoomOn*Enabled and isPanOn*Enabled hooks (#20132) @Copilot
|
|
67
|
+
- [charts] Use static data for perf (#20072) @JCQuintas
|
|
68
|
+
- [charts] Move scale symlog inside scales (#20137) @JCQuintas
|
|
69
|
+
|
|
70
|
+
#### `@mui/x-charts-pro@8.16.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
71
|
+
|
|
72
|
+
Same changes as in `@mui/x-charts@8.16.0`, plus:
|
|
73
|
+
|
|
74
|
+
- [charts-pro] Add `brush` zoom interaction (#19899) @JCQuintas
|
|
75
|
+
- [charts-pro] Add sankey performance check (#20069) @JCQuintas
|
|
76
|
+
|
|
77
|
+
#### `@mui/x-charts-premium@8.16.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
78
|
+
|
|
79
|
+
Same changes as in `@mui/x-charts-pro@8.16.0`.
|
|
80
|
+
|
|
81
|
+
### Tree View
|
|
82
|
+
|
|
83
|
+
#### `@mui/x-tree-view@8.16.0`
|
|
84
|
+
|
|
85
|
+
Internal changes.
|
|
86
|
+
|
|
87
|
+
#### `@mui/x-tree-view-pro@8.16.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
88
|
+
|
|
89
|
+
Same changes as in `@mui/x-tree-view@8.16.0`.
|
|
90
|
+
|
|
91
|
+
### Codemod
|
|
92
|
+
|
|
93
|
+
#### `@mui/x-codemod@8.16.0`
|
|
94
|
+
|
|
95
|
+
Internal changes.
|
|
96
|
+
|
|
97
|
+
### Core
|
|
98
|
+
|
|
99
|
+
- [code-infra] Setup eslint compat plugin (#20105) @brijeshb42
|
|
100
|
+
- [code-infra] Improve store types (#20129) @JCQuintas
|
|
101
|
+
- [docs] Update the callout in `rows` prop documentation (#20127) @MBilalShafi
|
|
102
|
+
- [docs-infra] Refine changelog contributor acknowledgment messages (#20123) @mbrookes
|
|
103
|
+
|
|
104
|
+
### Miscellaneous
|
|
105
|
+
|
|
106
|
+
- [x-telemetry] Skip telemetry tests on browser mode (#20122) @bernardobelchior
|
|
107
|
+
|
|
8
108
|
## 8.15.0
|
|
9
109
|
|
|
10
110
|
_Oct 23, 2025_
|
|
@@ -17,7 +17,8 @@ var _ChartsAxisHighlightPath = require("./ChartsAxisHighlightPath");
|
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
/**
|
|
19
19
|
* @ignore - internal component.
|
|
20
|
-
*/
|
|
20
|
+
*/
|
|
21
|
+
function ChartsXHighlight(props) {
|
|
21
22
|
const {
|
|
22
23
|
type,
|
|
23
24
|
classes
|
|
@@ -17,7 +17,8 @@ var _ChartsAxisHighlightPath = require("./ChartsAxisHighlightPath");
|
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
/**
|
|
19
19
|
* @ignore - internal component.
|
|
20
|
-
*/
|
|
20
|
+
*/
|
|
21
|
+
function ChartsYHighlight(props) {
|
|
21
22
|
const {
|
|
22
23
|
type,
|
|
23
24
|
classes
|
|
@@ -45,6 +45,11 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
|
45
45
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
46
46
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
47
47
|
// ----------------------------------------------------------------------
|
|
48
|
+
/**
|
|
49
|
+
* Determine if the tooltip should be placed on the pointer location or on the node.
|
|
50
|
+
* @default 'pointer'
|
|
51
|
+
*/
|
|
52
|
+
anchor: _propTypes.default.oneOf(['node', 'pointer']),
|
|
48
53
|
/**
|
|
49
54
|
* An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
|
|
50
55
|
* or a function that returns either.
|
|
@@ -174,6 +179,10 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
|
174
179
|
update: _propTypes.default.func.isRequired
|
|
175
180
|
})
|
|
176
181
|
})]),
|
|
182
|
+
/**
|
|
183
|
+
* Determines the tooltip position relatively to the anchor.
|
|
184
|
+
*/
|
|
185
|
+
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
177
186
|
/**
|
|
178
187
|
* The props used for each slot inside the Popper.
|
|
179
188
|
* @default {}
|
|
@@ -15,6 +15,15 @@ export interface ChartsTooltipContainerProps<T extends TriggerOptions = TriggerO
|
|
|
15
15
|
* Override or extend the styles applied to the component.
|
|
16
16
|
*/
|
|
17
17
|
classes?: Partial<ChartsTooltipClasses>;
|
|
18
|
+
/**
|
|
19
|
+
* Determine if the tooltip should be placed on the pointer location or on the node.
|
|
20
|
+
* @default 'pointer'
|
|
21
|
+
*/
|
|
22
|
+
anchor?: 'pointer' | 'node';
|
|
23
|
+
/**
|
|
24
|
+
* Determines the tooltip position relatively to the anchor.
|
|
25
|
+
*/
|
|
26
|
+
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
18
27
|
children?: React.ReactNode;
|
|
19
28
|
}
|
|
20
29
|
/**
|
|
@@ -29,7 +29,7 @@ var _hooks = require("../hooks");
|
|
|
29
29
|
var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
|
|
30
30
|
var _selectors = require("../internals/plugins/utils/selectors");
|
|
31
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
32
|
-
const _excluded = ["trigger", "classes", "children"];
|
|
32
|
+
const _excluded = ["trigger", "position", "anchor", "classes", "children"];
|
|
33
33
|
const selectorReturnFalse = () => false;
|
|
34
34
|
const ChartsTooltipRoot = (0, _styles.styled)(_Popper.default, {
|
|
35
35
|
name: 'MuiChartsTooltip',
|
|
@@ -45,7 +45,7 @@ const selectorSelectIsOpenSelector = (0, _selectors.createSelector)([_useChartBr
|
|
|
45
45
|
return selectorReturnFalse;
|
|
46
46
|
}
|
|
47
47
|
if (trigger === 'item') {
|
|
48
|
-
return _useChartInteraction.
|
|
48
|
+
return _useChartInteraction.selectorChartsTooltipItemIsDefined;
|
|
49
49
|
}
|
|
50
50
|
if (axisSystem === 'polar') {
|
|
51
51
|
return _useChartPolarInteraction.selectorChartsInteractionPolarAxisTooltip;
|
|
@@ -72,6 +72,8 @@ function ChartsTooltipContainer(inProps) {
|
|
|
72
72
|
});
|
|
73
73
|
const {
|
|
74
74
|
trigger = 'axis',
|
|
75
|
+
position,
|
|
76
|
+
anchor = 'pointer',
|
|
75
77
|
classes: propClasses,
|
|
76
78
|
children
|
|
77
79
|
} = props,
|
|
@@ -89,30 +91,46 @@ function ChartsTooltipContainer(inProps) {
|
|
|
89
91
|
const store = (0, _useStore.useStore)();
|
|
90
92
|
const isOpenSelector = (0, _useSelector.useSelector)(store, selectorSelectIsOpenSelector, [trigger, axisSystem]);
|
|
91
93
|
const isOpen = (0, _useSelector.useSelector)(store, isOpenSelector);
|
|
94
|
+
const lastInteraction = (0, _useSelector.useSelector)(store, _useChartInteraction.selectorChartsLastInteraction);
|
|
95
|
+
const computedAnchor = lastInteraction === 'keyboard' ? 'node' : anchor;
|
|
96
|
+
const itemPosition = (0, _useSelector.useSelector)(store, trigger === 'item' && computedAnchor === 'node' ? _useChartInteraction.selectorChartsTooltipItemPosition : () => null, [position]);
|
|
92
97
|
React.useEffect(() => {
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
98
|
+
const svgElement = svgRef.current;
|
|
99
|
+
if (svgElement === null) {
|
|
95
100
|
return () => {};
|
|
96
101
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
if (itemPosition !== null) {
|
|
103
|
+
const positionUpdate = (0, _rafThrottle.rafThrottle)(() => {
|
|
104
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
105
|
+
positionRef.current = {
|
|
106
|
+
x: svgElement.getBoundingClientRect().left + (itemPosition?.x ?? 0),
|
|
107
|
+
y: svgElement.getBoundingClientRect().top + (itemPosition?.y ?? 0)
|
|
108
|
+
};
|
|
109
|
+
popperRef.current?.update();
|
|
110
|
+
});
|
|
111
|
+
positionUpdate();
|
|
112
|
+
return () => positionUpdate.clear();
|
|
113
|
+
}
|
|
114
|
+
const pointerUpdate = (0, _rafThrottle.rafThrottle)((x, y) => {
|
|
100
115
|
positionRef.current = {
|
|
101
|
-
x
|
|
102
|
-
y
|
|
116
|
+
x,
|
|
117
|
+
y
|
|
103
118
|
};
|
|
104
|
-
update();
|
|
119
|
+
popperRef.current?.update();
|
|
120
|
+
});
|
|
121
|
+
const handlePointerEvent = event => {
|
|
122
|
+
pointerUpdate(event.clientX, event.clientY);
|
|
105
123
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
124
|
+
svgElement.addEventListener('pointerdown', handlePointerEvent);
|
|
125
|
+
svgElement.addEventListener('pointermove', handlePointerEvent);
|
|
126
|
+
svgElement.addEventListener('pointerenter', handlePointerEvent);
|
|
109
127
|
return () => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
128
|
+
svgElement.removeEventListener('pointerdown', handlePointerEvent);
|
|
129
|
+
svgElement.removeEventListener('pointermove', handlePointerEvent);
|
|
130
|
+
svgElement.removeEventListener('pointerenter', handlePointerEvent);
|
|
131
|
+
pointerUpdate.clear();
|
|
114
132
|
};
|
|
115
|
-
}, [svgRef, positionRef]);
|
|
133
|
+
}, [svgRef, positionRef, itemPosition]);
|
|
116
134
|
const anchorEl = React.useMemo(() => ({
|
|
117
135
|
getBoundingClientRect: () => ({
|
|
118
136
|
x: positionRef.current.x,
|
|
@@ -156,14 +174,13 @@ function ChartsTooltipContainer(inProps) {
|
|
|
156
174
|
return null;
|
|
157
175
|
}
|
|
158
176
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_NoSsr.default, {
|
|
159
|
-
children: isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsTooltipRoot, (0, _extends2.default)({
|
|
177
|
+
children: isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsTooltipRoot, (0, _extends2.default)({}, other, {
|
|
160
178
|
className: classes?.root,
|
|
161
179
|
open: isOpen,
|
|
162
|
-
placement: isMouse ? 'right-start' : 'top',
|
|
180
|
+
placement: other.placement ?? position ?? (isMouse ? 'right-start' : 'top'),
|
|
163
181
|
popperRef: popperRef,
|
|
164
182
|
anchorEl: anchorEl,
|
|
165
|
-
modifiers: modifiers
|
|
166
|
-
}, other, {
|
|
183
|
+
modifiers: modifiers,
|
|
167
184
|
children: children
|
|
168
185
|
}))
|
|
169
186
|
});
|
|
@@ -173,6 +190,11 @@ process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
|
|
|
173
190
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
174
191
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
175
192
|
// ----------------------------------------------------------------------
|
|
193
|
+
/**
|
|
194
|
+
* Determine if the tooltip should be placed on the pointer location or on the node.
|
|
195
|
+
* @default 'pointer'
|
|
196
|
+
*/
|
|
197
|
+
anchor: _propTypes.default.oneOf(['node', 'pointer']),
|
|
176
198
|
/**
|
|
177
199
|
* An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
|
|
178
200
|
* or a function that returns either.
|
|
@@ -306,6 +328,10 @@ process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
|
|
|
306
328
|
update: _propTypes.default.func.isRequired
|
|
307
329
|
})
|
|
308
330
|
})]),
|
|
331
|
+
/**
|
|
332
|
+
* Determines the tooltip position relatively to the anchor.
|
|
333
|
+
*/
|
|
334
|
+
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
309
335
|
/**
|
|
310
336
|
* The props used for each slot inside the Popper.
|
|
311
337
|
* @default {}
|
|
@@ -13,9 +13,10 @@ var _useStore = require("../internals/store/useStore");
|
|
|
13
13
|
var _useAxis = require("../hooks/useAxis");
|
|
14
14
|
var _useZAxis = require("../hooks/useZAxis");
|
|
15
15
|
var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors");
|
|
16
|
+
var _isCartesian = require("../internals/isCartesian");
|
|
16
17
|
function useInternalItemTooltip() {
|
|
17
18
|
const store = (0, _useStore.useStore)();
|
|
18
|
-
const identifier = (0, _useSelector.useSelector)(store, _useChartInteraction.
|
|
19
|
+
const identifier = (0, _useSelector.useSelector)(store, _useChartInteraction.selectorChartsTooltipItem);
|
|
19
20
|
const seriesConfig = (0, _useSelector.useSelector)(store, _useChartSeries.selectorChartSeriesConfig);
|
|
20
21
|
const series = (0, _useSeries.useSeries)();
|
|
21
22
|
const {
|
|
@@ -34,15 +35,6 @@ function useInternalItemTooltip() {
|
|
|
34
35
|
rotationAxis,
|
|
35
36
|
rotationAxisIds
|
|
36
37
|
} = (0, _useAxis.useRotationAxes)();
|
|
37
|
-
const {
|
|
38
|
-
radiusAxis,
|
|
39
|
-
radiusAxisIds
|
|
40
|
-
} = (0, _useAxis.useRadiusAxes)();
|
|
41
|
-
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
42
|
-
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
43
|
-
const zAxisId = series.zAxisId ?? zAxisIds[0];
|
|
44
|
-
const rotationAxisId = series.rotationAxisId ?? rotationAxisIds[0];
|
|
45
|
-
const radiusAxisId = series.radiusAxisId ?? radiusAxisIds[0];
|
|
46
38
|
if (!identifier) {
|
|
47
39
|
return null;
|
|
48
40
|
}
|
|
@@ -50,7 +42,11 @@ function useInternalItemTooltip() {
|
|
|
50
42
|
if (!itemSeries) {
|
|
51
43
|
return null;
|
|
52
44
|
}
|
|
53
|
-
const
|
|
45
|
+
const xAxisId = (0, _isCartesian.isCartesianSeries)(itemSeries) ? itemSeries.xAxisId ?? xAxisIds[0] : undefined;
|
|
46
|
+
const yAxisId = (0, _isCartesian.isCartesianSeries)(itemSeries) ? itemSeries.yAxisId ?? yAxisIds[0] : undefined;
|
|
47
|
+
const zAxisId = 'zAxisId' in itemSeries ? itemSeries.zAxisId ?? zAxisIds[0] : zAxisIds[0];
|
|
48
|
+
const rotationAxisId = rotationAxisIds[0];
|
|
49
|
+
const getColor = seriesConfig[itemSeries.type].colorProcessor?.(itemSeries, xAxisId !== undefined ? xAxis[xAxisId] : undefined, yAxisId !== undefined ? yAxis[yAxisId] : undefined, zAxisId !== undefined ? zAxis[zAxisId] : undefined) ?? (() => '');
|
|
54
50
|
const axesConfig = {};
|
|
55
51
|
if (xAxisId !== undefined) {
|
|
56
52
|
axesConfig.x = xAxis[xAxisId];
|
|
@@ -61,9 +57,6 @@ function useInternalItemTooltip() {
|
|
|
61
57
|
if (rotationAxisId !== undefined) {
|
|
62
58
|
axesConfig.rotation = rotationAxis[rotationAxisId];
|
|
63
59
|
}
|
|
64
|
-
if (radiusAxisId !== undefined) {
|
|
65
|
-
axesConfig.radius = radiusAxis[radiusAxisId];
|
|
66
|
-
}
|
|
67
60
|
return seriesConfig[itemSeries.type].tooltipGetter({
|
|
68
61
|
series: itemSeries,
|
|
69
62
|
axesConfig,
|