@mui/x-charts-pro 8.4.0 → 8.5.1
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/BarChartPro/BarChartPro.d.ts +13 -5
- package/BarChartPro/BarChartPro.js +19 -1
- package/CHANGELOG.md +215 -0
- package/ChartContainerPro/ChartContainerPro.d.ts +0 -1
- package/ChartContainerPro/ChartProApi.d.ts +28 -0
- package/ChartContainerPro/ChartProApi.js +5 -0
- package/ChartContainerPro/index.d.ts +2 -1
- package/ChartContainerPro/index.js +11 -0
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +19 -3
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
- package/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +25 -315
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +22 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +283 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +138 -0
- package/ChartZoomSlider/internals/constants.d.ts +5 -0
- package/ChartZoomSlider/internals/constants.js +11 -0
- package/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
- package/ChartZoomSlider/internals/zoom-utils.js +48 -0
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +5 -1
- package/ChartsToolbarPro/ChartsToolbarPro.js +35 -7
- package/ChartsToolbarPro/ChartsToolbarZoomInTrigger.d.ts +17 -0
- package/ChartsToolbarPro/ChartsToolbarZoomInTrigger.js +57 -0
- package/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.d.ts +17 -0
- package/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.js +57 -0
- package/ChartsToolbarPro/index.d.ts +3 -1
- package/ChartsToolbarPro/index.js +22 -0
- package/FunnelChart/FunnelChart.d.ts +2 -1
- package/FunnelChart/FunnelChart.js +2 -20
- package/FunnelChart/FunnelChart.plugins.d.ts +4 -0
- package/FunnelChart/FunnelChart.plugins.js +9 -0
- package/FunnelChart/FunnelPlot.js +10 -22
- package/FunnelChart/FunnelSection.d.ts +1 -1
- package/FunnelChart/FunnelSectionLabel.d.ts +21 -0
- package/FunnelChart/FunnelSectionLabel.js +52 -0
- package/FunnelChart/curves/bump.d.ts +10 -4
- package/FunnelChart/curves/bump.js +73 -41
- package/FunnelChart/curves/curve.types.d.ts +6 -1
- package/FunnelChart/curves/getFunnelCurve.js +3 -0
- package/FunnelChart/curves/linear.d.ts +9 -1
- package/FunnelChart/curves/linear.js +82 -5
- package/FunnelChart/funnel.types.d.ts +1 -0
- package/FunnelChart/funnelPlotSlots.types.d.ts +11 -0
- package/FunnelChart/funnelSectionClasses.d.ts +2 -0
- package/FunnelChart/funnelSectionClasses.js +17 -4
- package/FunnelChart/funnelSlots.types.d.ts +4 -3
- package/FunnelChart/index.d.ts +3 -1
- package/FunnelChart/index.js +18 -2
- package/FunnelChart/useFunnelChartProps.d.ts +2 -1
- package/FunnelChart/useFunnelChartProps.js +3 -1
- package/Heatmap/Heatmap.d.ts +22 -4
- package/Heatmap/Heatmap.js +64 -22
- package/Heatmap/Heatmap.plugins.d.ts +2 -1
- package/Heatmap/Heatmap.plugins.js +2 -1
- package/Heatmap/HeatmapTooltip/HeatmapTooltipAxesValue.d.ts +1 -1
- package/LineChartPro/LineChartPro.d.ts +13 -5
- package/LineChartPro/LineChartPro.js +19 -1
- package/PieChartPro/PieChartPro.d.ts +21 -0
- package/PieChartPro/PieChartPro.js +204 -0
- package/PieChartPro/PieChartPro.plugins.d.ts +4 -0
- package/PieChartPro/PieChartPro.plugins.js +9 -0
- package/PieChartPro/index.d.ts +1 -0
- package/PieChartPro/index.js +16 -0
- package/RadarChartPro/RadarChartPro.d.ts +15 -0
- package/RadarChartPro/RadarChartPro.js +202 -0
- package/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
- package/RadarChartPro/RadarChartPro.plugins.js +9 -0
- package/RadarChartPro/index.d.ts +1 -0
- package/RadarChartPro/index.js +16 -0
- package/ScatterChartPro/ScatterChartPro.d.ts +13 -5
- package/ScatterChartPro/ScatterChartPro.js +19 -1
- package/context/index.d.ts +1 -0
- package/context/index.js +16 -0
- package/context/useChartApiContext.d.ts +9 -0
- package/context/useChartApiContext.js +17 -0
- package/esm/BarChartPro/BarChartPro.d.ts +13 -5
- package/esm/BarChartPro/BarChartPro.js +19 -1
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +0 -1
- package/esm/ChartContainerPro/ChartProApi.d.ts +28 -0
- package/esm/ChartContainerPro/ChartProApi.js +1 -0
- package/esm/ChartContainerPro/index.d.ts +2 -1
- package/esm/ChartContainerPro/index.js +2 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +20 -4
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +19 -306
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +22 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +275 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +130 -0
- package/esm/ChartZoomSlider/internals/constants.d.ts +5 -0
- package/esm/ChartZoomSlider/internals/constants.js +5 -0
- package/esm/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
- package/esm/ChartZoomSlider/internals/zoom-utils.js +40 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +5 -1
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +36 -9
- package/esm/ChartsToolbarPro/ChartsToolbarZoomInTrigger.d.ts +17 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomInTrigger.js +51 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.d.ts +17 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.js +51 -0
- package/esm/ChartsToolbarPro/index.d.ts +3 -1
- package/esm/ChartsToolbarPro/index.js +3 -1
- package/esm/FunnelChart/FunnelChart.d.ts +2 -1
- package/esm/FunnelChart/FunnelChart.js +2 -20
- package/esm/FunnelChart/FunnelChart.plugins.d.ts +4 -0
- package/esm/FunnelChart/FunnelChart.plugins.js +3 -0
- package/esm/FunnelChart/FunnelPlot.js +10 -22
- package/esm/FunnelChart/FunnelSection.d.ts +1 -1
- package/esm/FunnelChart/FunnelSectionLabel.d.ts +21 -0
- package/esm/FunnelChart/FunnelSectionLabel.js +46 -0
- package/esm/FunnelChart/curves/bump.d.ts +10 -4
- package/esm/FunnelChart/curves/bump.js +73 -41
- package/esm/FunnelChart/curves/curve.types.d.ts +6 -1
- package/esm/FunnelChart/curves/getFunnelCurve.js +3 -0
- package/esm/FunnelChart/curves/linear.d.ts +9 -1
- package/esm/FunnelChart/curves/linear.js +82 -5
- package/esm/FunnelChart/funnel.types.d.ts +1 -0
- package/esm/FunnelChart/funnelPlotSlots.types.d.ts +11 -0
- package/esm/FunnelChart/funnelSectionClasses.d.ts +2 -0
- package/esm/FunnelChart/funnelSectionClasses.js +15 -3
- package/esm/FunnelChart/funnelSlots.types.d.ts +4 -3
- package/esm/FunnelChart/index.d.ts +3 -1
- package/esm/FunnelChart/index.js +3 -1
- package/esm/FunnelChart/useFunnelChartProps.d.ts +2 -1
- package/esm/FunnelChart/useFunnelChartProps.js +3 -1
- package/esm/Heatmap/Heatmap.d.ts +22 -4
- package/esm/Heatmap/Heatmap.js +64 -22
- package/esm/Heatmap/Heatmap.plugins.d.ts +2 -1
- package/esm/Heatmap/Heatmap.plugins.js +2 -1
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipAxesValue.d.ts +1 -1
- package/esm/LineChartPro/LineChartPro.d.ts +13 -5
- package/esm/LineChartPro/LineChartPro.js +19 -1
- package/esm/PieChartPro/PieChartPro.d.ts +21 -0
- package/esm/PieChartPro/PieChartPro.js +197 -0
- package/esm/PieChartPro/PieChartPro.plugins.d.ts +4 -0
- package/esm/PieChartPro/PieChartPro.plugins.js +3 -0
- package/esm/PieChartPro/index.d.ts +1 -0
- package/esm/PieChartPro/index.js +1 -0
- package/esm/RadarChartPro/RadarChartPro.d.ts +15 -0
- package/esm/RadarChartPro/RadarChartPro.js +195 -0
- package/esm/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
- package/esm/RadarChartPro/RadarChartPro.plugins.js +3 -0
- package/esm/RadarChartPro/index.d.ts +1 -0
- package/esm/RadarChartPro/index.js +1 -0
- package/esm/ScatterChartPro/ScatterChartPro.d.ts +13 -5
- package/esm/ScatterChartPro/ScatterChartPro.js +19 -1
- package/esm/context/index.d.ts +1 -0
- package/esm/context/index.js +1 -0
- package/esm/context/useChartApiContext.d.ts +9 -0
- package/esm/context/useChartApiContext.js +11 -0
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/index.d.ts +3 -1
- package/esm/index.js +3 -1
- package/esm/internals/material/index.d.ts +1 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +10 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +15 -1
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
- package/esm/models/index.d.ts +1 -1
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +21 -10
- package/index.d.ts +3 -1
- package/index.js +23 -1
- package/internals/material/index.d.ts +1 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.js +10 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +16 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
- package/models/index.d.ts +1 -1
- package/package.json +7 -7
- package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
- package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -36
- package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
- package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -36
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -29
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -29
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["axisId", "axisDirection", "reverse", "onSelectStart", "onSelectEnd"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useChartContext, getSVGPoint, selectorChartAxisZoomOptionsLookup, useStore } from '@mui/x-charts/internals';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
import { rafThrottle } from '@mui/x-internals/rafThrottle';
|
|
8
|
+
import { shouldForwardProp } from '@mui/system';
|
|
9
|
+
import { calculateZoomEnd, calculateZoomFromPoint, calculateZoomStart } from "./zoom-utils.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
const ZoomSliderTrack = styled('rect', {
|
|
12
|
+
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'axisDirection' && prop !== 'isSelecting'
|
|
13
|
+
})(({
|
|
14
|
+
theme
|
|
15
|
+
}) => ({
|
|
16
|
+
fill: theme.palette.mode === 'dark' ? (theme.vars || theme).palette.grey[800] : (theme.vars || theme).palette.grey[300],
|
|
17
|
+
cursor: 'pointer',
|
|
18
|
+
variants: [{
|
|
19
|
+
props: {
|
|
20
|
+
axisDirection: 'x',
|
|
21
|
+
isSelecting: true
|
|
22
|
+
},
|
|
23
|
+
style: {
|
|
24
|
+
cursor: 'ew-resize'
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
props: {
|
|
28
|
+
axisDirection: 'y',
|
|
29
|
+
isSelecting: true
|
|
30
|
+
},
|
|
31
|
+
style: {
|
|
32
|
+
cursor: 'ns-resize'
|
|
33
|
+
}
|
|
34
|
+
}]
|
|
35
|
+
}));
|
|
36
|
+
export function ChartAxisZoomSliderTrack(_ref) {
|
|
37
|
+
let {
|
|
38
|
+
axisId,
|
|
39
|
+
axisDirection,
|
|
40
|
+
onSelectStart,
|
|
41
|
+
onSelectEnd
|
|
42
|
+
} = _ref,
|
|
43
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
44
|
+
const ref = React.useRef(null);
|
|
45
|
+
const {
|
|
46
|
+
instance,
|
|
47
|
+
svgRef
|
|
48
|
+
} = useChartContext();
|
|
49
|
+
const store = useStore();
|
|
50
|
+
const [isSelecting, setIsSelecting] = React.useState(false);
|
|
51
|
+
const onPointerDown = function onPointerDown(event) {
|
|
52
|
+
const rect = ref.current;
|
|
53
|
+
const element = svgRef.current;
|
|
54
|
+
if (!rect || !element) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const pointerDownPoint = getSVGPoint(element, event);
|
|
58
|
+
let zoomFromPointerDown = calculateZoomFromPoint(store.getSnapshot(), axisId, pointerDownPoint);
|
|
59
|
+
if (zoomFromPointerDown === null) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const {
|
|
63
|
+
minStart,
|
|
64
|
+
maxEnd
|
|
65
|
+
} = selectorChartAxisZoomOptionsLookup(store.getSnapshot(), axisId);
|
|
66
|
+
|
|
67
|
+
// Ensure the zoomFromPointerDown is within the min and max range
|
|
68
|
+
zoomFromPointerDown = Math.max(Math.min(zoomFromPointerDown, maxEnd), minStart);
|
|
69
|
+
const onPointerMove = rafThrottle(function onPointerMove(pointerMoveEvent) {
|
|
70
|
+
const pointerMovePoint = getSVGPoint(element, pointerMoveEvent);
|
|
71
|
+
const zoomFromPointerMove = calculateZoomFromPoint(store.getSnapshot(), axisId, pointerMovePoint);
|
|
72
|
+
if (zoomFromPointerMove === null) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const zoomOptions = selectorChartAxisZoomOptionsLookup(store.getSnapshot(), axisId);
|
|
76
|
+
instance.setAxisZoomData(axisId, prevZoomData => {
|
|
77
|
+
if (zoomFromPointerMove > zoomFromPointerDown) {
|
|
78
|
+
const end = calculateZoomEnd(zoomFromPointerMove, _extends({}, prevZoomData, {
|
|
79
|
+
start: zoomFromPointerDown
|
|
80
|
+
}), zoomOptions);
|
|
81
|
+
|
|
82
|
+
/* If the starting point is too close to the end that minSpan wouldn't be respected, we need to update the
|
|
83
|
+
* start point. */
|
|
84
|
+
const start = calculateZoomStart(zoomFromPointerDown, _extends({}, prevZoomData, {
|
|
85
|
+
start: zoomFromPointerDown,
|
|
86
|
+
end
|
|
87
|
+
}), zoomOptions);
|
|
88
|
+
return _extends({}, prevZoomData, {
|
|
89
|
+
start,
|
|
90
|
+
end
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const start = calculateZoomStart(zoomFromPointerMove, _extends({}, prevZoomData, {
|
|
94
|
+
end: zoomFromPointerDown
|
|
95
|
+
}), zoomOptions);
|
|
96
|
+
|
|
97
|
+
/* If the starting point is too close to the start that minSpan wouldn't be respected, we need to update the
|
|
98
|
+
* start point. */
|
|
99
|
+
const end = calculateZoomEnd(zoomFromPointerDown, _extends({}, prevZoomData, {
|
|
100
|
+
start,
|
|
101
|
+
end: zoomFromPointerDown
|
|
102
|
+
}), zoomOptions);
|
|
103
|
+
return _extends({}, prevZoomData, {
|
|
104
|
+
start,
|
|
105
|
+
end
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
const onPointerUp = function onPointerUp(pointerUpEvent) {
|
|
110
|
+
rect.releasePointerCapture(pointerUpEvent.pointerId);
|
|
111
|
+
rect.removeEventListener('pointermove', onPointerMove);
|
|
112
|
+
document.removeEventListener('pointerup', onPointerUp);
|
|
113
|
+
setIsSelecting(false);
|
|
114
|
+
onSelectEnd?.();
|
|
115
|
+
};
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
rect.setPointerCapture(event.pointerId);
|
|
119
|
+
document.addEventListener('pointerup', onPointerUp);
|
|
120
|
+
rect.addEventListener('pointermove', onPointerMove);
|
|
121
|
+
onSelectStart?.();
|
|
122
|
+
setIsSelecting(true);
|
|
123
|
+
};
|
|
124
|
+
return /*#__PURE__*/_jsx(ZoomSliderTrack, _extends({
|
|
125
|
+
ref: ref,
|
|
126
|
+
onPointerDown: onPointerDown,
|
|
127
|
+
axisDirection: axisDirection,
|
|
128
|
+
isSelecting: isSelecting
|
|
129
|
+
}, other));
|
|
130
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const ZOOM_SLIDER_TRACK_SIZE = 8;
|
|
2
|
+
export const ZOOM_SLIDER_ACTIVE_TRACK_SIZE = 10;
|
|
3
|
+
export const ZOOM_SLIDER_THUMB_HEIGHT = 20;
|
|
4
|
+
export const ZOOM_SLIDER_THUMB_WIDTH = 10;
|
|
5
|
+
export const ZOOM_SLIDER_SIZE = Math.max(ZOOM_SLIDER_TRACK_SIZE, ZOOM_SLIDER_ACTIVE_TRACK_SIZE, ZOOM_SLIDER_THUMB_HEIGHT, ZOOM_SLIDER_THUMB_WIDTH);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AxisId, ChartState, DefaultizedZoomOptions, ZoomData } from '@mui/x-charts/internals';
|
|
2
|
+
export declare function calculateZoomFromPoint(state: ChartState<any>, axisId: AxisId, point: DOMPoint): number | null;
|
|
3
|
+
export declare function calculateZoomStart(newStart: number, currentZoom: ZoomData, options: Pick<DefaultizedZoomOptions, 'minStart' | 'minSpan' | 'maxSpan'>): number;
|
|
4
|
+
export declare function calculateZoomEnd(newEnd: number, currentZoom: ZoomData, options: Pick<DefaultizedZoomOptions, 'maxEnd' | 'minSpan' | 'maxSpan'>): number;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { selectorChartDrawingArea, selectorChartRawAxis } from '@mui/x-charts/internals';
|
|
2
|
+
export function calculateZoomFromPoint(state, axisId, point) {
|
|
3
|
+
const {
|
|
4
|
+
left,
|
|
5
|
+
top,
|
|
6
|
+
height,
|
|
7
|
+
width
|
|
8
|
+
} = selectorChartDrawingArea(state);
|
|
9
|
+
const axis = selectorChartRawAxis(state, axisId);
|
|
10
|
+
if (!axis) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const axisDirection = axis.position === 'right' || axis.position === 'left' ? 'y' : 'x';
|
|
14
|
+
let pointerZoom;
|
|
15
|
+
if (axisDirection === 'x') {
|
|
16
|
+
pointerZoom = (point.x - left) / width * 100;
|
|
17
|
+
} else {
|
|
18
|
+
pointerZoom = (top + height - point.y) / height * 100;
|
|
19
|
+
}
|
|
20
|
+
if (axis.reverse) {
|
|
21
|
+
pointerZoom = 100 - pointerZoom;
|
|
22
|
+
}
|
|
23
|
+
return pointerZoom;
|
|
24
|
+
}
|
|
25
|
+
export function calculateZoomStart(newStart, currentZoom, options) {
|
|
26
|
+
const {
|
|
27
|
+
minStart,
|
|
28
|
+
minSpan,
|
|
29
|
+
maxSpan
|
|
30
|
+
} = options;
|
|
31
|
+
return Math.max(minStart, currentZoom.end - maxSpan, Math.min(currentZoom.end - minSpan, newStart));
|
|
32
|
+
}
|
|
33
|
+
export function calculateZoomEnd(newEnd, currentZoom, options) {
|
|
34
|
+
const {
|
|
35
|
+
maxEnd,
|
|
36
|
+
minSpan,
|
|
37
|
+
maxSpan
|
|
38
|
+
} = options;
|
|
39
|
+
return Math.min(maxEnd, currentZoom.start + maxSpan, Math.max(currentZoom.start + minSpan, newEnd));
|
|
40
|
+
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { ChartsToolbarProps } from '@mui/x-charts/Toolbar';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The chart toolbar component for the pro package.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ChartsToolbarPro(props: ChartsToolbarProps): React.JSX.Element | null;
|
|
@@ -1,24 +1,51 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { Toolbar, ToolbarButton } from '@mui/x-charts/Toolbar';
|
|
2
3
|
import * as React from 'react';
|
|
3
|
-
import { useChartContext, useSelector } from '@mui/x-charts/internals';
|
|
4
|
+
import { useChartContext, useSelector, useChartsSlots } from '@mui/x-charts/internals';
|
|
5
|
+
import { useChartsLocalization } from '@mui/x-charts/hooks';
|
|
4
6
|
import { selectorChartZoomIsEnabled } from "../internals/plugins/useChartProZoom/index.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
+
import { ChartsToolbarZoomInTrigger } from "./ChartsToolbarZoomInTrigger.js";
|
|
8
|
+
import { ChartsToolbarZoomOutTrigger } from "./ChartsToolbarZoomOutTrigger.js";
|
|
7
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The chart toolbar component for the pro package.
|
|
12
|
+
*/
|
|
13
|
+
export function ChartsToolbarPro(props) {
|
|
14
|
+
const {
|
|
15
|
+
slots,
|
|
16
|
+
slotProps
|
|
17
|
+
} = useChartsSlots();
|
|
9
18
|
const {
|
|
10
19
|
store
|
|
11
20
|
} = useChartContext();
|
|
21
|
+
const {
|
|
22
|
+
localeText
|
|
23
|
+
} = useChartsLocalization();
|
|
12
24
|
const isZoomEnabled = useSelector(store, selectorChartZoomIsEnabled);
|
|
13
25
|
const children = [];
|
|
14
26
|
if (isZoomEnabled) {
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
const Tooltip = slots.baseTooltip;
|
|
28
|
+
const ZoomOutIcon = slots.zoomOutIcon;
|
|
29
|
+
const ZoomInIcon = slots.zoomInIcon;
|
|
30
|
+
children.push(/*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps.baseTooltip, {
|
|
31
|
+
title: localeText.zoomIn,
|
|
32
|
+
children: /*#__PURE__*/_jsx(ChartsToolbarZoomInTrigger, {
|
|
33
|
+
render: /*#__PURE__*/_jsx(ToolbarButton, {}),
|
|
34
|
+
children: /*#__PURE__*/_jsx(ZoomInIcon, _extends({}, slotProps.zoomInIcon))
|
|
35
|
+
})
|
|
36
|
+
}), "zoom-in"));
|
|
37
|
+
children.push(/*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps.baseTooltip, {
|
|
38
|
+
title: localeText.zoomOut,
|
|
39
|
+
children: /*#__PURE__*/_jsx(ChartsToolbarZoomOutTrigger, {
|
|
40
|
+
render: /*#__PURE__*/_jsx(ToolbarButton, {}),
|
|
41
|
+
children: /*#__PURE__*/_jsx(ZoomOutIcon, _extends({}, slotProps.zoomOutIcon))
|
|
42
|
+
})
|
|
43
|
+
}), "zoom-out"));
|
|
17
44
|
}
|
|
18
45
|
if (children.length === 0) {
|
|
19
46
|
return null;
|
|
20
47
|
}
|
|
21
|
-
return /*#__PURE__*/_jsx(Toolbar, {
|
|
48
|
+
return /*#__PURE__*/_jsx(Toolbar, _extends({}, props, {
|
|
22
49
|
children: children
|
|
23
|
-
});
|
|
50
|
+
}));
|
|
24
51
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsSlotProps } from '@mui/x-charts/internals';
|
|
3
|
+
import { RenderProp } from '@mui/x-internals/useComponentRenderer';
|
|
4
|
+
interface ChartsToolbarZoomInTriggerProps {
|
|
5
|
+
/**
|
|
6
|
+
* A function to customize the rendering of the component.
|
|
7
|
+
*/
|
|
8
|
+
render?: RenderProp<ChartsSlotProps['baseButton']>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A button that zooms the chart in.
|
|
12
|
+
* It renders the `baseButton` slot.
|
|
13
|
+
*/
|
|
14
|
+
declare const ChartsToolbarZoomInTrigger: React.ForwardRefExoticComponent<ChartsToolbarZoomInTriggerProps & {
|
|
15
|
+
children?: React.ReactNode | undefined;
|
|
16
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
export { ChartsToolbarZoomInTrigger };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["render"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { useChartContext, useSelector, useChartsSlots } from '@mui/x-charts/internals';
|
|
9
|
+
import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
|
|
10
|
+
import { selectorChartCanZoomIn } from "../internals/plugins/useChartProZoom/index.js";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* A button that zooms the chart in.
|
|
14
|
+
* It renders the `baseButton` slot.
|
|
15
|
+
*/
|
|
16
|
+
const ChartsToolbarZoomInTrigger = /*#__PURE__*/React.forwardRef(function ChartsToolbarZoomInTrigger(_ref, ref) {
|
|
17
|
+
let {
|
|
18
|
+
render
|
|
19
|
+
} = _ref,
|
|
20
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21
|
+
const {
|
|
22
|
+
slots,
|
|
23
|
+
slotProps
|
|
24
|
+
} = useChartsSlots();
|
|
25
|
+
const {
|
|
26
|
+
instance,
|
|
27
|
+
store
|
|
28
|
+
} = useChartContext();
|
|
29
|
+
const disabled = useSelector(store, selectorChartCanZoomIn);
|
|
30
|
+
const element = useComponentRenderer(slots.baseButton, render, _extends({}, slotProps.baseButton, {
|
|
31
|
+
onClick: () => instance.zoomIn(),
|
|
32
|
+
disabled
|
|
33
|
+
}, other, {
|
|
34
|
+
ref
|
|
35
|
+
}));
|
|
36
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
37
|
+
children: element
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
if (process.env.NODE_ENV !== "production") ChartsToolbarZoomInTrigger.displayName = "ChartsToolbarZoomInTrigger";
|
|
41
|
+
process.env.NODE_ENV !== "production" ? ChartsToolbarZoomInTrigger.propTypes = {
|
|
42
|
+
// ----------------------------- Warning --------------------------------
|
|
43
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
44
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
45
|
+
// ----------------------------------------------------------------------
|
|
46
|
+
/**
|
|
47
|
+
* A function to customize the rendering of the component.
|
|
48
|
+
*/
|
|
49
|
+
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
50
|
+
} : void 0;
|
|
51
|
+
export { ChartsToolbarZoomInTrigger };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsSlotProps } from '@mui/x-charts/internals';
|
|
3
|
+
import { RenderProp } from '@mui/x-internals/useComponentRenderer';
|
|
4
|
+
interface ChartsToolbarZoomOutTriggerProps {
|
|
5
|
+
/**
|
|
6
|
+
* A function to customize the rendering of the component.
|
|
7
|
+
*/
|
|
8
|
+
render?: RenderProp<ChartsSlotProps['baseButton']>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A button that zooms the chart out.
|
|
12
|
+
* It renders the `baseButton` slot.
|
|
13
|
+
*/
|
|
14
|
+
declare const ChartsToolbarZoomOutTrigger: React.ForwardRefExoticComponent<ChartsToolbarZoomOutTriggerProps & {
|
|
15
|
+
children?: React.ReactNode | undefined;
|
|
16
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
export { ChartsToolbarZoomOutTrigger };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["render"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { useChartContext, useSelector, useChartsSlots } from '@mui/x-charts/internals';
|
|
9
|
+
import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
|
|
10
|
+
import { selectorChartCanZoomOut } from "../internals/plugins/useChartProZoom/index.js";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* A button that zooms the chart out.
|
|
14
|
+
* It renders the `baseButton` slot.
|
|
15
|
+
*/
|
|
16
|
+
const ChartsToolbarZoomOutTrigger = /*#__PURE__*/React.forwardRef(function ChartsToolbarZoomOutTrigger(_ref, ref) {
|
|
17
|
+
let {
|
|
18
|
+
render
|
|
19
|
+
} = _ref,
|
|
20
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21
|
+
const {
|
|
22
|
+
slots,
|
|
23
|
+
slotProps
|
|
24
|
+
} = useChartsSlots();
|
|
25
|
+
const {
|
|
26
|
+
instance,
|
|
27
|
+
store
|
|
28
|
+
} = useChartContext();
|
|
29
|
+
const disabled = useSelector(store, selectorChartCanZoomOut);
|
|
30
|
+
const element = useComponentRenderer(slots.baseButton, render, _extends({}, slotProps.baseButton, {
|
|
31
|
+
onClick: () => instance.zoomOut(),
|
|
32
|
+
disabled
|
|
33
|
+
}, other, {
|
|
34
|
+
ref
|
|
35
|
+
}));
|
|
36
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
37
|
+
children: element
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
if (process.env.NODE_ENV !== "production") ChartsToolbarZoomOutTrigger.displayName = "ChartsToolbarZoomOutTrigger";
|
|
41
|
+
process.env.NODE_ENV !== "production" ? ChartsToolbarZoomOutTrigger.propTypes = {
|
|
42
|
+
// ----------------------------- Warning --------------------------------
|
|
43
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
44
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
45
|
+
// ----------------------------------------------------------------------
|
|
46
|
+
/**
|
|
47
|
+
* A function to customize the rendering of the component.
|
|
48
|
+
*/
|
|
49
|
+
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
50
|
+
} : void 0;
|
|
51
|
+
export { ChartsToolbarZoomOutTrigger };
|
|
@@ -7,7 +7,8 @@ import { FunnelSeriesType } from "./funnel.types.js";
|
|
|
7
7
|
import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
8
8
|
import { FunnelChartSlotExtension } from "./funnelSlots.types.js";
|
|
9
9
|
import { CategoryAxis } from "./categoryAxis.types.js";
|
|
10
|
-
|
|
10
|
+
import { FunnelChartPluginsSignatures } from "./FunnelChart.plugins.js";
|
|
11
|
+
export interface FunnelChartProps extends Omit<ChartContainerProProps<'funnel', FunnelChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis' | 'zoom' | 'onZoomChange' | 'dataset' | 'yAxis' | 'xAxis' | 'rotationAxis' | 'radiusAxis' | 'slots' | 'slotProps'>, Omit<FunnelPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, FunnelChartSlotExtension {
|
|
11
12
|
/**
|
|
12
13
|
* The series to display in the funnel chart.
|
|
13
14
|
* An array of [[FunnelSeriesType]] objects.
|
|
@@ -60,8 +60,7 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
60
60
|
apiRef: PropTypes.shape({
|
|
61
61
|
current: PropTypes.shape({
|
|
62
62
|
exportAsImage: PropTypes.func.isRequired,
|
|
63
|
-
exportAsPrint: PropTypes.func.isRequired
|
|
64
|
-
setZoomData: PropTypes.func.isRequired
|
|
63
|
+
exportAsPrint: PropTypes.func.isRequired
|
|
65
64
|
})
|
|
66
65
|
}),
|
|
67
66
|
/**
|
|
@@ -200,15 +199,6 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
200
199
|
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
201
200
|
*/
|
|
202
201
|
id: PropTypes.string,
|
|
203
|
-
/**
|
|
204
|
-
* The list of zoom data related to each axis.
|
|
205
|
-
* Used to initialize the zoom in a specific configuration without controlling it.
|
|
206
|
-
*/
|
|
207
|
-
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
208
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
209
|
-
end: PropTypes.number.isRequired,
|
|
210
|
-
start: PropTypes.number.isRequired
|
|
211
|
-
})),
|
|
212
202
|
/**
|
|
213
203
|
* If `true`, a loading overlay is displayed.
|
|
214
204
|
* @default false
|
|
@@ -275,14 +265,6 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
275
265
|
/**
|
|
276
266
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
277
267
|
*/
|
|
278
|
-
width: PropTypes.number
|
|
279
|
-
/**
|
|
280
|
-
* The list of zoom data related to each axis.
|
|
281
|
-
*/
|
|
282
|
-
zoomData: PropTypes.arrayOf(PropTypes.shape({
|
|
283
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
284
|
-
end: PropTypes.number.isRequired,
|
|
285
|
-
start: PropTypes.number.isRequired
|
|
286
|
-
}))
|
|
268
|
+
width: PropTypes.number
|
|
287
269
|
} : void 0;
|
|
288
270
|
export { FunnelChart };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ConvertSignaturesIntoPlugins, UseChartCartesianAxisSignature, UseChartHighlightSignature, UseChartInteractionSignature } from '@mui/x-charts/internals';
|
|
2
|
+
import { UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
|
|
3
|
+
export type FunnelChartPluginsSignatures = [UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProExportSignature];
|
|
4
|
+
export declare const FUNNEL_CHART_PLUGINS: ConvertSignaturesIntoPlugins<FunnelChartPluginsSignatures>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { useChartCartesianAxis, useChartHighlight, useChartInteraction } from '@mui/x-charts/internals';
|
|
2
|
+
import { useChartProExport } from "../internals/plugins/useChartProExport/index.js";
|
|
3
|
+
export const FUNNEL_CHART_PLUGINS = [useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartProExport];
|
|
@@ -6,11 +6,11 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { line as d3Line } from '@mui/x-charts-vendor/d3-shape';
|
|
7
7
|
import { cartesianSeriesTypes } from '@mui/x-charts/internals';
|
|
8
8
|
import { useXAxes, useYAxes } from '@mui/x-charts/hooks';
|
|
9
|
-
import { useTheme } from '@mui/material/styles';
|
|
10
9
|
import { FunnelSection } from "./FunnelSection.js";
|
|
11
10
|
import { alignLabel, positionLabel } from "./labelUtils.js";
|
|
12
11
|
import { useFunnelSeriesContext } from "../hooks/useFunnelSeries.js";
|
|
13
12
|
import { getFunnelCurve } from "./curves/index.js";
|
|
13
|
+
import { FunnelSectionLabel } from "./FunnelSectionLabel.js";
|
|
14
14
|
import { createElement as _createElement } from "react";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
cartesianSeriesTypes.addType('funnel');
|
|
@@ -122,7 +122,6 @@ function FunnelPlot(props) {
|
|
|
122
122
|
gap
|
|
123
123
|
} = props,
|
|
124
124
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
125
|
-
const theme = useTheme();
|
|
126
125
|
const data = useAggregatedData(gap);
|
|
127
126
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
128
127
|
children: [data.map(({
|
|
@@ -148,29 +147,18 @@ function FunnelPlot(props) {
|
|
|
148
147
|
})
|
|
149
148
|
}))), data.map(({
|
|
150
149
|
id,
|
|
151
|
-
label
|
|
150
|
+
label,
|
|
151
|
+
seriesId,
|
|
152
|
+
dataIndex
|
|
152
153
|
}) => {
|
|
153
|
-
if (!label) {
|
|
154
|
+
if (!label || !label.value) {
|
|
154
155
|
return null;
|
|
155
156
|
}
|
|
156
|
-
return /*#__PURE__*/_jsx(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
stroke: "none",
|
|
162
|
-
pointerEvents: "none",
|
|
163
|
-
fontFamily: theme.typography.body2.fontFamily,
|
|
164
|
-
fontSize: theme.typography.body2.fontSize,
|
|
165
|
-
fontSizeAdjust: theme.typography.body2.fontSizeAdjust,
|
|
166
|
-
fontWeight: theme.typography.body2.fontWeight,
|
|
167
|
-
letterSpacing: theme.typography.body2.letterSpacing,
|
|
168
|
-
fontStretch: theme.typography.body2.fontStretch,
|
|
169
|
-
fontStyle: theme.typography.body2.fontStyle,
|
|
170
|
-
fontVariant: theme.typography.body2.fontVariant,
|
|
171
|
-
fill: (theme.vars || theme)?.palette?.text?.primary,
|
|
172
|
-
children: label.value
|
|
173
|
-
}, id);
|
|
157
|
+
return /*#__PURE__*/_jsx(FunnelSectionLabel, _extends({
|
|
158
|
+
label: label,
|
|
159
|
+
dataIndex: dataIndex,
|
|
160
|
+
seriesId: seriesId
|
|
161
|
+
}, other), id);
|
|
174
162
|
})]
|
|
175
163
|
});
|
|
176
164
|
}
|
|
@@ -8,7 +8,7 @@ export interface FunnelSectionProps extends Omit<React.SVGProps<SVGPathElement>,
|
|
|
8
8
|
classes?: Partial<FunnelSectionClasses>;
|
|
9
9
|
variant?: 'filled' | 'outlined';
|
|
10
10
|
}
|
|
11
|
-
export declare const FunnelSectionPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, React.SVGProps<SVGPathElement>, {}>;
|
|
11
|
+
export declare const FunnelSectionPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.SVGProps<SVGPathElement>, {}>;
|
|
12
12
|
/**
|
|
13
13
|
* @ignore - internal component.
|
|
14
14
|
*/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SeriesId } from '@mui/x-charts/internals';
|
|
3
|
+
import { FunnelSectionClasses } from "./funnelSectionClasses.js";
|
|
4
|
+
export interface FunnelSectionLabelConfig {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
value: string | null;
|
|
8
|
+
textAnchor?: React.SVGProps<SVGTextElement>['textAnchor'];
|
|
9
|
+
dominantBaseline?: React.SVGProps<SVGTextElement>['dominantBaseline'];
|
|
10
|
+
}
|
|
11
|
+
export interface FunnelSectionLabelProps extends Omit<React.SVGProps<SVGTextElement>, 'ref' | 'id'> {
|
|
12
|
+
classes?: Partial<FunnelSectionClasses>;
|
|
13
|
+
label: FunnelSectionLabelConfig;
|
|
14
|
+
seriesId: SeriesId;
|
|
15
|
+
dataIndex: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @ignore - internal component.
|
|
19
|
+
*/
|
|
20
|
+
declare const FunnelSectionLabel: React.ForwardRefExoticComponent<FunnelSectionLabelProps & React.RefAttributes<{}>>;
|
|
21
|
+
export { FunnelSectionLabel };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["classes", "color", "onClick", "className", "label", "seriesId", "dataIndex"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { useTheme } from '@mui/material/styles';
|
|
8
|
+
import { consumeSlots } from '@mui/x-charts/internals';
|
|
9
|
+
import { useLabelUtilityClasses } from "./funnelSectionClasses.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
/**
|
|
12
|
+
* @ignore - internal component.
|
|
13
|
+
*/
|
|
14
|
+
const FunnelSectionLabel = consumeSlots('MuiFunnelSectionLabel', 'funnelSectionLabel', {
|
|
15
|
+
classesResolver: useLabelUtilityClasses
|
|
16
|
+
}, /*#__PURE__*/React.forwardRef(function FunnelSectionLabel(props, ref) {
|
|
17
|
+
const {
|
|
18
|
+
classes,
|
|
19
|
+
label
|
|
20
|
+
} = props,
|
|
21
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
|
+
const theme = useTheme();
|
|
23
|
+
return /*#__PURE__*/_jsx("text", _extends({
|
|
24
|
+
stroke: "none",
|
|
25
|
+
pointerEvents: "none",
|
|
26
|
+
fontFamily: theme.typography.body2.fontFamily,
|
|
27
|
+
fontSize: theme.typography.body2.fontSize,
|
|
28
|
+
fontSizeAdjust: theme.typography.body2.fontSizeAdjust,
|
|
29
|
+
fontWeight: theme.typography.body2.fontWeight,
|
|
30
|
+
letterSpacing: theme.typography.body2.letterSpacing,
|
|
31
|
+
fontStretch: theme.typography.body2.fontStretch,
|
|
32
|
+
fontStyle: theme.typography.body2.fontStyle,
|
|
33
|
+
fontVariant: theme.typography.body2.fontVariant,
|
|
34
|
+
fill: (theme.vars || theme)?.palette?.text?.primary,
|
|
35
|
+
className: classes?.label,
|
|
36
|
+
x: label.x,
|
|
37
|
+
y: label.y,
|
|
38
|
+
textAnchor: label.textAnchor ?? 'middle',
|
|
39
|
+
dominantBaseline: label.dominantBaseline ?? 'central'
|
|
40
|
+
}, other, {
|
|
41
|
+
ref: ref,
|
|
42
|
+
children: label.value
|
|
43
|
+
}));
|
|
44
|
+
}));
|
|
45
|
+
if (process.env.NODE_ENV !== "production") FunnelSectionLabel.displayName = "FunnelSectionLabel";
|
|
46
|
+
export { FunnelSectionLabel };
|
|
@@ -10,18 +10,24 @@ import { CurveOptions } from "./curve.types.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class Bump implements CurveGenerator {
|
|
12
12
|
private context;
|
|
13
|
-
private x;
|
|
14
|
-
private y;
|
|
15
|
-
private currentPoint;
|
|
16
13
|
private isHorizontal;
|
|
17
14
|
private gap;
|
|
15
|
+
private min;
|
|
16
|
+
private max;
|
|
17
|
+
private points;
|
|
18
18
|
constructor(context: CanvasRenderingContext2D, {
|
|
19
19
|
isHorizontal,
|
|
20
|
-
gap
|
|
20
|
+
gap,
|
|
21
|
+
min,
|
|
22
|
+
max,
|
|
23
|
+
isIncreasing
|
|
21
24
|
}: CurveOptions);
|
|
22
25
|
areaStart(): void;
|
|
23
26
|
areaEnd(): void;
|
|
24
27
|
lineStart(): void;
|
|
25
28
|
lineEnd(): void;
|
|
26
29
|
point(x: number, y: number): void;
|
|
30
|
+
private drawPath;
|
|
31
|
+
private drawHorizontalPath;
|
|
32
|
+
private drawVerticalPath;
|
|
27
33
|
}
|