@mui/x-charts-pro 8.3.1 → 8.5.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/BarChartPro/BarChartPro.d.ts +13 -5
- package/BarChartPro/BarChartPro.js +56 -21
- package/CHANGELOG.md +213 -0
- package/ChartContainerPro/ChartContainerPro.d.ts +0 -1
- package/ChartContainerPro/ChartContainerPro.js +1 -0
- package/ChartContainerPro/ChartProApi.d.ts +26 -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/index.d.ts +1 -1
- package/ChartZoomSlider/index.js +4 -4
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +31 -287
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +24 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +251 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +92 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +160 -0
- package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
- package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +58 -0
- package/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
- package/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +6 -6
- 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 +8 -1
- package/ChartsToolbarPro/ChartsToolbarPro.js +42 -8
- package/ChartsToolbarPro/ChartsToolbarZoomInButton.d.ts +16 -0
- package/ChartsToolbarPro/ChartsToolbarZoomInButton.js +56 -0
- package/ChartsToolbarPro/ChartsToolbarZoomOutButton.d.ts +16 -0
- package/ChartsToolbarPro/ChartsToolbarZoomOutButton.js +56 -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 +6 -23
- package/FunnelChart/FunnelChart.plugins.d.ts +4 -0
- package/FunnelChart/FunnelChart.plugins.js +9 -0
- package/FunnelChart/FunnelPlot.js +2 -0
- package/FunnelChart/FunnelSection.js +2 -1
- package/FunnelChart/curves/curve.types.d.ts +4 -0
- package/FunnelChart/curves/pyramid.d.ts +3 -1
- package/FunnelChart/curves/pyramid.js +37 -10
- package/FunnelChart/curves/step-pyramid.d.ts +10 -2
- package/FunnelChart/curves/step-pyramid.js +96 -20
- package/FunnelChart/curves/step.d.ts +5 -1
- package/FunnelChart/curves/step.js +20 -2
- package/FunnelChart/funnel.types.d.ts +7 -0
- package/FunnelChart/funnelSlots.types.d.ts +4 -3
- package/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
- package/FunnelChart/useFunnelChartProps.d.ts +2 -1
- package/FunnelChart/useFunnelChartProps.js +3 -1
- package/Heatmap/Heatmap.d.ts +18 -5
- package/Heatmap/Heatmap.js +64 -26
- package/Heatmap/Heatmap.plugins.d.ts +2 -1
- package/Heatmap/Heatmap.plugins.js +2 -1
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +27 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.js +4 -102
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +5 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +96 -0
- package/Heatmap/HeatmapTooltip/index.d.ts +3 -1
- package/Heatmap/HeatmapTooltip/index.js +11 -0
- package/LineChartPro/LineChartPro.d.ts +13 -5
- package/LineChartPro/LineChartPro.js +56 -21
- 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 +57 -22
- 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 +54 -19
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +0 -1
- package/esm/ChartContainerPro/ChartContainerPro.js +1 -0
- package/esm/ChartContainerPro/ChartProApi.d.ts +26 -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/index.d.ts +1 -1
- package/esm/ChartZoomSlider/index.js +1 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +30 -283
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +24 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +243 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +85 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +152 -0
- package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
- package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +52 -0
- package/esm/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
- package/esm/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +4 -4
- 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 +8 -1
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +42 -9
- package/esm/ChartsToolbarPro/ChartsToolbarZoomInButton.d.ts +16 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomInButton.js +50 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomOutButton.d.ts +16 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomOutButton.js +50 -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 +6 -23
- package/esm/FunnelChart/FunnelChart.plugins.d.ts +4 -0
- package/esm/FunnelChart/FunnelChart.plugins.js +3 -0
- package/esm/FunnelChart/FunnelPlot.js +2 -0
- package/esm/FunnelChart/FunnelSection.js +1 -0
- package/esm/FunnelChart/curves/curve.types.d.ts +4 -0
- package/esm/FunnelChart/curves/pyramid.d.ts +3 -1
- package/esm/FunnelChart/curves/pyramid.js +37 -10
- package/esm/FunnelChart/curves/step-pyramid.d.ts +10 -2
- package/esm/FunnelChart/curves/step-pyramid.js +96 -20
- package/esm/FunnelChart/curves/step.d.ts +5 -1
- package/esm/FunnelChart/curves/step.js +20 -2
- package/esm/FunnelChart/funnel.types.d.ts +7 -0
- package/esm/FunnelChart/funnelSlots.types.d.ts +4 -3
- package/esm/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
- package/esm/FunnelChart/useFunnelChartProps.d.ts +2 -1
- package/esm/FunnelChart/useFunnelChartProps.js +3 -1
- package/esm/Heatmap/Heatmap.d.ts +18 -5
- package/esm/Heatmap/Heatmap.js +62 -24
- package/esm/Heatmap/Heatmap.plugins.d.ts +2 -1
- package/esm/Heatmap/Heatmap.plugins.js +2 -1
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +19 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.js +5 -103
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +1 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +89 -0
- package/esm/Heatmap/HeatmapTooltip/index.d.ts +3 -1
- package/esm/Heatmap/HeatmapTooltip/index.js +3 -1
- package/esm/LineChartPro/LineChartPro.d.ts +13 -5
- package/esm/LineChartPro/LineChartPro.js +54 -19
- 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 +55 -20
- 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 +2 -1
- package/esm/index.js +2 -1
- package/esm/internals/material/index.d.ts +1 -0
- package/esm/internals/plugins/useChartProExport/exportImage.js +1 -1
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +12 -2
- 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 +2 -1
- package/index.js +12 -1
- package/internals/material/index.d.ts +1 -0
- package/internals/plugins/useChartProExport/exportImage.js +1 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.js +12 -2
- 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 +5 -5
- package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
- package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -92
- package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
- 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/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -85
- package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
- 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
|
@@ -44,13 +44,14 @@ const FunnelChart = /*#__PURE__*/React.forwardRef(function FunnelChart(props, re
|
|
|
44
44
|
seriesConfig: seriesConfig,
|
|
45
45
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
46
46
|
children: [!themedProps.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
47
|
-
children: [/*#__PURE__*/_jsx(FunnelPlot, _extends({}, funnelPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)),
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
children: [/*#__PURE__*/_jsx(FunnelPlot, _extends({}, funnelPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), children]
|
|
48
|
+
})), !themedProps.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, themedProps.slotProps?.tooltip, {
|
|
49
|
+
trigger: "item"
|
|
50
50
|
}))]
|
|
51
51
|
}))
|
|
52
52
|
}));
|
|
53
53
|
});
|
|
54
|
+
if (process.env.NODE_ENV !== "production") FunnelChart.displayName = "FunnelChart";
|
|
54
55
|
process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
55
56
|
// ----------------------------- Warning --------------------------------
|
|
56
57
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -59,8 +60,7 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
59
60
|
apiRef: PropTypes.shape({
|
|
60
61
|
current: PropTypes.shape({
|
|
61
62
|
exportAsImage: PropTypes.func.isRequired,
|
|
62
|
-
exportAsPrint: PropTypes.func.isRequired
|
|
63
|
-
setZoomData: PropTypes.func.isRequired
|
|
63
|
+
exportAsPrint: PropTypes.func.isRequired
|
|
64
64
|
})
|
|
65
65
|
}),
|
|
66
66
|
/**
|
|
@@ -199,15 +199,6 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
199
199
|
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
200
200
|
*/
|
|
201
201
|
id: PropTypes.string,
|
|
202
|
-
/**
|
|
203
|
-
* The list of zoom data related to each axis.
|
|
204
|
-
* Used to initialize the zoom in a specific configuration without controlling it.
|
|
205
|
-
*/
|
|
206
|
-
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
207
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
208
|
-
end: PropTypes.number.isRequired,
|
|
209
|
-
start: PropTypes.number.isRequired
|
|
210
|
-
})),
|
|
211
202
|
/**
|
|
212
203
|
* If `true`, a loading overlay is displayed.
|
|
213
204
|
* @default false
|
|
@@ -274,14 +265,6 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
274
265
|
/**
|
|
275
266
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
276
267
|
*/
|
|
277
|
-
width: PropTypes.number
|
|
278
|
-
/**
|
|
279
|
-
* The list of zoom data related to each axis.
|
|
280
|
-
*/
|
|
281
|
-
zoomData: PropTypes.arrayOf(PropTypes.shape({
|
|
282
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
283
|
-
end: PropTypes.number.isRequired,
|
|
284
|
-
start: PropTypes.number.isRequired
|
|
285
|
-
}))
|
|
268
|
+
width: PropTypes.number
|
|
286
269
|
} : void 0;
|
|
287
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];
|
|
@@ -78,12 +78,14 @@ const useAggregatedData = gap => {
|
|
|
78
78
|
seriesId,
|
|
79
79
|
value: currentSeries.data[dataIndex].value
|
|
80
80
|
}) : currentSeries.sectionLabel;
|
|
81
|
+
const isIncreasing = currentSeries.dataDirection === 'increasing';
|
|
81
82
|
const curve = getFunnelCurve(currentSeries.curve, {
|
|
82
83
|
isHorizontal,
|
|
83
84
|
gap,
|
|
84
85
|
position: dataIndex,
|
|
85
86
|
sections: currentSeries.dataPoints.length,
|
|
86
87
|
borderRadius: currentSeries.borderRadius,
|
|
88
|
+
isIncreasing,
|
|
87
89
|
min: minPoint,
|
|
88
90
|
max: maxPoint
|
|
89
91
|
});
|
|
@@ -8,6 +8,10 @@ export type CurveOptions = {
|
|
|
8
8
|
* Indicates if the main axis of the visualization.
|
|
9
9
|
*/
|
|
10
10
|
isHorizontal?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Indicates if the segments values are increasing or decreasing.
|
|
13
|
+
*/
|
|
14
|
+
isIncreasing?: boolean;
|
|
11
15
|
/**
|
|
12
16
|
* The order position of the segment.
|
|
13
17
|
*/
|
|
@@ -11,6 +11,7 @@ export declare class Pyramid implements CurveGenerator {
|
|
|
11
11
|
private position;
|
|
12
12
|
private sections;
|
|
13
13
|
private isHorizontal;
|
|
14
|
+
private isIncreasing;
|
|
14
15
|
private gap;
|
|
15
16
|
private borderRadius;
|
|
16
17
|
private min;
|
|
@@ -23,7 +24,8 @@ export declare class Pyramid implements CurveGenerator {
|
|
|
23
24
|
sections,
|
|
24
25
|
borderRadius,
|
|
25
26
|
min,
|
|
26
|
-
max
|
|
27
|
+
max,
|
|
28
|
+
isIncreasing
|
|
27
29
|
}: CurveOptions);
|
|
28
30
|
areaStart(): void;
|
|
29
31
|
areaEnd(): void;
|
|
@@ -17,12 +17,14 @@ export class Pyramid {
|
|
|
17
17
|
sections,
|
|
18
18
|
borderRadius,
|
|
19
19
|
min,
|
|
20
|
-
max
|
|
20
|
+
max,
|
|
21
|
+
isIncreasing
|
|
21
22
|
}) {
|
|
22
23
|
this.context = void 0;
|
|
23
24
|
this.position = 0;
|
|
24
25
|
this.sections = 0;
|
|
25
26
|
this.isHorizontal = false;
|
|
27
|
+
this.isIncreasing = false;
|
|
26
28
|
this.gap = 0;
|
|
27
29
|
this.borderRadius = 0;
|
|
28
30
|
this.min = {
|
|
@@ -40,6 +42,7 @@ export class Pyramid {
|
|
|
40
42
|
this.position = position ?? 0;
|
|
41
43
|
this.sections = sections ?? 1;
|
|
42
44
|
this.borderRadius = borderRadius ?? 0;
|
|
45
|
+
this.isIncreasing = isIncreasing ?? false;
|
|
43
46
|
this.min = min ?? {
|
|
44
47
|
x: 0,
|
|
45
48
|
y: 0
|
|
@@ -48,6 +51,12 @@ export class Pyramid {
|
|
|
48
51
|
x: 0,
|
|
49
52
|
y: 0
|
|
50
53
|
};
|
|
54
|
+
if (isIncreasing) {
|
|
55
|
+
const currentMin = this.min;
|
|
56
|
+
const currentMax = this.max;
|
|
57
|
+
this.min = currentMax;
|
|
58
|
+
this.max = currentMin;
|
|
59
|
+
}
|
|
51
60
|
}
|
|
52
61
|
areaStart() {}
|
|
53
62
|
areaEnd() {}
|
|
@@ -57,14 +66,25 @@ export class Pyramid {
|
|
|
57
66
|
if (this.gap > 0) {
|
|
58
67
|
return this.borderRadius;
|
|
59
68
|
}
|
|
60
|
-
if (this.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
if (this.isIncreasing) {
|
|
70
|
+
// Is largest section
|
|
71
|
+
if (this.position === this.sections - 1) {
|
|
72
|
+
return [this.borderRadius, this.borderRadius];
|
|
73
|
+
}
|
|
74
|
+
// Is smallest section and shaped like a triangle
|
|
75
|
+
if (this.position === 0) {
|
|
76
|
+
return [0, 0, this.borderRadius];
|
|
77
|
+
}
|
|
65
78
|
}
|
|
66
|
-
if (this.
|
|
67
|
-
|
|
79
|
+
if (!this.isIncreasing) {
|
|
80
|
+
// Is largest section
|
|
81
|
+
if (this.position === 0) {
|
|
82
|
+
return [0, 0, this.borderRadius, this.borderRadius];
|
|
83
|
+
}
|
|
84
|
+
// Is smallest section and shaped like a triangle
|
|
85
|
+
if (this.position === this.sections - 1) {
|
|
86
|
+
return [this.borderRadius];
|
|
87
|
+
}
|
|
68
88
|
}
|
|
69
89
|
return 0;
|
|
70
90
|
}
|
|
@@ -113,8 +133,15 @@ export class Pyramid {
|
|
|
113
133
|
|
|
114
134
|
// In the last section, to form a triangle we need 3 points instead of 4
|
|
115
135
|
// Else the algorithm will break.
|
|
116
|
-
|
|
117
|
-
|
|
136
|
+
const isLastSection = this.position === this.sections - 1;
|
|
137
|
+
const isFirstSection = this.position === 0;
|
|
138
|
+
if (this.gap <= 0) {
|
|
139
|
+
if (isFirstSection && this.isIncreasing) {
|
|
140
|
+
this.points = [this.points[0], this.points[1], this.points[2]];
|
|
141
|
+
}
|
|
142
|
+
if (isLastSection && !this.isIncreasing) {
|
|
143
|
+
this.points = [this.points[0], this.points[1], this.points[3]];
|
|
144
|
+
}
|
|
118
145
|
}
|
|
119
146
|
borderRadiusPolygon(this.context, this.points, this.getBorderRadius());
|
|
120
147
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
|
|
2
|
-
import { CurveOptions } from "./curve.types.js";
|
|
2
|
+
import { CurveOptions, Point } from "./curve.types.js";
|
|
3
3
|
/**
|
|
4
4
|
* This is a custom "step-pyramid" curve generator.
|
|
5
5
|
* It creates a step pyramid, which is a step-like shape with static lengths.
|
|
@@ -8,7 +8,9 @@ import { CurveOptions } from "./curve.types.js";
|
|
|
8
8
|
export declare class StepPyramid implements CurveGenerator {
|
|
9
9
|
private context;
|
|
10
10
|
private position;
|
|
11
|
+
private sections;
|
|
11
12
|
private isHorizontal;
|
|
13
|
+
private isIncreasing;
|
|
12
14
|
private gap;
|
|
13
15
|
private borderRadius;
|
|
14
16
|
private min;
|
|
@@ -18,14 +20,20 @@ export declare class StepPyramid implements CurveGenerator {
|
|
|
18
20
|
isHorizontal,
|
|
19
21
|
gap,
|
|
20
22
|
position,
|
|
23
|
+
sections,
|
|
21
24
|
borderRadius,
|
|
22
25
|
min,
|
|
23
|
-
max
|
|
26
|
+
max,
|
|
27
|
+
isIncreasing
|
|
24
28
|
}: CurveOptions);
|
|
25
29
|
areaStart(): void;
|
|
26
30
|
areaEnd(): void;
|
|
27
31
|
lineStart(): void;
|
|
28
32
|
lineEnd(): void;
|
|
29
33
|
protected getBorderRadius(): number | number[];
|
|
34
|
+
slopeStart(index: number): Point;
|
|
35
|
+
slopeEnd(index: number): Point;
|
|
36
|
+
initialX(index: number): number;
|
|
37
|
+
initialY(index: number): number;
|
|
30
38
|
point(xIn: number, yIn: number): void;
|
|
31
39
|
}
|
|
@@ -13,13 +13,17 @@ export class StepPyramid {
|
|
|
13
13
|
isHorizontal,
|
|
14
14
|
gap,
|
|
15
15
|
position,
|
|
16
|
+
sections,
|
|
16
17
|
borderRadius,
|
|
17
18
|
min,
|
|
18
|
-
max
|
|
19
|
+
max,
|
|
20
|
+
isIncreasing
|
|
19
21
|
}) {
|
|
20
22
|
this.context = void 0;
|
|
21
23
|
this.position = 0;
|
|
24
|
+
this.sections = 0;
|
|
22
25
|
this.isHorizontal = false;
|
|
26
|
+
this.isIncreasing = false;
|
|
23
27
|
this.gap = 0;
|
|
24
28
|
this.borderRadius = 0;
|
|
25
29
|
this.min = {
|
|
@@ -35,7 +39,9 @@ export class StepPyramid {
|
|
|
35
39
|
this.isHorizontal = isHorizontal ?? false;
|
|
36
40
|
this.gap = (gap ?? 0) / 2;
|
|
37
41
|
this.position = position ?? 0;
|
|
42
|
+
this.sections = sections ?? 1;
|
|
38
43
|
this.borderRadius = borderRadius ?? 0;
|
|
44
|
+
this.isIncreasing = isIncreasing ?? false;
|
|
39
45
|
this.min = min ?? {
|
|
40
46
|
x: 0,
|
|
41
47
|
y: 0
|
|
@@ -50,7 +56,91 @@ export class StepPyramid {
|
|
|
50
56
|
lineStart() {}
|
|
51
57
|
lineEnd() {}
|
|
52
58
|
getBorderRadius() {
|
|
53
|
-
|
|
59
|
+
if (this.gap > 0) {
|
|
60
|
+
return this.borderRadius;
|
|
61
|
+
}
|
|
62
|
+
if (this.isIncreasing) {
|
|
63
|
+
if (this.position === this.sections - 1) {
|
|
64
|
+
return this.borderRadius;
|
|
65
|
+
}
|
|
66
|
+
return [0, 0, this.borderRadius, this.borderRadius];
|
|
67
|
+
}
|
|
68
|
+
if (this.position === 0) {
|
|
69
|
+
return this.borderRadius;
|
|
70
|
+
}
|
|
71
|
+
return [this.borderRadius, this.borderRadius];
|
|
72
|
+
}
|
|
73
|
+
slopeStart(index) {
|
|
74
|
+
if (this.isIncreasing) {
|
|
75
|
+
if (this.isHorizontal) {
|
|
76
|
+
return {
|
|
77
|
+
x: this.min.x,
|
|
78
|
+
y: (this.min.y + this.max.y) / 2
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
x: (this.min.x + this.max.x) / 2,
|
|
83
|
+
y: this.min.y
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (this.isHorizontal) {
|
|
87
|
+
if (index <= 1) {
|
|
88
|
+
return this.min;
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
x: this.min.x,
|
|
92
|
+
y: this.max.y
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (index <= 1) {
|
|
96
|
+
return {
|
|
97
|
+
x: this.max.x,
|
|
98
|
+
y: this.min.y
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return this.min;
|
|
102
|
+
}
|
|
103
|
+
slopeEnd(index) {
|
|
104
|
+
if (this.isIncreasing) {
|
|
105
|
+
if (this.isHorizontal) {
|
|
106
|
+
if (index <= 1) {
|
|
107
|
+
return {
|
|
108
|
+
x: this.max.x,
|
|
109
|
+
y: this.min.y
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return this.max;
|
|
113
|
+
}
|
|
114
|
+
if (index <= 1) {
|
|
115
|
+
return this.max;
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
x: this.min.x,
|
|
119
|
+
y: this.max.y
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (this.isHorizontal) {
|
|
123
|
+
return {
|
|
124
|
+
x: this.max.x,
|
|
125
|
+
y: (this.max.y + this.min.y) / 2
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
x: (this.max.x + this.min.x) / 2,
|
|
130
|
+
y: this.max.y
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
initialX(index) {
|
|
134
|
+
if (this.isIncreasing) {
|
|
135
|
+
return index === 0 || index === 1 ? this.points.at(1).x : this.points.at(2).x;
|
|
136
|
+
}
|
|
137
|
+
return index === 0 || index === 1 ? this.points.at(0).x : this.points.at(3).x;
|
|
138
|
+
}
|
|
139
|
+
initialY(index) {
|
|
140
|
+
if (this.isIncreasing) {
|
|
141
|
+
return index === 0 || index === 1 ? this.points.at(1).y : this.points.at(2).y;
|
|
142
|
+
}
|
|
143
|
+
return index === 0 || index === 1 ? this.points.at(0).y : this.points.at(3).y;
|
|
54
144
|
}
|
|
55
145
|
point(xIn, yIn) {
|
|
56
146
|
this.points.push({
|
|
@@ -63,34 +153,20 @@ export class StepPyramid {
|
|
|
63
153
|
|
|
64
154
|
// Add gaps where they are needed.
|
|
65
155
|
this.points = this.points.map((point, index) => {
|
|
156
|
+
const slopeStart = this.slopeStart(index);
|
|
157
|
+
const slopeEnd = this.slopeEnd(index);
|
|
66
158
|
if (this.isHorizontal) {
|
|
67
|
-
const slopeEnd = {
|
|
68
|
-
x: this.max.x,
|
|
69
|
-
y: (this.max.y + this.min.y) / 2
|
|
70
|
-
};
|
|
71
|
-
const slopeStart = index <= 1 ? this.min : {
|
|
72
|
-
x: this.min.x,
|
|
73
|
-
y: this.max.y
|
|
74
|
-
};
|
|
75
159
|
const yGetter = lerpY(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
|
|
76
160
|
const xGap = point.x + (index === 0 || index === 3 ? this.gap : -this.gap);
|
|
77
|
-
const xInitial =
|
|
161
|
+
const xInitial = this.initialX(index);
|
|
78
162
|
return {
|
|
79
163
|
x: xGap,
|
|
80
164
|
y: yGetter(xInitial)
|
|
81
165
|
};
|
|
82
166
|
}
|
|
83
|
-
const slopeEnd = {
|
|
84
|
-
x: (this.max.x + this.min.x) / 2,
|
|
85
|
-
y: this.max.y
|
|
86
|
-
};
|
|
87
|
-
const slopeStart = index <= 1 ? {
|
|
88
|
-
x: this.max.x,
|
|
89
|
-
y: this.min.y
|
|
90
|
-
} : this.min;
|
|
91
167
|
const xGetter = lerpX(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
|
|
92
168
|
const yGap = point.y + (index === 0 || index === 3 ? this.gap : -this.gap);
|
|
93
|
-
const yInitial =
|
|
169
|
+
const yInitial = this.initialY(index);
|
|
94
170
|
return {
|
|
95
171
|
x: xGetter(yInitial),
|
|
96
172
|
y: yGap
|
|
@@ -13,15 +13,19 @@ import { CurveOptions } from "./curve.types.js";
|
|
|
13
13
|
export declare class Step implements CurveGenerator {
|
|
14
14
|
private context;
|
|
15
15
|
private isHorizontal;
|
|
16
|
+
private isIncreasing;
|
|
16
17
|
private gap;
|
|
17
18
|
private borderRadius;
|
|
18
19
|
private position;
|
|
20
|
+
private sections;
|
|
19
21
|
private points;
|
|
20
22
|
constructor(context: CanvasRenderingContext2D, {
|
|
21
23
|
isHorizontal,
|
|
22
24
|
gap,
|
|
23
25
|
position,
|
|
24
|
-
borderRadius
|
|
26
|
+
borderRadius,
|
|
27
|
+
isIncreasing,
|
|
28
|
+
sections
|
|
25
29
|
}: CurveOptions);
|
|
26
30
|
areaStart(): void;
|
|
27
31
|
areaEnd(): void;
|
|
@@ -18,26 +18,44 @@ export class Step {
|
|
|
18
18
|
isHorizontal,
|
|
19
19
|
gap,
|
|
20
20
|
position,
|
|
21
|
-
borderRadius
|
|
21
|
+
borderRadius,
|
|
22
|
+
isIncreasing,
|
|
23
|
+
sections
|
|
22
24
|
}) {
|
|
23
25
|
this.context = void 0;
|
|
24
26
|
this.isHorizontal = false;
|
|
27
|
+
this.isIncreasing = false;
|
|
25
28
|
this.gap = 0;
|
|
26
29
|
this.borderRadius = 0;
|
|
27
30
|
this.position = 0;
|
|
31
|
+
this.sections = 0;
|
|
28
32
|
this.points = [];
|
|
29
33
|
this.context = context;
|
|
30
34
|
this.isHorizontal = isHorizontal ?? false;
|
|
31
35
|
this.gap = (gap ?? 0) / 2;
|
|
32
36
|
this.position = position ?? 0;
|
|
37
|
+
this.sections = sections ?? 1;
|
|
33
38
|
this.borderRadius = borderRadius ?? 0;
|
|
39
|
+
this.isIncreasing = isIncreasing ?? false;
|
|
34
40
|
}
|
|
35
41
|
areaStart() {}
|
|
36
42
|
areaEnd() {}
|
|
37
43
|
lineStart() {}
|
|
38
44
|
lineEnd() {}
|
|
39
45
|
getBorderRadius() {
|
|
40
|
-
|
|
46
|
+
if (this.gap > 0) {
|
|
47
|
+
return this.borderRadius;
|
|
48
|
+
}
|
|
49
|
+
if (this.isIncreasing) {
|
|
50
|
+
if (this.position === this.sections - 1) {
|
|
51
|
+
return this.borderRadius;
|
|
52
|
+
}
|
|
53
|
+
return [0, 0, this.borderRadius, this.borderRadius];
|
|
54
|
+
}
|
|
55
|
+
if (this.position === 0) {
|
|
56
|
+
return this.borderRadius;
|
|
57
|
+
}
|
|
58
|
+
return [this.borderRadius, this.borderRadius];
|
|
41
59
|
}
|
|
42
60
|
point(xIn, yIn) {
|
|
43
61
|
this.points.push({
|
|
@@ -110,6 +110,13 @@ export type FunnelItem = {
|
|
|
110
110
|
export interface DefaultizedFunnelSeriesType extends DefaultizedProps<FunnelSeriesType, CommonDefaultizedProps | 'layout'> {
|
|
111
111
|
dataPoints: FunnelDataPoints[][];
|
|
112
112
|
data: Readonly<MakeRequired<FunnelValueType, 'id' | 'color'>[]>;
|
|
113
|
+
/**
|
|
114
|
+
* Denotes if the data is increasing, first data point is less than the last data point.
|
|
115
|
+
* While the data is decreasing if the first data point is greater than the last data point.
|
|
116
|
+
*
|
|
117
|
+
* This is used to determine the direction of the funnel.
|
|
118
|
+
*/
|
|
119
|
+
dataDirection: 'increasing' | 'decreasing';
|
|
113
120
|
}
|
|
114
121
|
export type FunnelDataPoints = Record<'x' | 'y', number> & {
|
|
115
122
|
useBandWidth: boolean;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ChartsOverlaySlotProps, ChartsOverlaySlots } from '@mui/x-charts/ChartsOverlay';
|
|
2
2
|
import { ChartsTooltipSlotProps, ChartsTooltipSlots } from '@mui/x-charts/ChartsTooltip';
|
|
3
|
-
import { ChartsAxisSlotProps, ChartsAxisSlots } from '@mui/x-charts/internals';
|
|
3
|
+
import { ChartsAxisSlotProps, ChartsAxisSlots, ChartsSlotProps, ChartsSlots } from '@mui/x-charts/internals';
|
|
4
4
|
import { ChartsLegendSlotProps, ChartsLegendSlots } from '@mui/x-charts/ChartsLegend';
|
|
5
|
+
import { ChartsToolbarSlotProps, ChartsToolbarSlots } from '@mui/x-charts/Toolbar';
|
|
5
6
|
import { FunnelPlotSlotProps, FunnelPlotSlots } from "./funnelPlotSlots.types.js";
|
|
6
|
-
export interface FunnelChartSlots extends ChartsAxisSlots, FunnelPlotSlots, ChartsLegendSlots, ChartsTooltipSlots, ChartsOverlaySlots, ChartsAxisSlots {}
|
|
7
|
-
export interface FunnelChartSlotProps extends ChartsAxisSlotProps, FunnelPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps, ChartsOverlaySlotProps, ChartsAxisSlotProps {}
|
|
7
|
+
export interface FunnelChartSlots extends ChartsAxisSlots, FunnelPlotSlots, ChartsLegendSlots, ChartsTooltipSlots, ChartsOverlaySlots, ChartsAxisSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
8
|
+
export interface FunnelChartSlotProps extends ChartsAxisSlotProps, FunnelPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps, ChartsOverlaySlotProps, ChartsAxisSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
8
9
|
export interface FunnelChartSlotExtension {
|
|
9
10
|
/**
|
|
10
11
|
* Overridable component slots.
|
|
@@ -25,6 +25,9 @@ const seriesProcessor = params => {
|
|
|
25
25
|
const isHorizontal = seriesOrder.some(seriesId => series[seriesId].layout === 'horizontal');
|
|
26
26
|
seriesOrder.forEach(seriesId => {
|
|
27
27
|
const currentSeries = series[seriesId];
|
|
28
|
+
const firstDataPoint = currentSeries.data.at(0);
|
|
29
|
+
const lastDataPoint = currentSeries.data.at(-1);
|
|
30
|
+
const dataDirection = firstDataPoint !== undefined && lastDataPoint !== undefined && firstDataPoint.value < lastDataPoint.value ? 'increasing' : 'decreasing';
|
|
28
31
|
completedSeries[seriesId] = _extends({
|
|
29
32
|
labelMarkType: 'square',
|
|
30
33
|
layout: isHorizontal ? 'horizontal' : 'vertical',
|
|
@@ -33,6 +36,7 @@ const seriesProcessor = params => {
|
|
|
33
36
|
data: currentSeries.data.map((v, i) => _extends({
|
|
34
37
|
id: `${seriesId}-funnel-item-${v.id ?? i}`
|
|
35
38
|
}, v)),
|
|
39
|
+
dataDirection,
|
|
36
40
|
dataPoints: []
|
|
37
41
|
});
|
|
38
42
|
const stackOffsets = completedSeries[seriesId].data.toReversed().map((_, i, array) => array.slice(0, i).reduce((acc, item) => acc + item.value, 0)).toReversed();
|
|
@@ -40,12 +44,54 @@ const seriesProcessor = params => {
|
|
|
40
44
|
// Main = main axis, Other = other axis
|
|
41
45
|
// For horizontal layout, main is y, other is x
|
|
42
46
|
// For vertical layout, main is x, other is y
|
|
47
|
+
const isIncreasing = completedSeries[seriesId].dataDirection === 'increasing';
|
|
43
48
|
const currentMaxMain = item.value;
|
|
44
|
-
const
|
|
49
|
+
const getNextDataIndex = () => {
|
|
50
|
+
if (isIncreasing) {
|
|
51
|
+
return dataIndex === 0 ? dataIndex : dataIndex - 1;
|
|
52
|
+
}
|
|
53
|
+
return dataIndex === array.length - 1 ? dataIndex : dataIndex + 1;
|
|
54
|
+
};
|
|
55
|
+
const nextDataIndex = getNextDataIndex();
|
|
45
56
|
const nextMaxMain = array[nextDataIndex].value ?? 0;
|
|
46
57
|
const nextMaxOther = 0;
|
|
47
58
|
const currentMaxOther = completedSeries[seriesId].data[dataIndex].value;
|
|
48
59
|
const stackOffset = stackOffsets[dataIndex];
|
|
60
|
+
if (isIncreasing) {
|
|
61
|
+
return [
|
|
62
|
+
// Top right (vertical) or Top left (horizontal)
|
|
63
|
+
createPoint({
|
|
64
|
+
main: nextMaxMain,
|
|
65
|
+
other: nextMaxOther,
|
|
66
|
+
inverse: isHorizontal,
|
|
67
|
+
useBandWidth: false,
|
|
68
|
+
stackOffset
|
|
69
|
+
}),
|
|
70
|
+
// Bottom right (vertical) or Top right (horizontal)
|
|
71
|
+
createPoint({
|
|
72
|
+
main: currentMaxMain,
|
|
73
|
+
other: currentMaxOther,
|
|
74
|
+
inverse: isHorizontal,
|
|
75
|
+
useBandWidth: true,
|
|
76
|
+
stackOffset
|
|
77
|
+
}),
|
|
78
|
+
// Bottom left (vertical) or Bottom right (horizontal)
|
|
79
|
+
createPoint({
|
|
80
|
+
main: -currentMaxMain,
|
|
81
|
+
other: currentMaxOther,
|
|
82
|
+
inverse: isHorizontal,
|
|
83
|
+
useBandWidth: true,
|
|
84
|
+
stackOffset
|
|
85
|
+
}),
|
|
86
|
+
// Top left (vertical) or Bottom left (horizontal)
|
|
87
|
+
createPoint({
|
|
88
|
+
main: -nextMaxMain,
|
|
89
|
+
other: nextMaxOther,
|
|
90
|
+
inverse: isHorizontal,
|
|
91
|
+
useBandWidth: false,
|
|
92
|
+
stackOffset
|
|
93
|
+
})];
|
|
94
|
+
}
|
|
49
95
|
return [
|
|
50
96
|
// Top right (vertical) or Top left (horizontal)
|
|
51
97
|
createPoint({
|
|
@@ -3,6 +3,7 @@ import { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
|
|
|
3
3
|
import { ChartsLegendSlotExtension } from '@mui/x-charts/ChartsLegend';
|
|
4
4
|
import { ChartsWrapperProps } from '@mui/x-charts/internals';
|
|
5
5
|
import { ChartsAxisHighlightProps } from '@mui/x-charts/ChartsAxisHighlight';
|
|
6
|
+
import { FunnelChartPluginsSignatures } from "./FunnelChart.plugins.js";
|
|
6
7
|
import { FunnelPlotProps } from "./FunnelPlot.js";
|
|
7
8
|
import type { FunnelChartProps } from "./FunnelChart.js";
|
|
8
9
|
import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
@@ -14,7 +15,7 @@ import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
|
14
15
|
* @returns An object with props for the children components of FunnelChart
|
|
15
16
|
*/
|
|
16
17
|
export declare const useFunnelChartProps: (props: FunnelChartProps) => {
|
|
17
|
-
chartContainerProps: ChartContainerProProps<"funnel">;
|
|
18
|
+
chartContainerProps: ChartContainerProProps<"funnel", FunnelChartPluginsSignatures>;
|
|
18
19
|
funnelPlotProps: FunnelPlotProps;
|
|
19
20
|
overlayProps: ChartsOverlayProps;
|
|
20
21
|
chartsAxisProps: ChartsAxisProps;
|
|
@@ -7,6 +7,7 @@ import { DEFAULT_MARGINS, DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '@mui/x-
|
|
|
7
7
|
import { defaultizeMargin } from '@mui/x-charts/internals';
|
|
8
8
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
9
9
|
import { strawberrySkyPalette } from '@mui/x-charts/colorPalettes';
|
|
10
|
+
import { FUNNEL_CHART_PLUGINS } from "./FunnelChart.plugins.js";
|
|
10
11
|
function getCategoryAxisConfig(categoryAxis, series, isHorizontal, direction) {
|
|
11
12
|
const maxSeriesLength = Math.max(...series.map(s => (s.data ?? []).length), 0);
|
|
12
13
|
const maxSeriesValue = Array.from({
|
|
@@ -113,7 +114,8 @@ export const useFunnelChartProps = props => {
|
|
|
113
114
|
highlightedItem,
|
|
114
115
|
onHighlightChange,
|
|
115
116
|
className,
|
|
116
|
-
apiRef
|
|
117
|
+
apiRef,
|
|
118
|
+
plugins: FUNNEL_CHART_PLUGINS
|
|
117
119
|
});
|
|
118
120
|
const funnelPlotProps = {
|
|
119
121
|
gap,
|
package/esm/Heatmap/Heatmap.d.ts
CHANGED
|
@@ -4,22 +4,30 @@ import { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
|
|
|
4
4
|
import { ChartsTooltipProps } from '@mui/x-charts/ChartsTooltip';
|
|
5
5
|
import { ChartsAxisSlots, ChartsAxisSlotProps, XAxis, YAxis } from '@mui/x-charts/internals';
|
|
6
6
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '@mui/x-charts/ChartsOverlay';
|
|
7
|
+
import { ChartsLegendSlotProps, ChartsLegendSlots } from '@mui/x-charts/ChartsLegend';
|
|
8
|
+
import { ChartsToolbarSlotProps, ChartsToolbarSlots } from '@mui/x-charts/Toolbar';
|
|
9
|
+
import { ChartsSlotPropsPro, ChartsSlotsPro } from "../internals/material/index.js";
|
|
7
10
|
import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
8
11
|
import { HeatmapSeriesType } from "../models/seriesType/heatmap.js";
|
|
9
|
-
import { HeatmapTooltipProps } from "./HeatmapTooltip/
|
|
12
|
+
import { HeatmapTooltipProps } from "./HeatmapTooltip/index.js";
|
|
10
13
|
import { HeatmapItemSlotProps, HeatmapItemSlots } from "./HeatmapItem.js";
|
|
11
14
|
import { HeatmapPluginsSignatures } from "./Heatmap.plugins.js";
|
|
12
|
-
export interface HeatmapSlots extends ChartsAxisSlots, ChartsOverlaySlots, HeatmapItemSlots {
|
|
15
|
+
export interface HeatmapSlots extends ChartsAxisSlots, ChartsOverlaySlots, HeatmapItemSlots, ChartsToolbarSlots, Partial<ChartsSlotsPro> {
|
|
13
16
|
/**
|
|
14
|
-
* Custom component for the tooltip
|
|
17
|
+
* Custom component for the tooltip.
|
|
15
18
|
* @default ChartsTooltipRoot
|
|
16
19
|
*/
|
|
17
20
|
tooltip?: React.ElementType<HeatmapTooltipProps>;
|
|
21
|
+
/**
|
|
22
|
+
* Custom component for the legend.
|
|
23
|
+
* @default ContinuousColorLegendProps
|
|
24
|
+
*/
|
|
25
|
+
legend?: ChartsLegendSlots['legend'];
|
|
18
26
|
}
|
|
19
|
-
export interface HeatmapSlotProps extends ChartsAxisSlotProps, ChartsOverlaySlotProps, HeatmapItemSlotProps {
|
|
27
|
+
export interface HeatmapSlotProps extends ChartsAxisSlotProps, ChartsOverlaySlotProps, HeatmapItemSlotProps, ChartsLegendSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotPropsPro> {
|
|
20
28
|
tooltip?: Partial<HeatmapTooltipProps>;
|
|
21
29
|
}
|
|
22
|
-
export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', HeatmapPluginsSignatures>, 'series' | 'plugins' | 'xAxis' | 'yAxis' | 'skipAnimation'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
30
|
+
export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', HeatmapPluginsSignatures>, 'series' | 'plugins' | 'xAxis' | 'yAxis' | 'skipAnimation' | 'slots' | 'slotProps'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
23
31
|
/**
|
|
24
32
|
* The configuration of the x-axes.
|
|
25
33
|
* If not provided, a default axis config is used.
|
|
@@ -42,6 +50,11 @@ export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', Hea
|
|
|
42
50
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
43
51
|
*/
|
|
44
52
|
tooltip?: ChartsTooltipProps;
|
|
53
|
+
/**
|
|
54
|
+
* If `true`, the legend is not rendered.
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
hideLegend?: boolean;
|
|
45
58
|
/**
|
|
46
59
|
* Overridable component slots.
|
|
47
60
|
* @default {}
|