@mui/x-charts-pro 8.27.2 → 9.0.0-alpha.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 +1 -1
- package/BarChartPro/BarChartPro.js +30 -8
- package/CHANGELOG.md +279 -34
- package/ChartContainerPro/ChartContainerPro.d.ts +17 -31
- package/ChartContainerPro/ChartContainerPro.js +14 -287
- package/ChartContainerPro/useChartContainerProProps.d.ts +10 -7
- package/ChartContainerPro/useChartContainerProProps.js +10 -35
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +5 -3
- package/ChartDataProviderPro/ChartDataProviderPro.js +2 -2
- package/ChartDataProviderPro/index.d.ts +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -3
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +8 -6
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +6 -4
- package/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +1 -1
- package/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +4 -4
- package/ChartZoomSlider/internals/previews/BarPreviewPlot.js +1 -1
- package/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +1 -1
- package/ChartZoomSlider/internals/previews/LinePreviewPlot.js +4 -4
- package/ChartsContainer/index.d.ts +1 -0
- package/ChartsContainer/index.js +16 -0
- package/ChartsContainerPro/ChartsContainerPro.d.ts +37 -0
- package/ChartsContainerPro/ChartsContainerPro.js +188 -0
- package/ChartsContainerPro/index.d.ts +9 -0
- package/ChartsContainerPro/index.js +17 -0
- package/ChartsContainerPro/useChartsContainerProProps.d.ts +8 -0
- package/ChartsContainerPro/useChartsContainerProProps.js +44 -0
- package/FunnelChart/FunnelChart.d.ts +1 -1
- package/FunnelChart/FunnelChart.js +9 -8
- package/FunnelChart/FunnelSection.d.ts +1 -1
- package/FunnelChart/funnel.types.d.ts +1 -1
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +12 -9
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +3 -2
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
- package/FunnelChart/funnelSlots.types.d.ts +3 -9
- package/FunnelChart/index.d.ts +2 -1
- package/FunnelChart/index.js +12 -0
- package/FunnelChart/seriesConfig/index.js +2 -1
- package/FunnelChart/seriesConfig/keyboardFocusHandler.js +1 -14
- package/FunnelChart/seriesConfig/legend.js +0 -1
- package/Heatmap/Heatmap.d.ts +6 -3
- package/Heatmap/Heatmap.js +46 -135
- package/Heatmap/Heatmap.types.d.ts +19 -0
- package/Heatmap/Heatmap.types.js +5 -0
- package/Heatmap/HeatmapItem.d.ts +6 -0
- package/Heatmap/HeatmapItem.js +11 -3
- package/Heatmap/HeatmapPlot.d.ts +7 -3
- package/Heatmap/HeatmapPlot.js +16 -54
- package/Heatmap/HeatmapSVGPlot.d.ts +2 -0
- package/Heatmap/HeatmapSVGPlot.js +70 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +18 -2
- package/Heatmap/HeatmapTooltip/index.d.ts +1 -1
- package/Heatmap/index.d.ts +3 -2
- package/Heatmap/seriesConfig/getItemAtPosition.d.ts +2 -2
- package/Heatmap/seriesConfig/getItemAtPosition.js +6 -2
- package/Heatmap/seriesConfig/index.js +1 -0
- package/Heatmap/useHeatmapProps.d.ts +24 -0
- package/Heatmap/useHeatmapProps.js +159 -0
- package/LineChartPro/LineChartPro.d.ts +1 -1
- package/LineChartPro/LineChartPro.js +30 -8
- package/PieChartPro/PieChartPro.d.ts +1 -1
- package/PieChartPro/PieChartPro.js +9 -8
- package/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/RadarChartPro/RadarChartPro.js +8 -8
- package/SankeyChart/SankeyChart.d.ts +1 -1
- package/SankeyChart/SankeyChart.js +9 -23
- package/SankeyChart/SankeyTooltip/SankeyTooltip.types.d.ts +5 -1
- package/SankeyChart/SankeyTooltip/index.d.ts +1 -1
- package/SankeyChart/index.d.ts +1 -1
- package/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +7 -7
- package/SankeyChart/sankey.highlight.types.d.ts +4 -0
- package/SankeyChart/sankey.types.d.ts +6 -3
- package/SankeyChart/sankeySlots.types.d.ts +3 -9
- package/SankeyChart/seriesConfig/getSeriesWithDefaultValues.js +13 -1
- package/SankeyChart/seriesConfig/identifierCleaner.d.ts +3 -0
- package/SankeyChart/seriesConfig/identifierCleaner.js +24 -0
- package/SankeyChart/seriesConfig/index.js +3 -1
- package/ScatterChartPro/ScatterChartPro.d.ts +1 -1
- package/ScatterChartPro/ScatterChartPro.js +30 -8
- package/esm/BarChartPro/BarChartPro.d.ts +1 -1
- package/esm/BarChartPro/BarChartPro.js +30 -8
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +17 -31
- package/esm/ChartContainerPro/ChartContainerPro.js +15 -286
- package/esm/ChartContainerPro/useChartContainerProProps.d.ts +10 -7
- package/esm/ChartContainerPro/useChartContainerProProps.js +11 -34
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +5 -3
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +2 -2
- package/esm/ChartDataProviderPro/index.d.ts +1 -1
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -3
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +9 -7
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +7 -5
- package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +1 -1
- package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +4 -4
- package/esm/ChartZoomSlider/internals/previews/BarPreviewPlot.js +1 -1
- package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +1 -1
- package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.js +4 -4
- package/esm/ChartsContainer/index.d.ts +1 -0
- package/esm/ChartsContainer/index.js +2 -0
- package/esm/ChartsContainerPro/ChartsContainerPro.d.ts +37 -0
- package/esm/ChartsContainerPro/ChartsContainerPro.js +182 -0
- package/esm/ChartsContainerPro/index.d.ts +9 -0
- package/esm/ChartsContainerPro/index.js +6 -0
- package/esm/ChartsContainerPro/useChartsContainerProProps.d.ts +8 -0
- package/esm/ChartsContainerPro/useChartsContainerProProps.js +37 -0
- package/esm/FunnelChart/FunnelChart.d.ts +1 -1
- package/esm/FunnelChart/FunnelChart.js +9 -8
- package/esm/FunnelChart/FunnelSection.d.ts +1 -1
- package/esm/FunnelChart/funnel.types.d.ts +1 -1
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +13 -10
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +3 -2
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
- package/esm/FunnelChart/funnelSlots.types.d.ts +3 -9
- package/esm/FunnelChart/index.d.ts +2 -1
- package/esm/FunnelChart/index.js +1 -0
- package/esm/FunnelChart/seriesConfig/index.js +3 -2
- package/esm/FunnelChart/seriesConfig/keyboardFocusHandler.js +2 -15
- package/esm/FunnelChart/seriesConfig/legend.js +0 -1
- package/esm/Heatmap/Heatmap.d.ts +6 -3
- package/esm/Heatmap/Heatmap.js +47 -136
- package/esm/Heatmap/Heatmap.types.d.ts +19 -0
- package/esm/Heatmap/Heatmap.types.js +1 -0
- package/esm/Heatmap/HeatmapItem.d.ts +6 -0
- package/esm/Heatmap/HeatmapItem.js +11 -3
- package/esm/Heatmap/HeatmapPlot.d.ts +7 -3
- package/esm/Heatmap/HeatmapPlot.js +17 -56
- package/esm/Heatmap/HeatmapSVGPlot.d.ts +2 -0
- package/esm/Heatmap/HeatmapSVGPlot.js +64 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +18 -2
- package/esm/Heatmap/HeatmapTooltip/index.d.ts +1 -1
- package/esm/Heatmap/index.d.ts +3 -2
- package/esm/Heatmap/seriesConfig/getItemAtPosition.d.ts +2 -2
- package/esm/Heatmap/seriesConfig/getItemAtPosition.js +6 -2
- package/esm/Heatmap/seriesConfig/index.js +2 -1
- package/esm/Heatmap/useHeatmapProps.d.ts +24 -0
- package/esm/Heatmap/useHeatmapProps.js +151 -0
- package/esm/LineChartPro/LineChartPro.d.ts +1 -1
- package/esm/LineChartPro/LineChartPro.js +30 -8
- package/esm/PieChartPro/PieChartPro.d.ts +1 -1
- package/esm/PieChartPro/PieChartPro.js +9 -8
- package/esm/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/esm/RadarChartPro/RadarChartPro.js +8 -8
- package/esm/SankeyChart/SankeyChart.d.ts +1 -1
- package/esm/SankeyChart/SankeyChart.js +9 -23
- package/esm/SankeyChart/SankeyTooltip/SankeyTooltip.types.d.ts +5 -1
- package/esm/SankeyChart/SankeyTooltip/index.d.ts +1 -1
- package/esm/SankeyChart/index.d.ts +1 -1
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +7 -7
- package/esm/SankeyChart/sankey.highlight.types.d.ts +4 -0
- package/esm/SankeyChart/sankey.types.d.ts +6 -3
- package/esm/SankeyChart/sankeySlots.types.d.ts +3 -9
- package/esm/SankeyChart/seriesConfig/getSeriesWithDefaultValues.js +13 -1
- package/esm/SankeyChart/seriesConfig/identifierCleaner.d.ts +3 -0
- package/esm/SankeyChart/seriesConfig/identifierCleaner.js +18 -0
- package/esm/SankeyChart/seriesConfig/index.js +3 -1
- package/esm/ScatterChartPro/ScatterChartPro.d.ts +1 -1
- package/esm/ScatterChartPro/ScatterChartPro.js +30 -8
- package/esm/index.d.ts +3 -1
- package/esm/index.js +2 -1
- package/esm/internals/index.d.ts +7 -1
- package/esm/internals/index.js +5 -1
- package/esm/internals/plugins/useChartProExport/common.d.ts +5 -1
- package/esm/internals/plugins/useChartProExport/common.js +36 -0
- package/esm/internals/plugins/useChartProExport/exportImage.d.ts +1 -1
- package/esm/internals/plugins/useChartProExport/exportImage.js +2 -1
- package/esm/internals/plugins/useChartProExport/print.d.ts +1 -1
- package/esm/internals/plugins/useChartProExport/print.js +2 -1
- package/esm/internals/plugins/useChartProExport/useChartProExport.js +4 -2
- package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +4 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +4 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.js +6 -4
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.js +7 -5
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.js +4 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +6 -4
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.js +6 -4
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +6 -4
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +5 -5
- package/esm/models/seriesType/heatmap.d.ts +3 -3
- package/esm/plugins/selectors/useChartHeatmapPosition.selectors.d.ts +1 -1
- package/esm/plugins/selectors/useChartHeatmapPosition.selectors.js +3 -1
- package/esm/typeOverloads/modules.d.ts +9 -5
- package/index.d.ts +3 -1
- package/index.js +9 -1
- package/internals/index.d.ts +7 -1
- package/internals/index.js +43 -1
- package/internals/plugins/useChartProExport/common.d.ts +5 -1
- package/internals/plugins/useChartProExport/common.js +37 -0
- package/internals/plugins/useChartProExport/exportImage.d.ts +1 -1
- package/internals/plugins/useChartProExport/exportImage.js +1 -0
- package/internals/plugins/useChartProExport/print.d.ts +1 -1
- package/internals/plugins/useChartProExport/print.js +1 -0
- package/internals/plugins/useChartProExport/useChartProExport.js +4 -2
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -2
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +4 -2
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +4 -2
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.js +5 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.js +6 -4
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.js +4 -2
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +5 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.js +5 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +5 -3
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +5 -5
- package/models/seriesType/heatmap.d.ts +3 -3
- package/package.json +19 -11
- package/plugins/selectors/useChartHeatmapPosition.selectors.d.ts +1 -1
- package/plugins/selectors/useChartHeatmapPosition.selectors.js +3 -1
- package/typeOverloads/modules.d.ts +9 -5
|
@@ -54,6 +54,16 @@ export const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
|
|
|
54
54
|
color: resolvedColor
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
|
+
const highlightScope = {
|
|
58
|
+
nodes: {
|
|
59
|
+
highlight: seriesData.nodeOptions?.highlight ?? 'links',
|
|
60
|
+
fade: seriesData.nodeOptions?.fade ?? 'none'
|
|
61
|
+
},
|
|
62
|
+
links: {
|
|
63
|
+
highlight: seriesData.linkOptions?.highlight ?? 'links',
|
|
64
|
+
fade: seriesData.linkOptions?.fade ?? 'none'
|
|
65
|
+
}
|
|
66
|
+
};
|
|
57
67
|
if (!seriesData.data || !links) {
|
|
58
68
|
return _extends({
|
|
59
69
|
id: seriesData.id ?? `auto-generated-id-${seriesIndex}`
|
|
@@ -62,7 +72,8 @@ export const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
|
|
|
62
72
|
data: {
|
|
63
73
|
nodes: [],
|
|
64
74
|
links: []
|
|
65
|
-
}
|
|
75
|
+
},
|
|
76
|
+
highlightScope
|
|
66
77
|
});
|
|
67
78
|
}
|
|
68
79
|
|
|
@@ -93,6 +104,7 @@ export const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
|
|
|
93
104
|
id: seriesData.id ?? `auto-generated-id-${seriesIndex}`
|
|
94
105
|
}, seriesData, {
|
|
95
106
|
valueFormatter: seriesData.valueFormatter ?? defaultSankeyValueFormatter,
|
|
107
|
+
highlightScope,
|
|
96
108
|
data
|
|
97
109
|
});
|
|
98
110
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const identifierCleaner = identifier => {
|
|
2
|
+
if (identifier.subType === 'node') {
|
|
3
|
+
return {
|
|
4
|
+
type: identifier.type,
|
|
5
|
+
seriesId: identifier.seriesId,
|
|
6
|
+
subType: 'node',
|
|
7
|
+
nodeId: identifier.nodeId
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
type: identifier.type,
|
|
12
|
+
seriesId: identifier.seriesId,
|
|
13
|
+
subType: 'link',
|
|
14
|
+
sourceId: identifier.sourceId,
|
|
15
|
+
targetId: identifier.targetId
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default identifierCleaner;
|
|
@@ -4,6 +4,7 @@ import { calculateSankeyLayout } from "../calculateSankeyLayout.js";
|
|
|
4
4
|
import tooltipItemPositionGetter from "./tooltipPosition.js";
|
|
5
5
|
import keyboardFocusHandler from "./keyboardFocusHandler.js";
|
|
6
6
|
import identifierSerializer from "./identifierSerializer.js";
|
|
7
|
+
import identifierCleaner from "./identifierCleaner.js";
|
|
7
8
|
|
|
8
9
|
// Simple passthrough functions for sankey chart
|
|
9
10
|
const seriesProcessor = series => series;
|
|
@@ -28,5 +29,6 @@ export const sankeySeriesConfig = {
|
|
|
28
29
|
tooltipItemPositionGetter,
|
|
29
30
|
getSeriesWithDefaultValues,
|
|
30
31
|
keyboardFocusHandler,
|
|
31
|
-
identifierSerializer
|
|
32
|
+
identifierSerializer,
|
|
33
|
+
identifierCleaner
|
|
32
34
|
};
|
|
@@ -35,5 +35,5 @@ export interface ScatterChartProProps extends Omit<ScatterChartProps, 'apiRef' |
|
|
|
35
35
|
*
|
|
36
36
|
* - [ScatterChart API](https://mui.com/x/api/charts/scatter-chart/)
|
|
37
37
|
*/
|
|
38
|
-
declare const ScatterChartPro: React.ForwardRefExoticComponent<ScatterChartProProps & React.RefAttributes<
|
|
38
|
+
declare const ScatterChartPro: React.ForwardRefExoticComponent<ScatterChartProProps & React.RefAttributes<HTMLDivElement>>;
|
|
39
39
|
export { ScatterChartPro };
|
|
@@ -66,11 +66,12 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
66
66
|
onZoomChange,
|
|
67
67
|
apiRef,
|
|
68
68
|
plugins: SCATTER_CHART_PRO_PLUGINS
|
|
69
|
-
})
|
|
69
|
+
}));
|
|
70
70
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
71
71
|
const Toolbar = props.slots?.toolbar ?? ChartsToolbarPro;
|
|
72
72
|
return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
|
|
73
73
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
74
|
+
ref: ref,
|
|
74
75
|
children: [showToolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
75
76
|
children: [/*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartZoomSlider, {}), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
|
76
77
|
"data-drawing-container": true,
|
|
@@ -96,6 +97,11 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
96
97
|
setZoomData: PropTypes.func.isRequired
|
|
97
98
|
})
|
|
98
99
|
}),
|
|
100
|
+
/**
|
|
101
|
+
* A gap added between axes when multiple axes are rendered on the same side of the chart.
|
|
102
|
+
* @default 0
|
|
103
|
+
*/
|
|
104
|
+
axesGap: PropTypes.number,
|
|
99
105
|
/**
|
|
100
106
|
* The configuration of axes highlight.
|
|
101
107
|
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
@@ -170,8 +176,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
170
176
|
*/
|
|
171
177
|
hiddenItems: PropTypes.arrayOf(PropTypes.shape({
|
|
172
178
|
dataIndex: PropTypes.number,
|
|
173
|
-
seriesId: PropTypes.
|
|
174
|
-
type: PropTypes.oneOf(['scatter'])
|
|
179
|
+
seriesId: PropTypes.string.isRequired,
|
|
180
|
+
type: PropTypes.oneOf(['scatter'])
|
|
175
181
|
})),
|
|
176
182
|
/**
|
|
177
183
|
* If `true`, the legend is not rendered.
|
|
@@ -183,7 +189,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
183
189
|
*/
|
|
184
190
|
highlightedItem: PropTypes.shape({
|
|
185
191
|
dataIndex: PropTypes.number,
|
|
186
|
-
seriesId: PropTypes.
|
|
192
|
+
seriesId: PropTypes.string.isRequired
|
|
187
193
|
}),
|
|
188
194
|
/**
|
|
189
195
|
* This prop is used to help implement the accessibility logic.
|
|
@@ -213,8 +219,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
213
219
|
*/
|
|
214
220
|
initialHiddenItems: PropTypes.arrayOf(PropTypes.shape({
|
|
215
221
|
dataIndex: PropTypes.number,
|
|
216
|
-
seriesId: PropTypes.
|
|
217
|
-
type: PropTypes.oneOf(['scatter'])
|
|
222
|
+
seriesId: PropTypes.string.isRequired,
|
|
223
|
+
type: PropTypes.oneOf(['scatter'])
|
|
218
224
|
})),
|
|
219
225
|
/**
|
|
220
226
|
* The list of zoom data related to each axis.
|
|
@@ -270,6 +276,14 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
270
276
|
* @param {ScatterItemIdentifier} scatterItemIdentifier The scatter item identifier.
|
|
271
277
|
*/
|
|
272
278
|
onItemClick: PropTypes.func,
|
|
279
|
+
/**
|
|
280
|
+
* The function called when the pointer position corresponds to a new axis data item.
|
|
281
|
+
* This update can either be caused by a pointer movement, or an axis update.
|
|
282
|
+
* In case of multiple axes, the function is called if at least one axis is updated.
|
|
283
|
+
* The argument contains the identifier for all axes with a `data` property.
|
|
284
|
+
* @param {AxisItemIdentifier[]} axisItems The array of axes item identifiers.
|
|
285
|
+
*/
|
|
286
|
+
onTooltipAxisChange: PropTypes.func,
|
|
273
287
|
/**
|
|
274
288
|
* The callback fired when the tooltip item changes.
|
|
275
289
|
*
|
|
@@ -319,14 +333,22 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
319
333
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
320
334
|
theme: PropTypes.oneOf(['dark', 'light']),
|
|
321
335
|
title: PropTypes.string,
|
|
336
|
+
/**
|
|
337
|
+
* The controlled axis tooltip.
|
|
338
|
+
* Identified by the axis id, and data index.
|
|
339
|
+
*/
|
|
340
|
+
tooltipAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
341
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
342
|
+
dataIndex: PropTypes.number.isRequired
|
|
343
|
+
})),
|
|
322
344
|
/**
|
|
323
345
|
* The tooltip item.
|
|
324
346
|
* Used when the tooltip is controlled.
|
|
325
347
|
*/
|
|
326
348
|
tooltipItem: PropTypes.shape({
|
|
327
349
|
dataIndex: PropTypes.number.isRequired,
|
|
328
|
-
seriesId: PropTypes.
|
|
329
|
-
type: PropTypes.oneOf(['scatter'])
|
|
350
|
+
seriesId: PropTypes.string.isRequired,
|
|
351
|
+
type: PropTypes.oneOf(['scatter'])
|
|
330
352
|
}),
|
|
331
353
|
/**
|
|
332
354
|
* Defines the maximum distance between a scatter point and the pointer that triggers the interaction.
|
package/esm/index.d.ts
CHANGED
|
@@ -29,8 +29,10 @@ export * from "./models/index.js";
|
|
|
29
29
|
export * from "./plugins/index.js";
|
|
30
30
|
export * from "./colorPalettes/index.js";
|
|
31
31
|
export * from "./Heatmap/index.js";
|
|
32
|
+
export { ChartsContainerPro } from "./ChartsContainerPro/index.js";
|
|
33
|
+
export type { ChartsContainerProProps, ChartsContainerProSlots, ChartsContainerProSlotProps } from "./ChartsContainerPro/index.js";
|
|
32
34
|
export { ChartContainerPro } from "./ChartContainerPro/index.js";
|
|
33
|
-
export type { ChartContainerProProps } from "./ChartContainerPro/index.js";
|
|
35
|
+
export type { ChartContainerProProps, ChartContainerProSlots, ChartContainerProSlotProps } from "./ChartContainerPro/index.js";
|
|
34
36
|
export * from "./ChartDataProviderPro/index.js";
|
|
35
37
|
export * from "./ScatterChartPro/index.js";
|
|
36
38
|
export * from "./SankeyChart/index.js";
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts-pro
|
|
2
|
+
* @mui/x-charts-pro v9.0.0-alpha.1
|
|
3
3
|
*
|
|
4
4
|
* @license SEE LICENSE IN LICENSE
|
|
5
5
|
* This source code is licensed under the SEE LICENSE IN LICENSE license found in the
|
|
@@ -44,6 +44,7 @@ export * from "./colorPalettes/index.js";
|
|
|
44
44
|
|
|
45
45
|
// Pro components
|
|
46
46
|
export * from "./Heatmap/index.js";
|
|
47
|
+
export { ChartsContainerPro } from "./ChartsContainerPro/index.js";
|
|
47
48
|
export { ChartContainerPro } from "./ChartContainerPro/index.js";
|
|
48
49
|
export * from "./ChartDataProviderPro/index.js";
|
|
49
50
|
export * from "./ScatterChartPro/index.js";
|
package/esm/internals/index.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
export { useChartsContainerProProps } from "../ChartsContainerPro/useChartsContainerProProps.js";
|
|
2
|
+
export type { UseChartsContainerProPropsReturnValue } from "../ChartsContainerPro/useChartsContainerProProps.js";
|
|
1
3
|
export { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
|
|
2
4
|
export type { ChartsSlotsPro, ChartsSlotPropsPro } from "./material/index.js";
|
|
3
5
|
export { seriesPreviewPlotMap } from "../ChartZoomSlider/internals/seriesPreviewPlotMap.js";
|
|
4
6
|
export type { PreviewPlotProps } from "../ChartZoomSlider/internals/previews/PreviewPlot.types.js";
|
|
5
7
|
export { defaultSeriesConfigPro } from "../ChartDataProviderPro/ChartDataProviderPro.js";
|
|
6
8
|
export type { ProPluginsPerSeriesType } from "../context/ChartProApi.js";
|
|
7
|
-
export {
|
|
9
|
+
export { useHeatmapProps } from "../Heatmap/useHeatmapProps.js";
|
|
10
|
+
export { defaultSlotsMaterial } from "./material/index.js";
|
|
11
|
+
export * from "../Heatmap/HeatmapSVGPlot.js";
|
|
12
|
+
export type * from "../Heatmap/Heatmap.types.js";
|
|
13
|
+
export { selectorHeatmapItemAtPosition } from "../plugins/selectors/useChartHeatmapPosition.selectors.js";
|
package/esm/internals/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
export { useChartsContainerProProps } from "../ChartsContainerPro/useChartsContainerProProps.js";
|
|
1
2
|
export { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
|
|
2
3
|
export { seriesPreviewPlotMap } from "../ChartZoomSlider/internals/seriesPreviewPlotMap.js";
|
|
3
4
|
export { defaultSeriesConfigPro } from "../ChartDataProviderPro/ChartDataProviderPro.js";
|
|
4
|
-
export {
|
|
5
|
+
export { useHeatmapProps } from "../Heatmap/useHeatmapProps.js";
|
|
6
|
+
export { defaultSlotsMaterial } from "./material/index.js";
|
|
7
|
+
export * from "../Heatmap/HeatmapSVGPlot.js";
|
|
8
|
+
export { selectorHeatmapItemAtPosition } from "../plugins/selectors/useChartHeatmapPosition.selectors.js";
|
|
@@ -2,4 +2,8 @@ export declare function createExportIframe(title?: string): HTMLIFrameElement;
|
|
|
2
2
|
/**
|
|
3
3
|
* Applies styles to an element and returns the previous styles.
|
|
4
4
|
*/
|
|
5
|
-
export declare function applyStyles(element: HTMLElement | SVGElement, styles: Record<string, string | null>): Record<string, string | null>;
|
|
5
|
+
export declare function applyStyles(element: HTMLElement | SVGElement, styles: Record<string, string | null>): Record<string, string | null>;
|
|
6
|
+
/**
|
|
7
|
+
* Copies the content of all canvases from the original element to the cloned element.
|
|
8
|
+
*/
|
|
9
|
+
export declare function copyCanvasesContent(original: Element, clone: Element): Promise<void[]>;
|
|
@@ -18,4 +18,40 @@ export function applyStyles(element, styles) {
|
|
|
18
18
|
element.style.setProperty(key, value);
|
|
19
19
|
});
|
|
20
20
|
return previousStyles;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Copies the content of all canvases from the original element to the cloned element.
|
|
25
|
+
*/
|
|
26
|
+
export function copyCanvasesContent(original, clone) {
|
|
27
|
+
const originalCanvases = original.querySelectorAll('canvas');
|
|
28
|
+
const cloneCanvases = clone.querySelectorAll('canvas');
|
|
29
|
+
const promises = Array.from(originalCanvases).map(async (originalCanvas, index) => {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
const cloneCanvas = cloneCanvases[index];
|
|
32
|
+
if (cloneCanvas) {
|
|
33
|
+
const dataURL = originalCanvas.toDataURL();
|
|
34
|
+
const img = cloneCanvas.ownerDocument.createElement('img');
|
|
35
|
+
img.src = dataURL;
|
|
36
|
+
img.width = cloneCanvas.width;
|
|
37
|
+
img.height = cloneCanvas.height;
|
|
38
|
+
for (const styleKey in cloneCanvas.style) {
|
|
39
|
+
if (!Object.hasOwn(img.style, styleKey) || !Object.hasOwn(cloneCanvas.style, styleKey)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
img.style[styleKey] = cloneCanvas.style[styleKey];
|
|
43
|
+
}
|
|
44
|
+
cloneCanvas.replaceWith(img);
|
|
45
|
+
img.onload = () => {
|
|
46
|
+
resolve();
|
|
47
|
+
};
|
|
48
|
+
img.onerror = event => {
|
|
49
|
+
reject(event);
|
|
50
|
+
};
|
|
51
|
+
} else {
|
|
52
|
+
resolve();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
return Promise.all(promises);
|
|
21
57
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ChartImageExportOptions } from "./useChartProExport.types.js";
|
|
2
2
|
export declare const getDrawDocument: () => Promise<typeof import("rasterizehtml").drawDocument>;
|
|
3
|
-
export declare function exportImage(element:
|
|
3
|
+
export declare function exportImage(element: Element, svg: SVGElement, params?: ChartImageExportOptions): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ownerDocument from '@mui/utils/ownerDocument';
|
|
2
2
|
import { loadStyleSheets } from '@mui/x-internals/export';
|
|
3
|
-
import { applyStyles, createExportIframe } from "./common.js";
|
|
3
|
+
import { applyStyles, copyCanvasesContent, createExportIframe } from "./common.js";
|
|
4
4
|
import { defaultOnBeforeExport } from "./defaults.js";
|
|
5
5
|
export const getDrawDocument = async () => {
|
|
6
6
|
try {
|
|
@@ -52,6 +52,7 @@ export async function exportImage(element, svg, params) {
|
|
|
52
52
|
if (copyStyles) {
|
|
53
53
|
await Promise.all(loadStyleSheets(exportDoc, root, nonce));
|
|
54
54
|
}
|
|
55
|
+
await copyCanvasesContent(element, elementClone);
|
|
55
56
|
resolve();
|
|
56
57
|
};
|
|
57
58
|
doc.body.appendChild(iframe);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ownerDocument from '@mui/utils/ownerDocument';
|
|
2
2
|
import { loadStyleSheets } from '@mui/x-internals/export';
|
|
3
|
-
import { createExportIframe } from "./common.js";
|
|
3
|
+
import { copyCanvasesContent, createExportIframe } from "./common.js";
|
|
4
4
|
import { defaultOnBeforeExport } from "./defaults.js";
|
|
5
5
|
export function printChart(element, {
|
|
6
6
|
fileName,
|
|
@@ -20,6 +20,7 @@ export function printChart(element, {
|
|
|
20
20
|
if (copyStyles) {
|
|
21
21
|
await Promise.all(loadStyleSheets(printDoc, root, nonce));
|
|
22
22
|
}
|
|
23
|
+
await copyCanvasesContent(element, elementClone);
|
|
23
24
|
const mediaQueryList = printWindow.contentWindow.matchMedia('print');
|
|
24
25
|
mediaQueryList.addEventListener('change', mql => {
|
|
25
26
|
const isAfterPrint = mql.matches === false;
|
|
@@ -12,10 +12,12 @@ function waitForAnimationFrame() {
|
|
|
12
12
|
return promise;
|
|
13
13
|
}
|
|
14
14
|
export const useChartProExport = ({
|
|
15
|
-
chartRootRef,
|
|
16
|
-
svgRef,
|
|
17
15
|
instance
|
|
18
16
|
}) => {
|
|
17
|
+
const {
|
|
18
|
+
chartRootRef,
|
|
19
|
+
svgRef
|
|
20
|
+
} = instance;
|
|
19
21
|
const exportAsPrint = async options => {
|
|
20
22
|
const chartRoot = chartRootRef.current;
|
|
21
23
|
if (chartRoot) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const selectorZoomInteractionConfig: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
|
|
1
|
+
export declare const selectorZoomInteractionConfig: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
|
|
2
2
|
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
3
3
|
}, interactionName: "wheel" | "pinch" | "tapAndDrag" | "doubleTapReset" | "brush") => (Omit<import("./ZoomInteractionConfig.types.js").ZoomInteraction, "pointerMode"> & {
|
|
4
4
|
mouse: {
|
|
@@ -10,7 +10,7 @@ export declare const selectorZoomInteractionConfig: (args_0: import("@mui/x-char
|
|
|
10
10
|
pointerMode?: import("@mui/x-internal-gestures/core").PointerMode[];
|
|
11
11
|
allowedDirection?: "x" | "y" | "xy";
|
|
12
12
|
}) | null;
|
|
13
|
-
export declare const selectorPanInteractionConfig: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
|
|
13
|
+
export declare const selectorPanInteractionConfig: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
|
|
14
14
|
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
15
15
|
}, interactionName: "wheel" | "drag" | "pressAndDrag") => (Omit<import("./ZoomInteractionConfig.types.js").PanInteraction, "pointerMode"> & {
|
|
16
16
|
mouse: {
|
|
@@ -3,6 +3,5 @@ import { type ChartPlugin, type ZoomData } from '@mui/x-charts/internals';
|
|
|
3
3
|
import { type UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
4
|
export declare const usePanOnDrag: ({
|
|
5
5
|
store,
|
|
6
|
-
instance
|
|
7
|
-
|
|
8
|
-
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
6
|
+
instance
|
|
7
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
@@ -7,9 +7,11 @@ import { translateZoom } from "./useZoom.utils.js";
|
|
|
7
7
|
import { selectorPanInteractionConfig } from "../ZoomInteractionConfig.selectors.js";
|
|
8
8
|
export const usePanOnDrag = ({
|
|
9
9
|
store,
|
|
10
|
-
instance
|
|
11
|
-
svgRef
|
|
10
|
+
instance
|
|
12
11
|
}, setZoomDataCallback) => {
|
|
12
|
+
const {
|
|
13
|
+
svgRef
|
|
14
|
+
} = instance;
|
|
13
15
|
const drawingArea = store.use(selectorChartDrawingArea);
|
|
14
16
|
const optionsLookup = store.use(selectorChartZoomOptionsLookup);
|
|
15
17
|
const config = store.use(selectorPanInteractionConfig, 'drag');
|
|
@@ -3,6 +3,5 @@ import { type ChartPlugin, type ZoomData } from '@mui/x-charts/internals';
|
|
|
3
3
|
import { type UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
4
|
export declare const usePanOnPressAndDrag: ({
|
|
5
5
|
store,
|
|
6
|
-
instance
|
|
7
|
-
|
|
8
|
-
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
6
|
+
instance
|
|
7
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
@@ -7,9 +7,11 @@ import { translateZoom } from "./useZoom.utils.js";
|
|
|
7
7
|
import { selectorPanInteractionConfig } from "../ZoomInteractionConfig.selectors.js";
|
|
8
8
|
export const usePanOnPressAndDrag = ({
|
|
9
9
|
store,
|
|
10
|
-
instance
|
|
11
|
-
svgRef
|
|
10
|
+
instance
|
|
12
11
|
}, setZoomDataCallback) => {
|
|
12
|
+
const {
|
|
13
|
+
svgRef
|
|
14
|
+
} = instance;
|
|
13
15
|
const drawingArea = store.use(selectorChartDrawingArea);
|
|
14
16
|
const optionsLookup = store.use(selectorChartZoomOptionsLookup);
|
|
15
17
|
const isInteracting = React.useRef(false);
|
|
@@ -3,6 +3,5 @@ import { type ChartPlugin, type ZoomData } from '@mui/x-charts/internals';
|
|
|
3
3
|
import { type UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
4
|
export declare const usePanOnWheel: ({
|
|
5
5
|
store,
|
|
6
|
-
instance
|
|
7
|
-
|
|
8
|
-
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
6
|
+
instance
|
|
7
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { getChartPoint, selectorChartDrawingArea, selectorChartZoomOptionsLookup } from '@mui/x-charts/internals';
|
|
5
5
|
import { rafThrottle } from '@mui/x-internals/rafThrottle';
|
|
6
6
|
import { translateZoom } from "./useZoom.utils.js";
|
|
7
7
|
import { selectorPanInteractionConfig } from "../ZoomInteractionConfig.selectors.js";
|
|
8
8
|
export const usePanOnWheel = ({
|
|
9
9
|
store,
|
|
10
|
-
instance
|
|
11
|
-
svgRef
|
|
10
|
+
instance
|
|
12
11
|
}, setZoomDataCallback) => {
|
|
12
|
+
const {
|
|
13
|
+
svgRef
|
|
14
|
+
} = instance;
|
|
13
15
|
const drawingArea = store.use(selectorChartDrawingArea);
|
|
14
16
|
const optionsLookup = store.use(selectorChartZoomOptionsLookup);
|
|
15
17
|
const startedOutsideRef = React.useRef(false);
|
|
@@ -37,7 +39,7 @@ export const usePanOnWheel = ({
|
|
|
37
39
|
}
|
|
38
40
|
const rafThrottledSetZoomData = rafThrottle(setZoomDataCallback);
|
|
39
41
|
const wheelHandler = instance.addInteractionListener('panTurnWheel', event => {
|
|
40
|
-
const point =
|
|
42
|
+
const point = getChartPoint(element, {
|
|
41
43
|
clientX: event.detail.centroid.x,
|
|
42
44
|
clientY: event.detail.centroid.y
|
|
43
45
|
});
|
|
@@ -3,6 +3,5 @@ import { type ChartPlugin, type ZoomData } from '@mui/x-charts/internals';
|
|
|
3
3
|
import { type UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
4
|
export declare const useZoomOnBrush: ({
|
|
5
5
|
store,
|
|
6
|
-
instance
|
|
7
|
-
|
|
8
|
-
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<(prev: ZoomData[]) => ZoomData[]>) => void;
|
|
6
|
+
instance
|
|
7
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance">, setZoomDataCallback: React.Dispatch<(prev: ZoomData[]) => ZoomData[]>) => void;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { getChartPoint, selectorChartDrawingArea, selectorChartZoomOptionsLookup } from '@mui/x-charts/internals';
|
|
5
5
|
import { getHorizontalCenterRatio, getVerticalCenterRatio, isSpanValid } from "./useZoom.utils.js";
|
|
6
6
|
import { selectorZoomInteractionConfig } from "../ZoomInteractionConfig.selectors.js";
|
|
7
7
|
export const useZoomOnBrush = ({
|
|
8
8
|
store,
|
|
9
|
-
instance
|
|
10
|
-
svgRef
|
|
9
|
+
instance
|
|
11
10
|
}, setZoomDataCallback) => {
|
|
11
|
+
const {
|
|
12
|
+
svgRef
|
|
13
|
+
} = instance;
|
|
12
14
|
const drawingArea = store.use(selectorChartDrawingArea);
|
|
13
15
|
const optionsLookup = store.use(selectorChartZoomOptionsLookup);
|
|
14
16
|
const config = store.use(selectorZoomInteractionConfig, 'brush');
|
|
@@ -26,11 +28,11 @@ export const useZoomOnBrush = ({
|
|
|
26
28
|
const handleBrushEnd = event => {
|
|
27
29
|
// Convert the brush rectangle to zoom percentages for each axis
|
|
28
30
|
setZoomDataCallback(prev => {
|
|
29
|
-
const startPoint =
|
|
31
|
+
const startPoint = getChartPoint(element, {
|
|
30
32
|
clientX: event.detail.initialCentroid.x,
|
|
31
33
|
clientY: event.detail.initialCentroid.y
|
|
32
34
|
});
|
|
33
|
-
const endPoint =
|
|
35
|
+
const endPoint = getChartPoint(element, {
|
|
34
36
|
clientX: event.detail.centroid.x,
|
|
35
37
|
clientY: event.detail.centroid.y
|
|
36
38
|
});
|
|
@@ -3,6 +3,5 @@ import { type ChartPlugin, type ZoomData } from '@mui/x-charts/internals';
|
|
|
3
3
|
import { type UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
4
|
export declare const useZoomOnDoubleTapReset: ({
|
|
5
5
|
store,
|
|
6
|
-
instance
|
|
7
|
-
|
|
8
|
-
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
6
|
+
instance
|
|
7
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
@@ -5,9 +5,11 @@ import { selectorChartZoomOptionsLookup } from '@mui/x-charts/internals';
|
|
|
5
5
|
import { selectorZoomInteractionConfig } from "../ZoomInteractionConfig.selectors.js";
|
|
6
6
|
export const useZoomOnDoubleTapReset = ({
|
|
7
7
|
store,
|
|
8
|
-
instance
|
|
9
|
-
svgRef
|
|
8
|
+
instance
|
|
10
9
|
}, setZoomDataCallback) => {
|
|
10
|
+
const {
|
|
11
|
+
svgRef
|
|
12
|
+
} = instance;
|
|
11
13
|
const optionsLookup = store.use(selectorChartZoomOptionsLookup);
|
|
12
14
|
const config = store.use(selectorZoomInteractionConfig, 'doubleTapReset');
|
|
13
15
|
const isZoomOnDoubleTapResetEnabled = Object.keys(optionsLookup).length > 0 && Boolean(config);
|
|
@@ -3,6 +3,5 @@ import { type ChartPlugin, type ZoomData } from '@mui/x-charts/internals';
|
|
|
3
3
|
import { type UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
4
|
export declare const useZoomOnPinch: ({
|
|
5
5
|
store,
|
|
6
|
-
instance
|
|
7
|
-
|
|
8
|
-
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
6
|
+
instance
|
|
7
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { getChartPoint, selectorChartDrawingArea, selectorChartZoomOptionsLookup } from '@mui/x-charts/internals';
|
|
5
5
|
import { rafThrottle } from '@mui/x-internals/rafThrottle';
|
|
6
6
|
import { getHorizontalCenterRatio, getVerticalCenterRatio, isSpanValid, zoomAtPoint } from "./useZoom.utils.js";
|
|
7
7
|
import { selectorZoomInteractionConfig } from "../ZoomInteractionConfig.selectors.js";
|
|
8
8
|
export const useZoomOnPinch = ({
|
|
9
9
|
store,
|
|
10
|
-
instance
|
|
11
|
-
svgRef
|
|
10
|
+
instance
|
|
12
11
|
}, setZoomDataCallback) => {
|
|
12
|
+
const {
|
|
13
|
+
svgRef
|
|
14
|
+
} = instance;
|
|
13
15
|
const drawingArea = store.use(selectorChartDrawingArea);
|
|
14
16
|
const optionsLookup = store.use(selectorChartZoomOptionsLookup);
|
|
15
17
|
const config = store.use(selectorZoomInteractionConfig, 'pinch');
|
|
@@ -42,7 +44,7 @@ export const useZoomOnPinch = ({
|
|
|
42
44
|
}
|
|
43
45
|
const isZoomIn = event.detail.direction > 0;
|
|
44
46
|
const scaleRatio = 1 + event.detail.deltaScale;
|
|
45
|
-
const point =
|
|
47
|
+
const point = getChartPoint(element, {
|
|
46
48
|
clientX: event.detail.centroid.x,
|
|
47
49
|
clientY: event.detail.centroid.y
|
|
48
50
|
});
|
|
@@ -3,6 +3,5 @@ import { type ChartPlugin, type ZoomData } from '@mui/x-charts/internals';
|
|
|
3
3
|
import { type UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
4
|
export declare const useZoomOnTapAndDrag: ({
|
|
5
5
|
store,
|
|
6
|
-
instance
|
|
7
|
-
|
|
8
|
-
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
6
|
+
instance
|
|
7
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { getChartPoint, selectorChartDrawingArea, selectorChartZoomOptionsLookup } from '@mui/x-charts/internals';
|
|
5
5
|
import { rafThrottle } from '@mui/x-internals/rafThrottle';
|
|
6
6
|
import { getHorizontalCenterRatio, getVerticalCenterRatio, isSpanValid, zoomAtPoint } from "./useZoom.utils.js";
|
|
7
7
|
import { selectorZoomInteractionConfig } from "../ZoomInteractionConfig.selectors.js";
|
|
8
8
|
export const useZoomOnTapAndDrag = ({
|
|
9
9
|
store,
|
|
10
|
-
instance
|
|
11
|
-
svgRef
|
|
10
|
+
instance
|
|
12
11
|
}, setZoomDataCallback) => {
|
|
12
|
+
const {
|
|
13
|
+
svgRef
|
|
14
|
+
} = instance;
|
|
13
15
|
const drawingArea = store.use(selectorChartDrawingArea);
|
|
14
16
|
const optionsLookup = store.use(selectorChartZoomOptionsLookup);
|
|
15
17
|
const config = store.use(selectorZoomInteractionConfig, 'tapAndDrag');
|
|
@@ -47,7 +49,7 @@ export const useZoomOnTapAndDrag = ({
|
|
|
47
49
|
}
|
|
48
50
|
const isZoomIn = event.detail.deltaY > 0;
|
|
49
51
|
const scaleRatio = 1 + event.detail.deltaY / 100;
|
|
50
|
-
const point =
|
|
52
|
+
const point = getChartPoint(element, {
|
|
51
53
|
clientX: event.detail.initialCentroid.x,
|
|
52
54
|
clientY: event.detail.initialCentroid.y
|
|
53
55
|
});
|
|
@@ -3,6 +3,5 @@ import { type ChartPlugin, type ZoomData } from '@mui/x-charts/internals';
|
|
|
3
3
|
import { type UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
4
|
export declare const useZoomOnWheel: ({
|
|
5
5
|
store,
|
|
6
|
-
instance
|
|
7
|
-
|
|
8
|
-
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
6
|
+
instance
|
|
7
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|