@mui/x-charts 7.8.0 → 7.10.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 +3 -3
- package/BarChart/useBarChartProps.d.ts +1 -1
- package/CHANGELOG.md +140 -0
- package/ChartContainer/ChartContainer.js +3 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsSurface.js +5 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +3 -3
- package/ChartsTooltip/ChartsAxisTooltipContent.js +4 -39
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +7 -6
- package/ChartsTooltip/ChartsItemTooltipContent.js +4 -27
- package/ChartsTooltip/ChartsTooltip.d.ts +10 -9
- package/ChartsTooltip/ChartsTooltip.js +8 -2
- package/ChartsTooltip/ChartsTooltipTable.d.ts +15 -0
- package/ChartsTooltip/ChartsTooltipTable.js +19 -0
- package/ChartsTooltip/index.d.ts +1 -0
- package/ChartsTooltip/index.js +11 -0
- package/ChartsTooltip/utils.d.ts +7 -6
- package/ChartsTooltip/utils.js +24 -30
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -5
- package/ChartsXAxis/ChartsXAxis.js +7 -5
- package/LineChart/AreaPlot.js +7 -1
- package/LineChart/LineChart.d.ts +3 -3
- package/LineChart/MarkPlot.js +6 -2
- package/LineChart/extremums.js +1 -1
- package/LineChart/useLineChartProps.d.ts +1 -1
- package/PieChart/PieChart.d.ts +3 -3
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +3 -1
- package/ScatterChart/Scatter.js +7 -5
- package/ScatterChart/ScatterChart.d.ts +3 -3
- package/ScatterChart/ScatterChart.js +3 -1
- package/ScatterChart/useScatterChartProps.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.d.ts +3 -3
- package/context/CartesianProvider/computeValue.d.ts +2 -2
- package/context/CartesianProvider/computeValue.js +21 -5
- package/context/ZAxisContextProvider.js +7 -2
- package/esm/ChartContainer/ChartContainer.js +3 -1
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/esm/ChartsSurface.js +5 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +3 -38
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +3 -26
- package/esm/ChartsTooltip/ChartsTooltip.js +8 -2
- package/esm/ChartsTooltip/ChartsTooltipTable.js +20 -0
- package/esm/ChartsTooltip/index.js +2 -1
- package/esm/ChartsTooltip/utils.js +23 -30
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -5
- package/esm/ChartsXAxis/ChartsXAxis.js +7 -5
- package/esm/LineChart/AreaPlot.js +7 -1
- package/esm/LineChart/MarkPlot.js +6 -2
- package/esm/LineChart/extremums.js +1 -1
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +3 -1
- package/esm/ScatterChart/Scatter.js +7 -5
- package/esm/ScatterChart/ScatterChart.js +3 -1
- package/esm/context/CartesianProvider/computeValue.js +21 -5
- package/esm/context/ZAxisContextProvider.js +7 -2
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useAxis.js +17 -0
- package/esm/hooks/useAxisEvents.js +20 -9
- package/esm/hooks/useInteractionItemProps.js +11 -4
- package/esm/hooks/useScale.js +6 -13
- package/esm/internals/index.js +2 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- package/hooks/useAxis.d.ts +2 -0
- package/hooks/useAxis.js +24 -0
- package/hooks/useAxisEvents.js +20 -9
- package/hooks/useInteractionItemProps.d.ts +4 -2
- package/hooks/useInteractionItemProps.js +11 -4
- package/hooks/useScale.js +5 -13
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +20 -0
- package/models/colorMapping.d.ts +1 -1
- package/models/z-axis.d.ts +8 -0
- package/modern/ChartContainer/ChartContainer.js +3 -1
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/modern/ChartsSurface.js +5 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +3 -38
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +3 -26
- package/modern/ChartsTooltip/ChartsTooltip.js +8 -2
- package/modern/ChartsTooltip/ChartsTooltipTable.js +20 -0
- package/modern/ChartsTooltip/index.js +2 -1
- package/modern/ChartsTooltip/utils.js +23 -30
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -5
- package/modern/ChartsXAxis/ChartsXAxis.js +7 -5
- package/modern/LineChart/AreaPlot.js +7 -1
- package/modern/LineChart/MarkPlot.js +6 -2
- package/modern/LineChart/extremums.js +1 -1
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +3 -1
- package/modern/ScatterChart/Scatter.js +7 -5
- package/modern/ScatterChart/ScatterChart.js +3 -1
- package/modern/context/CartesianProvider/computeValue.js +21 -5
- package/modern/context/ZAxisContextProvider.js +7 -2
- package/modern/hooks/index.js +1 -0
- package/modern/hooks/useAxis.js +17 -0
- package/modern/hooks/useAxisEvents.js +20 -9
- package/modern/hooks/useInteractionItemProps.js +11 -4
- package/modern/hooks/useScale.js +6 -13
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -0
- package/package.json +3 -3
- package/themeAugmentation/props.d.ts +2 -1
package/ChartsTooltip/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -7,6 +8,7 @@ exports.generateVirtualElement = generateVirtualElement;
|
|
|
7
8
|
exports.getTooltipHasData = getTooltipHasData;
|
|
8
9
|
exports.useMouseTracker = useMouseTracker;
|
|
9
10
|
exports.utcFormatter = utcFormatter;
|
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
12
|
var React = _interopRequireWildcard(require("react"));
|
|
11
13
|
var _hooks = require("../hooks");
|
|
12
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -31,26 +33,19 @@ function generateVirtualElement(mousePosition) {
|
|
|
31
33
|
x,
|
|
32
34
|
y
|
|
33
35
|
} = mousePosition;
|
|
36
|
+
const boundingBox = {
|
|
37
|
+
width: 0,
|
|
38
|
+
height: 0,
|
|
39
|
+
x,
|
|
40
|
+
y,
|
|
41
|
+
top: y,
|
|
42
|
+
right: x,
|
|
43
|
+
bottom: y,
|
|
44
|
+
left: x
|
|
45
|
+
};
|
|
34
46
|
return {
|
|
35
|
-
getBoundingClientRect: () => ({
|
|
36
|
-
|
|
37
|
-
height: 0,
|
|
38
|
-
x,
|
|
39
|
-
y,
|
|
40
|
-
top: y,
|
|
41
|
-
right: x,
|
|
42
|
-
bottom: y,
|
|
43
|
-
left: x,
|
|
44
|
-
toJSON: () => JSON.stringify({
|
|
45
|
-
width: 0,
|
|
46
|
-
height: 0,
|
|
47
|
-
x,
|
|
48
|
-
y,
|
|
49
|
-
top: y,
|
|
50
|
-
right: x,
|
|
51
|
-
bottom: y,
|
|
52
|
-
left: x
|
|
53
|
-
})
|
|
47
|
+
getBoundingClientRect: () => (0, _extends2.default)({}, boundingBox, {
|
|
48
|
+
toJSON: () => JSON.stringify(boundingBox)
|
|
54
49
|
})
|
|
55
50
|
};
|
|
56
51
|
}
|
|
@@ -68,21 +63,20 @@ function useMouseTracker() {
|
|
|
68
63
|
setMousePosition(null);
|
|
69
64
|
};
|
|
70
65
|
const handleMove = event => {
|
|
71
|
-
const target = 'targetTouches' in event ? event.targetTouches[0] : event;
|
|
72
66
|
setMousePosition({
|
|
73
|
-
x:
|
|
74
|
-
y:
|
|
67
|
+
x: event.clientX,
|
|
68
|
+
y: event.clientY,
|
|
69
|
+
height: event.height,
|
|
70
|
+
pointerType: event.pointerType
|
|
75
71
|
});
|
|
76
72
|
};
|
|
77
|
-
element.addEventListener('
|
|
78
|
-
element.addEventListener('
|
|
79
|
-
element.addEventListener('
|
|
80
|
-
element.addEventListener('touchmove', handleMove);
|
|
73
|
+
element.addEventListener('pointerdown', handleMove);
|
|
74
|
+
element.addEventListener('pointermove', handleMove);
|
|
75
|
+
element.addEventListener('pointerup', handleOut);
|
|
81
76
|
return () => {
|
|
82
|
-
element.removeEventListener('
|
|
83
|
-
element.removeEventListener('
|
|
84
|
-
element.
|
|
85
|
-
element.addEventListener('touchmove', handleMove);
|
|
77
|
+
element.removeEventListener('pointerdown', handleMove);
|
|
78
|
+
element.removeEventListener('pointermove', handleMove);
|
|
79
|
+
element.removeEventListener('pointerup', handleOut);
|
|
86
80
|
};
|
|
87
81
|
}, [svgRef]);
|
|
88
82
|
return mousePosition;
|
|
@@ -105,7 +105,7 @@ function ChartsVoronoiHandler(props) {
|
|
|
105
105
|
// TODO: A perf optimisation of voronoi could be to use the last point as the initial point for the next search.
|
|
106
106
|
function getClosestPoint(event) {
|
|
107
107
|
// Get mouse coordinate in global SVG space
|
|
108
|
-
const svgPoint = (0, _getSVGPoint.getSVGPoint)(
|
|
108
|
+
const svgPoint = (0, _getSVGPoint.getSVGPoint)(element, event);
|
|
109
109
|
const outsideX = svgPoint.x < left || svgPoint.x > left + width;
|
|
110
110
|
const outsideY = svgPoint.y < top || svgPoint.y > top + height;
|
|
111
111
|
if (outsideX || outsideY) {
|
|
@@ -200,12 +200,12 @@ function ChartsVoronoiHandler(props) {
|
|
|
200
200
|
dataIndex
|
|
201
201
|
});
|
|
202
202
|
};
|
|
203
|
-
element.addEventListener('
|
|
204
|
-
element.addEventListener('
|
|
203
|
+
element.addEventListener('pointerout', handleMouseOut);
|
|
204
|
+
element.addEventListener('pointermove', handleMouseMove);
|
|
205
205
|
element.addEventListener('click', handleMouseClick);
|
|
206
206
|
return () => {
|
|
207
|
-
element.removeEventListener('
|
|
208
|
-
element.removeEventListener('
|
|
207
|
+
element.removeEventListener('pointerout', handleMouseOut);
|
|
208
|
+
element.removeEventListener('pointermove', handleMouseMove);
|
|
209
209
|
element.removeEventListener('click', handleMouseClick);
|
|
210
210
|
};
|
|
211
211
|
}, [svgRef, dispatch, left, width, top, height, yAxis, xAxis, voronoiMaxRadius, onItemClick, setHighlighted, clearHighlighted]);
|
|
@@ -218,10 +218,10 @@ function ChartsXAxis(inProps) {
|
|
|
218
218
|
transform: `translate(0, ${position === 'bottom' ? top + height : top})`,
|
|
219
219
|
className: classes.root,
|
|
220
220
|
children: [!disableLine && /*#__PURE__*/(0, _jsxRuntime.jsx)(Line, (0, _extends2.default)({
|
|
221
|
-
x1:
|
|
222
|
-
x2:
|
|
221
|
+
x1: left,
|
|
222
|
+
x2: left + width,
|
|
223
223
|
className: classes.line
|
|
224
|
-
}, slotProps?.axisLine)), xTicksWithDimension.map(({
|
|
224
|
+
}, slotProps?.axisLine)), xTicksWithDimension.filter(tick => tick.offset >= left - 1 && tick.offset <= left + width + 1).map(({
|
|
225
225
|
formattedValue,
|
|
226
226
|
offset,
|
|
227
227
|
labelOffset,
|
|
@@ -229,13 +229,15 @@ function ChartsXAxis(inProps) {
|
|
|
229
229
|
}, index) => {
|
|
230
230
|
const xTickLabel = labelOffset ?? 0;
|
|
231
231
|
const yTickLabel = positionSign * (tickSize + 3);
|
|
232
|
+
const showTick = offset >= left - 1 && offset <= left + width + 1;
|
|
233
|
+
const showTickLabel = offset + xTickLabel >= left - 1 && offset + xTickLabel <= left + width + 1;
|
|
232
234
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
233
235
|
transform: `translate(${offset}, 0)`,
|
|
234
236
|
className: classes.tickContainer,
|
|
235
|
-
children: [!disableTicks && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tick, (0, _extends2.default)({
|
|
237
|
+
children: [!disableTicks && showTick && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tick, (0, _extends2.default)({
|
|
236
238
|
y2: positionSign * tickSize,
|
|
237
239
|
className: classes.tick
|
|
238
|
-
}, slotProps?.axisTick)), formattedValue !== undefined && !skipLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(TickLabel, (0, _extends2.default)({
|
|
240
|
+
}, slotProps?.axisTick)), formattedValue !== undefined && !skipLabel && showTickLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(TickLabel, (0, _extends2.default)({
|
|
239
241
|
x: xTickLabel,
|
|
240
242
|
y: yTickLabel
|
|
241
243
|
}, axisTickLabelProps, {
|
package/LineChart/AreaPlot.js
CHANGED
|
@@ -63,7 +63,13 @@ const useAggregatedData = () => {
|
|
|
63
63
|
throw new Error(`MUI X Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d =>
|
|
66
|
+
const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => {
|
|
67
|
+
const value = d.y && yScale(d.y[0]);
|
|
68
|
+
if (Number.isNaN(value)) {
|
|
69
|
+
return yScale.range()[0];
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
}).y1(d => d.y && yScale(d.y[1]));
|
|
67
73
|
const curve = (0, _getCurve.default)(series[seriesId].curve);
|
|
68
74
|
const formattedData = xData?.map((x, index) => ({
|
|
69
75
|
x,
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -14,9 +14,9 @@ import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from './LineHighli
|
|
|
14
14
|
import { ChartsGridProps } from '../ChartsGrid';
|
|
15
15
|
import { ChartsOnAxisClickHandlerProps } from '../ChartsOnAxisClickHandler';
|
|
16
16
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay';
|
|
17
|
-
export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsTooltipSlots
|
|
17
|
+
export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsTooltipSlots<'line'>, ChartsOverlaySlots {
|
|
18
18
|
}
|
|
19
|
-
export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps
|
|
19
|
+
export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps<'line'>, ChartsOverlaySlotProps {
|
|
20
20
|
}
|
|
21
21
|
export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
|
|
22
22
|
/**
|
|
@@ -29,7 +29,7 @@ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'ser
|
|
|
29
29
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
30
30
|
* @default { trigger: 'item' }
|
|
31
31
|
*/
|
|
32
|
-
tooltip?: ChartsTooltipProps
|
|
32
|
+
tooltip?: ChartsTooltipProps<'line'>;
|
|
33
33
|
/**
|
|
34
34
|
* Option to display a cartesian grid in the background.
|
|
35
35
|
*/
|
package/LineChart/MarkPlot.js
CHANGED
|
@@ -17,6 +17,7 @@ var _constants = require("../constants");
|
|
|
17
17
|
var _utils = require("../internals/utils");
|
|
18
18
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
19
19
|
var _useSeries = require("../hooks/useSeries");
|
|
20
|
+
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
22
|
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
|
|
22
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -42,6 +43,10 @@ function MarkPlot(props) {
|
|
|
42
43
|
const seriesData = (0, _useSeries.useLineSeries)();
|
|
43
44
|
const axisData = (0, _CartesianProvider.useCartesianContext)();
|
|
44
45
|
const chartId = (0, _useChartId.useChartId)();
|
|
46
|
+
const {
|
|
47
|
+
left,
|
|
48
|
+
width
|
|
49
|
+
} = (0, _useDrawingArea.useDrawingArea)();
|
|
45
50
|
const Mark = slots?.mark ?? _MarkElement.MarkElement;
|
|
46
51
|
if (seriesData === undefined) {
|
|
47
52
|
return null;
|
|
@@ -76,13 +81,12 @@ function MarkPlot(props) {
|
|
|
76
81
|
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisKey].scale);
|
|
77
82
|
const yScale = yAxis[yAxisKey].scale;
|
|
78
83
|
const xData = xAxis[xAxisKey].data;
|
|
79
|
-
const xRange = xAxis[xAxisKey].scale.range();
|
|
80
84
|
const yRange = yScale.range();
|
|
81
85
|
const isInRange = ({
|
|
82
86
|
x,
|
|
83
87
|
y
|
|
84
88
|
}) => {
|
|
85
|
-
if (x <
|
|
89
|
+
if (x < left || x > left + width) {
|
|
86
90
|
return false;
|
|
87
91
|
}
|
|
88
92
|
if (y < Math.min(...yRange) || y > Math.max(...yRange)) {
|
package/LineChart/extremums.js
CHANGED
|
@@ -37,7 +37,7 @@ const getExtremumY = params => {
|
|
|
37
37
|
stackedData
|
|
38
38
|
} = series[seriesId];
|
|
39
39
|
const isArea = area !== undefined;
|
|
40
|
-
const getValues = isArea ? d => d : d => [d[1], d[1]]; // Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
40
|
+
const getValues = isArea && axis.scaleType !== 'log' ? d => d : d => [d[1], d[1]]; // Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
41
41
|
|
|
42
42
|
const seriesExtremums = getSeriesExtremums(getValues, stackedData);
|
|
43
43
|
if (acc[0] === null) {
|
|
@@ -35,6 +35,6 @@ export declare const useLineChartProps: (props: LineChartProps) => {
|
|
|
35
35
|
axisHighlightProps: ChartsAxisHighlightProps;
|
|
36
36
|
lineHighlightPlotProps: LineHighlightPlotProps;
|
|
37
37
|
legendProps: ChartsLegendProps;
|
|
38
|
-
tooltipProps: ChartsTooltipProps
|
|
38
|
+
tooltipProps: ChartsTooltipProps<"line">;
|
|
39
39
|
children: import("react").ReactNode;
|
|
40
40
|
};
|
package/PieChart/PieChart.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ import { PiePlotProps, PiePlotSlotProps, PiePlotSlots } from './PiePlot';
|
|
|
10
10
|
import { PieValueType } from '../models/seriesType/pie';
|
|
11
11
|
import { ChartsAxisSlots, ChartsAxisSlotProps, ChartsXAxisProps, ChartsYAxisProps } from '../models/axis';
|
|
12
12
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay';
|
|
13
|
-
export interface PieChartSlots extends ChartsAxisSlots, PiePlotSlots, ChartsLegendSlots, ChartsTooltipSlots
|
|
13
|
+
export interface PieChartSlots extends ChartsAxisSlots, PiePlotSlots, ChartsLegendSlots, ChartsTooltipSlots<'pie'>, ChartsOverlaySlots {
|
|
14
14
|
}
|
|
15
|
-
export interface PieChartSlotProps extends ChartsAxisSlotProps, PiePlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps
|
|
15
|
+
export interface PieChartSlotProps extends ChartsAxisSlotProps, PiePlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps<'pie'>, ChartsOverlaySlotProps {
|
|
16
16
|
}
|
|
17
17
|
export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'leftAxis' | 'bottomAxis' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
18
18
|
/**
|
|
@@ -37,7 +37,7 @@ export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'seri
|
|
|
37
37
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
38
38
|
* @default { trigger: 'item' }
|
|
39
39
|
*/
|
|
40
|
-
tooltip?: ChartsTooltipProps
|
|
40
|
+
tooltip?: ChartsTooltipProps<'pie'>;
|
|
41
41
|
/**
|
|
42
42
|
* The configuration of axes highlight.
|
|
43
43
|
* @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
|
|
@@ -238,6 +238,8 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
238
238
|
})]),
|
|
239
239
|
data: _propTypes.default.array,
|
|
240
240
|
dataKey: _propTypes.default.string,
|
|
241
|
-
id: _propTypes.default.string
|
|
241
|
+
id: _propTypes.default.string,
|
|
242
|
+
max: _propTypes.default.number,
|
|
243
|
+
min: _propTypes.default.number
|
|
242
244
|
}))
|
|
243
245
|
} : void 0;
|
package/ScatterChart/Scatter.js
CHANGED
|
@@ -12,6 +12,7 @@ var _useScale = require("../hooks/useScale");
|
|
|
12
12
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
13
13
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
14
14
|
var _context = require("../context");
|
|
15
|
+
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
15
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -35,6 +36,10 @@ function Scatter(props) {
|
|
|
35
36
|
markerSize,
|
|
36
37
|
onItemClick
|
|
37
38
|
} = props;
|
|
39
|
+
const {
|
|
40
|
+
left,
|
|
41
|
+
width
|
|
42
|
+
} = (0, _useDrawingArea.useDrawingArea)();
|
|
38
43
|
const {
|
|
39
44
|
useVoronoiInteraction
|
|
40
45
|
} = React.useContext(_InteractionProvider.InteractionContext);
|
|
@@ -47,10 +52,7 @@ function Scatter(props) {
|
|
|
47
52
|
const cleanData = React.useMemo(() => {
|
|
48
53
|
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
49
54
|
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
50
|
-
const xRange = xScale.range();
|
|
51
55
|
const yRange = yScale.range();
|
|
52
|
-
const minXRange = Math.min(...xRange);
|
|
53
|
-
const maxXRange = Math.max(...xRange);
|
|
54
56
|
const minYRange = Math.min(...yRange);
|
|
55
57
|
const maxYRange = Math.max(...yRange);
|
|
56
58
|
const temp = [];
|
|
@@ -58,7 +60,7 @@ function Scatter(props) {
|
|
|
58
60
|
const scatterPoint = series.data[i];
|
|
59
61
|
const x = getXPosition(scatterPoint.x);
|
|
60
62
|
const y = getYPosition(scatterPoint.y);
|
|
61
|
-
const isInRange = x >=
|
|
63
|
+
const isInRange = x >= left && x <= left + width && y >= minYRange && y <= maxYRange;
|
|
62
64
|
const pointCtx = {
|
|
63
65
|
type: 'scatter',
|
|
64
66
|
seriesId: series.id,
|
|
@@ -83,7 +85,7 @@ function Scatter(props) {
|
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
return temp;
|
|
86
|
-
}, [xScale, yScale, series.data, series.id,
|
|
88
|
+
}, [xScale, yScale, left, width, series.data, series.id, isHighlighted, isFaded, getInteractionItemProps, colorGetter, color]);
|
|
87
89
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
88
90
|
children: cleanData.map(dataPoint => /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", (0, _extends2.default)({
|
|
89
91
|
cx: 0,
|
|
@@ -12,9 +12,9 @@ import { ChartsAxisSlots, ChartsAxisSlotProps } from '../models/axis';
|
|
|
12
12
|
import { ChartsVoronoiHandlerProps } from '../ChartsVoronoiHandler/ChartsVoronoiHandler';
|
|
13
13
|
import { ChartsGridProps } from '../ChartsGrid';
|
|
14
14
|
import { ZAxisContextProviderProps } from '../context/ZAxisContextProvider';
|
|
15
|
-
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsTooltipSlots
|
|
15
|
+
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsTooltipSlots<'scatter'>, ChartsOverlaySlots {
|
|
16
16
|
}
|
|
17
|
-
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps
|
|
17
|
+
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps<'scatter'>, ChartsOverlaySlotProps {
|
|
18
18
|
}
|
|
19
19
|
export interface ScatterChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'plugins'>, Omit<ZAxisContextProviderProps, 'children' | 'dataset'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Omit<ChartsVoronoiHandlerProps, 'onItemClick'> {
|
|
20
20
|
/**
|
|
@@ -27,7 +27,7 @@ export interface ScatterChartProps extends Omit<ResponsiveChartContainerProps, '
|
|
|
27
27
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
28
28
|
* @default { trigger: 'item' }
|
|
29
29
|
*/
|
|
30
|
-
tooltip?: ChartsTooltipProps
|
|
30
|
+
tooltip?: ChartsTooltipProps<'scatter'>;
|
|
31
31
|
/**
|
|
32
32
|
* The configuration of axes highlight.
|
|
33
33
|
* @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
|
|
@@ -348,6 +348,8 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
348
348
|
})]),
|
|
349
349
|
data: _propTypes.default.array,
|
|
350
350
|
dataKey: _propTypes.default.string,
|
|
351
|
-
id: _propTypes.default.string
|
|
351
|
+
id: _propTypes.default.string,
|
|
352
|
+
max: _propTypes.default.number,
|
|
353
|
+
min: _propTypes.default.number
|
|
352
354
|
}))
|
|
353
355
|
} : void 0;
|
|
@@ -26,6 +26,6 @@ export declare const useScatterChartProps: (props: ScatterChartProps) => {
|
|
|
26
26
|
overlayProps: ChartsOverlayProps;
|
|
27
27
|
legendProps: ChartsLegendProps;
|
|
28
28
|
axisHighlightProps: ChartsAxisHighlightProps;
|
|
29
|
-
tooltipProps: ChartsTooltipProps
|
|
29
|
+
tooltipProps: ChartsTooltipProps<"scatter">;
|
|
30
30
|
children: import("react").ReactNode;
|
|
31
31
|
};
|
|
@@ -11,9 +11,9 @@ import { LinePlotSlots, LinePlotSlotProps } from '../LineChart/LinePlot';
|
|
|
11
11
|
import { MarkPlotSlots, MarkPlotSlotProps } from '../LineChart/MarkPlot';
|
|
12
12
|
import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from '../LineChart/LineHighlightPlot';
|
|
13
13
|
import { BarPlotSlots, BarPlotSlotProps } from '../BarChart/BarPlot';
|
|
14
|
-
export interface SparkLineChartSlots extends AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, Omit<BarPlotSlots, 'barLabel'>, ChartsTooltipSlots {
|
|
14
|
+
export interface SparkLineChartSlots extends AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, Omit<BarPlotSlots, 'barLabel'>, ChartsTooltipSlots<'line' | 'bar'> {
|
|
15
15
|
}
|
|
16
|
-
export interface SparkLineChartSlotProps extends AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, BarPlotSlotProps, ChartsTooltipSlotProps {
|
|
16
|
+
export interface SparkLineChartSlotProps extends AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, BarPlotSlotProps, ChartsTooltipSlotProps<'line' | 'bar'> {
|
|
17
17
|
}
|
|
18
18
|
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'zAxis' | 'margin' | 'plugins'> {
|
|
19
19
|
/**
|
|
@@ -26,7 +26,7 @@ export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps,
|
|
|
26
26
|
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
27
27
|
*/
|
|
28
28
|
yAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsYAxisProps>, 'id'>;
|
|
29
|
-
tooltip?: ChartsTooltipProps
|
|
29
|
+
tooltip?: ChartsTooltipProps<'line' | 'bar'>;
|
|
30
30
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
31
31
|
/**
|
|
32
32
|
* Type of plot used.
|
|
@@ -7,13 +7,13 @@ import { FormattedSeries } from '../SeriesContextProvider';
|
|
|
7
7
|
import { MakeOptional } from '../../models/helpers';
|
|
8
8
|
export declare function computeValue(drawingArea: DrawingArea, formattedSeries: FormattedSeries, axis: MakeOptional<AxisConfig<ScaleName, any, ChartsYAxisProps>, 'id'>[] | undefined, extremumGetters: {
|
|
9
9
|
[K in CartesianChartSeriesType]?: ExtremumGetter<K>;
|
|
10
|
-
}, axisName: 'y'): {
|
|
10
|
+
}, axisName: 'y', zoomRange?: [number, number]): {
|
|
11
11
|
axis: DefaultizedAxisConfig<ChartsYAxisProps>;
|
|
12
12
|
axisIds: string[];
|
|
13
13
|
};
|
|
14
14
|
export declare function computeValue(drawingArea: DrawingArea, formattedSeries: FormattedSeries, inAxis: MakeOptional<AxisConfig<ScaleName, any, ChartsXAxisProps>, 'id'>[] | undefined, extremumGetters: {
|
|
15
15
|
[K in CartesianChartSeriesType]?: ExtremumGetter<K>;
|
|
16
|
-
}, axisName: 'x'): {
|
|
16
|
+
}, axisName: 'x', zoomRange?: [number, number]): {
|
|
17
17
|
axis: DefaultizedAxisConfig<ChartsAxisProps>;
|
|
18
18
|
axisIds: string[];
|
|
19
19
|
};
|
|
@@ -17,6 +17,16 @@ const getRange = (drawingArea, axisName, isReverse) => {
|
|
|
17
17
|
const range = axisName === 'x' ? [drawingArea.left, drawingArea.left + drawingArea.width] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
18
18
|
return isReverse ? range.reverse() : range;
|
|
19
19
|
};
|
|
20
|
+
const zoomedScaleRange = (scaleRange, zoomRange) => {
|
|
21
|
+
const rangeGap = scaleRange[1] - scaleRange[0];
|
|
22
|
+
const zoomGap = zoomRange[1] - zoomRange[0];
|
|
23
|
+
|
|
24
|
+
// If current zoom show the scale between p1 and p2 percents
|
|
25
|
+
// The range should be extended by adding [0, p1] and [p2, 100] segments
|
|
26
|
+
const min = scaleRange[0] - zoomRange[0] * rangeGap / zoomGap;
|
|
27
|
+
const max = scaleRange[1] + (100 - zoomRange[1]) * rangeGap / zoomGap;
|
|
28
|
+
return [min, max];
|
|
29
|
+
};
|
|
20
30
|
const isDateData = data => data?.[0] instanceof Date;
|
|
21
31
|
function createDateFormatter(axis, range) {
|
|
22
32
|
const timeScale = (0, _d3Scale.scaleTime)(axis.data, range);
|
|
@@ -26,7 +36,7 @@ function createDateFormatter(axis, range) {
|
|
|
26
36
|
}
|
|
27
37
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
28
38
|
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
29
|
-
function computeValue(drawingArea, formattedSeries, inAxis, extremumGetters, axisName) {
|
|
39
|
+
function computeValue(drawingArea, formattedSeries, inAxis, extremumGetters, axisName, zoomRange = [0, 100]) {
|
|
30
40
|
const DEFAULT_AXIS_KEY = axisName === 'x' ? _constants.DEFAULT_X_AXIS_KEY : _constants.DEFAULT_Y_AXIS_KEY;
|
|
31
41
|
const allAxis = [...(inAxis?.map((axis, index) => (0, _extends2.default)({
|
|
32
42
|
id: `defaultized-${axisName}-axis-${index}`
|
|
@@ -46,11 +56,12 @@ function computeValue(drawingArea, formattedSeries, inAxis, extremumGetters, axi
|
|
|
46
56
|
const barGapRatio = axis.barGapRatio ?? DEFAULT_BAR_GAP_RATIO;
|
|
47
57
|
// Reverse range because ordinal scales are presented from top to bottom on y-axis
|
|
48
58
|
const scaleRange = axisName === 'x' ? range : [range[1], range[0]];
|
|
59
|
+
const zoomedRange = zoomedScaleRange(scaleRange, zoomRange);
|
|
49
60
|
completeAxis[axis.id] = (0, _extends2.default)({
|
|
50
61
|
categoryGapRatio,
|
|
51
62
|
barGapRatio
|
|
52
63
|
}, axis, {
|
|
53
|
-
scale: (0, _d3Scale.scaleBand)(axis.data,
|
|
64
|
+
scale: (0, _d3Scale.scaleBand)(axis.data, zoomedRange).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
|
|
54
65
|
tickNumber: axis.data.length,
|
|
55
66
|
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
56
67
|
values: axis.data
|
|
@@ -63,8 +74,9 @@ function computeValue(drawingArea, formattedSeries, inAxis, extremumGetters, axi
|
|
|
63
74
|
}
|
|
64
75
|
if ((0, _axis.isPointScaleConfig)(axis)) {
|
|
65
76
|
const scaleRange = axisName === 'x' ? range : [...range].reverse();
|
|
77
|
+
const zoomedRange = zoomedScaleRange(scaleRange, zoomRange);
|
|
66
78
|
completeAxis[axis.id] = (0, _extends2.default)({}, axis, {
|
|
67
|
-
scale: (0, _d3Scale.scalePoint)(axis.data,
|
|
79
|
+
scale: (0, _d3Scale.scalePoint)(axis.data, zoomedRange),
|
|
68
80
|
tickNumber: axis.data.length,
|
|
69
81
|
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
70
82
|
values: axis.data
|
|
@@ -81,11 +93,15 @@ function computeValue(drawingArea, formattedSeries, inAxis, extremumGetters, axi
|
|
|
81
93
|
}
|
|
82
94
|
const scaleType = axis.scaleType ?? 'linear';
|
|
83
95
|
const extremums = [axis.min ?? minData, axis.max ?? maxData];
|
|
84
|
-
const
|
|
96
|
+
const rawTickNumber = (0, _useTicks.getTickNumber)((0, _extends2.default)({}, axis, {
|
|
85
97
|
range,
|
|
86
98
|
domain: extremums
|
|
87
99
|
}));
|
|
88
|
-
const
|
|
100
|
+
const tickNumber = rawTickNumber / ((zoomRange[1] - zoomRange[0]) / 100);
|
|
101
|
+
const zoomedRange = zoomedScaleRange(range, zoomRange);
|
|
102
|
+
|
|
103
|
+
// TODO: move nice to prop? Disable when there is zoom?
|
|
104
|
+
const scale = (0, _getScale.getScale)(scaleType, extremums, zoomedRange).nice(rawTickNumber);
|
|
89
105
|
const [minDomain, maxDomain] = scale.domain();
|
|
90
106
|
const domain = [axis.min ?? minDomain, axis.max ?? maxDomain];
|
|
91
107
|
completeAxis[axis.id] = (0, _extends2.default)({}, axis, {
|
|
@@ -47,7 +47,10 @@ function ZAxisContextProvider(props) {
|
|
|
47
47
|
completedZAxis[axis.id] = (0, _extends2.default)({}, axis, {
|
|
48
48
|
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' && axis.data ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
49
49
|
values: axis.data
|
|
50
|
-
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap)
|
|
50
|
+
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap.type === 'continuous' ? (0, _extends2.default)({
|
|
51
|
+
min: axis.min,
|
|
52
|
+
max: axis.max
|
|
53
|
+
}, axis.colorMap) : axis.colorMap))
|
|
51
54
|
});
|
|
52
55
|
});
|
|
53
56
|
return {
|
|
@@ -93,6 +96,8 @@ process.env.NODE_ENV !== "production" ? ZAxisContextProvider.propTypes = {
|
|
|
93
96
|
})]),
|
|
94
97
|
data: _propTypes.default.array,
|
|
95
98
|
dataKey: _propTypes.default.string,
|
|
96
|
-
id: _propTypes.default.string
|
|
99
|
+
id: _propTypes.default.string,
|
|
100
|
+
max: _propTypes.default.number,
|
|
101
|
+
min: _propTypes.default.number
|
|
97
102
|
}))
|
|
98
103
|
} : void 0;
|
|
@@ -283,7 +283,9 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
283
283
|
})]),
|
|
284
284
|
data: PropTypes.array,
|
|
285
285
|
dataKey: PropTypes.string,
|
|
286
|
-
id: PropTypes.string
|
|
286
|
+
id: PropTypes.string,
|
|
287
|
+
max: PropTypes.number,
|
|
288
|
+
min: PropTypes.number
|
|
287
289
|
}))
|
|
288
290
|
} : void 0;
|
|
289
291
|
export { ChartContainer };
|
|
@@ -86,7 +86,7 @@ function ChartsAxisHighlight(props) {
|
|
|
86
86
|
ownerState: {
|
|
87
87
|
axisHighlight: 'band'
|
|
88
88
|
}
|
|
89
|
-
}), isBandScaleY && yScale(axisY.value)
|
|
89
|
+
}), isBandScaleY && yScale(axisY.value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
|
|
90
90
|
d: `M ${xScale.range()[0]} ${
|
|
91
91
|
// @ts-expect-error, yScale value is checked in the statement above
|
|
92
92
|
yScale(axisY.value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${xScale.range()[1] - xScale.range()[0]} 0 l 0 ${-yScale.step()} Z`,
|
package/esm/ChartsSurface.js
CHANGED
|
@@ -9,7 +9,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
const ChartChartsSurfaceStyles = styled('svg', {
|
|
10
10
|
name: 'MuiChartsSurface',
|
|
11
11
|
slot: 'Root'
|
|
12
|
-
})(() => ({
|
|
12
|
+
})(() => ({
|
|
13
|
+
// This prevents default touch actions when using the svg on mobile devices.
|
|
14
|
+
// For example, prevent page scroll & zoom.
|
|
15
|
+
touchAction: 'none'
|
|
16
|
+
}));
|
|
13
17
|
const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(props, ref) {
|
|
14
18
|
const {
|
|
15
19
|
children,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { useSlotProps } from '@mui/base/utils';
|
|
5
4
|
import { useCartesianContext } from '../context/CartesianProvider';
|
|
6
5
|
import { DefaultChartsAxisTooltipContent } from './DefaultChartsAxisTooltipContent';
|
|
@@ -9,6 +8,9 @@ import { useColorProcessor } from '../hooks/useColor';
|
|
|
9
8
|
import { isCartesianSeriesType } from '../internals/isCartesian';
|
|
10
9
|
import { useSeries } from '../hooks/useSeries';
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
/**
|
|
12
|
+
* @ignore - internal component.
|
|
13
|
+
*/
|
|
12
14
|
function ChartsAxisTooltipContent(props) {
|
|
13
15
|
const {
|
|
14
16
|
content,
|
|
@@ -71,41 +73,4 @@ function ChartsAxisTooltipContent(props) {
|
|
|
71
73
|
});
|
|
72
74
|
return /*#__PURE__*/_jsx(Content, _extends({}, chartTooltipContentProps));
|
|
73
75
|
}
|
|
74
|
-
process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
|
|
75
|
-
// ----------------------------- Warning --------------------------------
|
|
76
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
77
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
78
|
-
// ----------------------------------------------------------------------
|
|
79
|
-
axisData: PropTypes.shape({
|
|
80
|
-
x: PropTypes.shape({
|
|
81
|
-
index: PropTypes.number,
|
|
82
|
-
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired
|
|
83
|
-
}),
|
|
84
|
-
y: PropTypes.shape({
|
|
85
|
-
index: PropTypes.number,
|
|
86
|
-
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired
|
|
87
|
-
})
|
|
88
|
-
}).isRequired,
|
|
89
|
-
classes: PropTypes.object.isRequired,
|
|
90
|
-
content: PropTypes.elementType,
|
|
91
|
-
contentProps: PropTypes.shape({
|
|
92
|
-
axis: PropTypes.object,
|
|
93
|
-
axisData: PropTypes.shape({
|
|
94
|
-
x: PropTypes.shape({
|
|
95
|
-
index: PropTypes.number,
|
|
96
|
-
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired
|
|
97
|
-
}),
|
|
98
|
-
y: PropTypes.shape({
|
|
99
|
-
index: PropTypes.number,
|
|
100
|
-
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired
|
|
101
|
-
})
|
|
102
|
-
}),
|
|
103
|
-
axisValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]),
|
|
104
|
-
classes: PropTypes.object,
|
|
105
|
-
dataIndex: PropTypes.number,
|
|
106
|
-
series: PropTypes.arrayOf(PropTypes.object),
|
|
107
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
108
|
-
}),
|
|
109
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
110
|
-
} : void 0;
|
|
111
76
|
export { ChartsAxisTooltipContent };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { useSlotProps } from '@mui/base/utils';
|
|
5
4
|
import { DefaultChartsItemTooltipContent } from './DefaultChartsItemTooltipContent';
|
|
6
5
|
import { useCartesianContext } from '../context/CartesianProvider';
|
|
@@ -8,6 +7,9 @@ import { ZAxisContext } from '../context/ZAxisContextProvider';
|
|
|
8
7
|
import { useColorProcessor } from '../hooks/useColor';
|
|
9
8
|
import { useSeries } from '../hooks/useSeries';
|
|
10
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* @ignore - internal component.
|
|
12
|
+
*/
|
|
11
13
|
function ChartsItemTooltipContent(props) {
|
|
12
14
|
const {
|
|
13
15
|
content,
|
|
@@ -47,29 +49,4 @@ function ChartsItemTooltipContent(props) {
|
|
|
47
49
|
});
|
|
48
50
|
return /*#__PURE__*/_jsx(Content, _extends({}, chartTooltipContentProps));
|
|
49
51
|
}
|
|
50
|
-
process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = {
|
|
51
|
-
// ----------------------------- Warning --------------------------------
|
|
52
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
53
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
54
|
-
// ----------------------------------------------------------------------
|
|
55
|
-
classes: PropTypes.object.isRequired,
|
|
56
|
-
content: PropTypes.elementType,
|
|
57
|
-
contentProps: PropTypes.shape({
|
|
58
|
-
classes: PropTypes.object,
|
|
59
|
-
getColor: PropTypes.func,
|
|
60
|
-
itemData: PropTypes.shape({
|
|
61
|
-
dataIndex: PropTypes.number,
|
|
62
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
63
|
-
type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
|
|
64
|
-
}),
|
|
65
|
-
series: PropTypes.object,
|
|
66
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
67
|
-
}),
|
|
68
|
-
itemData: PropTypes.shape({
|
|
69
|
-
dataIndex: PropTypes.number,
|
|
70
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
71
|
-
type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
|
|
72
|
-
}).isRequired,
|
|
73
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
74
|
-
} : void 0;
|
|
75
52
|
export { ChartsItemTooltipContent };
|