@mui/x-charts-pro 8.0.0-alpha.12 → 8.0.0-alpha.14
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 +2 -1
- package/BarChartPro/BarChartPro.js +25 -30
- package/CHANGELOG.md +430 -0
- package/ChartContainerPro/ChartContainerPro.d.ts +1 -1
- package/ChartContainerPro/ChartContainerPro.js +1 -1
- package/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/ChartContainerPro/useChartContainerProProps.js +3 -1
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +3 -2
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
- package/FunnelChart/FunnelChart.d.ts +37 -0
- package/FunnelChart/FunnelChart.js +218 -0
- package/FunnelChart/FunnelPlot.d.ts +16 -0
- package/FunnelChart/FunnelPlot.js +191 -0
- package/FunnelChart/FunnelSection.d.ts +15 -0
- package/FunnelChart/FunnelSection.js +62 -0
- package/FunnelChart/categoryAxis.types.d.ts +24 -0
- package/FunnelChart/categoryAxis.types.js +5 -0
- package/FunnelChart/funnel.types.d.ts +124 -0
- package/FunnelChart/funnel.types.js +5 -0
- package/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
- package/FunnelChart/funnelPlotSlots.types.js +5 -0
- package/FunnelChart/funnelSectionClasses.d.ts +13 -0
- package/FunnelChart/funnelSectionClasses.js +28 -0
- package/FunnelChart/funnelSlots.types.d.ts +19 -0
- package/FunnelChart/funnelSlots.types.js +5 -0
- package/FunnelChart/funnelStepCurve.d.ts +4 -0
- package/FunnelChart/funnelStepCurve.js +74 -0
- package/FunnelChart/index.d.ts +7 -0
- package/FunnelChart/index.js +59 -0
- package/FunnelChart/labelUtils.d.ts +42 -0
- package/FunnelChart/labelUtils.js +174 -0
- package/FunnelChart/seriesConfig/extremums.d.ts +3 -0
- package/FunnelChart/seriesConfig/extremums.js +50 -0
- package/FunnelChart/seriesConfig/getColor.d.ts +3 -0
- package/FunnelChart/seriesConfig/getColor.js +10 -0
- package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +18 -0
- package/FunnelChart/seriesConfig/index.d.ts +2 -0
- package/FunnelChart/seriesConfig/index.js +22 -0
- package/FunnelChart/seriesConfig/legend.d.ts +3 -0
- package/FunnelChart/seriesConfig/legend.js +31 -0
- package/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
- package/FunnelChart/seriesConfig/seriesProcessor.js +96 -0
- package/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
- package/FunnelChart/seriesConfig/tooltip.js +36 -0
- package/FunnelChart/useFunnelChartProps.d.ts +30 -0
- package/FunnelChart/useFunnelChartProps.js +168 -0
- package/Heatmap/Heatmap.d.ts +5 -4
- package/Heatmap/Heatmap.js +37 -52
- package/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +15 -0
- package/Heatmap/seriesConfig/index.js +3 -1
- package/LineChartPro/LineChartPro.d.ts +2 -1
- package/LineChartPro/LineChartPro.js +25 -30
- package/ScatterChartPro/ScatterChartPro.js +25 -30
- package/esm/BarChartPro/BarChartPro.d.ts +2 -1
- package/esm/BarChartPro/BarChartPro.js +25 -30
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +1 -1
- package/esm/ChartContainerPro/ChartContainerPro.js +1 -1
- package/esm/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/esm/ChartContainerPro/useChartContainerProProps.js +3 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +3 -2
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
- package/esm/FunnelChart/FunnelChart.d.ts +37 -0
- package/esm/FunnelChart/FunnelChart.js +212 -0
- package/esm/FunnelChart/FunnelPlot.d.ts +16 -0
- package/esm/FunnelChart/FunnelPlot.js +184 -0
- package/esm/FunnelChart/FunnelSection.d.ts +15 -0
- package/esm/FunnelChart/FunnelSection.js +56 -0
- package/esm/FunnelChart/categoryAxis.types.d.ts +24 -0
- package/esm/FunnelChart/categoryAxis.types.js +1 -0
- package/esm/FunnelChart/funnel.types.d.ts +124 -0
- package/esm/FunnelChart/funnel.types.js +1 -0
- package/esm/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
- package/esm/FunnelChart/funnelPlotSlots.types.js +1 -0
- package/esm/FunnelChart/funnelSectionClasses.d.ts +13 -0
- package/esm/FunnelChart/funnelSectionClasses.js +20 -0
- package/esm/FunnelChart/funnelSlots.types.d.ts +19 -0
- package/esm/FunnelChart/funnelSlots.types.js +1 -0
- package/esm/FunnelChart/funnelStepCurve.d.ts +4 -0
- package/esm/FunnelChart/funnelStepCurve.js +67 -0
- package/esm/FunnelChart/index.d.ts +7 -0
- package/esm/FunnelChart/index.js +5 -0
- package/esm/FunnelChart/labelUtils.d.ts +42 -0
- package/esm/FunnelChart/labelUtils.js +166 -0
- package/esm/FunnelChart/seriesConfig/extremums.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/extremums.js +42 -0
- package/esm/FunnelChart/seriesConfig/getColor.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/getColor.js +4 -0
- package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +11 -0
- package/esm/FunnelChart/seriesConfig/index.d.ts +2 -0
- package/esm/FunnelChart/seriesConfig/index.js +15 -0
- package/esm/FunnelChart/seriesConfig/legend.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/legend.js +25 -0
- package/esm/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/seriesProcessor.js +89 -0
- package/esm/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/tooltip.js +29 -0
- package/esm/FunnelChart/useFunnelChartProps.d.ts +30 -0
- package/esm/FunnelChart/useFunnelChartProps.js +161 -0
- package/esm/Heatmap/Heatmap.d.ts +5 -4
- package/esm/Heatmap/Heatmap.js +37 -52
- package/esm/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/esm/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +8 -0
- package/esm/Heatmap/seriesConfig/index.js +3 -1
- package/esm/LineChartPro/LineChartPro.d.ts +2 -1
- package/esm/LineChartPro/LineChartPro.js +25 -30
- package/esm/ScatterChartPro/ScatterChartPro.js +25 -30
- package/esm/hooks/useFunnelSeries.d.ts +33 -0
- package/esm/hooks/useFunnelSeries.js +42 -0
- package/esm/index.d.ts +3 -1
- package/esm/index.js +4 -2
- package/esm/internals/plugins/allPlugins.d.ts +3 -3
- package/esm/internals/plugins/allPlugins.js +2 -2
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +63 -12
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +26 -24
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +12 -3
- package/esm/internals/utils/releaseInfo.js +1 -1
- package/esm/models/seriesType/heatmap.d.ts +2 -2
- package/esm/typeOverloads/modules.d.ts +13 -2
- package/hooks/useFunnelSeries.d.ts +33 -0
- package/hooks/useFunnelSeries.js +48 -0
- package/index.d.ts +3 -1
- package/index.js +23 -1
- package/internals/plugins/allPlugins.d.ts +3 -3
- package/internals/plugins/allPlugins.js +1 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.js +63 -12
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +26 -24
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +12 -3
- package/internals/utils/releaseInfo.js +1 -1
- package/models/seriesType/heatmap.d.ts +2 -2
- package/modern/BarChartPro/BarChartPro.d.ts +2 -1
- package/modern/BarChartPro/BarChartPro.js +25 -30
- package/modern/ChartContainerPro/ChartContainerPro.d.ts +1 -1
- package/modern/ChartContainerPro/ChartContainerPro.js +1 -1
- package/modern/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/modern/ChartContainerPro/useChartContainerProProps.js +3 -1
- package/modern/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
- package/modern/ChartDataProviderPro/ChartDataProviderPro.js +3 -2
- package/modern/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
- package/modern/FunnelChart/FunnelChart.d.ts +37 -0
- package/modern/FunnelChart/FunnelChart.js +212 -0
- package/modern/FunnelChart/FunnelPlot.d.ts +16 -0
- package/modern/FunnelChart/FunnelPlot.js +184 -0
- package/modern/FunnelChart/FunnelSection.d.ts +15 -0
- package/modern/FunnelChart/FunnelSection.js +56 -0
- package/modern/FunnelChart/categoryAxis.types.d.ts +24 -0
- package/modern/FunnelChart/categoryAxis.types.js +1 -0
- package/modern/FunnelChart/funnel.types.d.ts +124 -0
- package/modern/FunnelChart/funnel.types.js +1 -0
- package/modern/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
- package/modern/FunnelChart/funnelPlotSlots.types.js +1 -0
- package/modern/FunnelChart/funnelSectionClasses.d.ts +13 -0
- package/modern/FunnelChart/funnelSectionClasses.js +20 -0
- package/modern/FunnelChart/funnelSlots.types.d.ts +19 -0
- package/modern/FunnelChart/funnelSlots.types.js +1 -0
- package/modern/FunnelChart/funnelStepCurve.d.ts +4 -0
- package/modern/FunnelChart/funnelStepCurve.js +67 -0
- package/modern/FunnelChart/index.d.ts +7 -0
- package/modern/FunnelChart/index.js +5 -0
- package/modern/FunnelChart/labelUtils.d.ts +42 -0
- package/modern/FunnelChart/labelUtils.js +166 -0
- package/modern/FunnelChart/seriesConfig/extremums.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/extremums.js +42 -0
- package/modern/FunnelChart/seriesConfig/getColor.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/getColor.js +4 -0
- package/modern/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +11 -0
- package/modern/FunnelChart/seriesConfig/index.d.ts +2 -0
- package/modern/FunnelChart/seriesConfig/index.js +15 -0
- package/modern/FunnelChart/seriesConfig/legend.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/legend.js +25 -0
- package/modern/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/seriesProcessor.js +89 -0
- package/modern/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/tooltip.js +29 -0
- package/modern/FunnelChart/useFunnelChartProps.d.ts +30 -0
- package/modern/FunnelChart/useFunnelChartProps.js +161 -0
- package/modern/Heatmap/Heatmap.d.ts +5 -4
- package/modern/Heatmap/Heatmap.js +37 -52
- package/modern/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/modern/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +8 -0
- package/modern/Heatmap/seriesConfig/index.js +3 -1
- package/modern/LineChartPro/LineChartPro.d.ts +2 -1
- package/modern/LineChartPro/LineChartPro.js +25 -30
- package/modern/ScatterChartPro/ScatterChartPro.js +25 -30
- package/modern/hooks/useFunnelSeries.d.ts +33 -0
- package/modern/hooks/useFunnelSeries.js +42 -0
- package/modern/index.d.ts +3 -1
- package/modern/index.js +4 -2
- package/modern/internals/plugins/allPlugins.d.ts +3 -3
- package/modern/internals/plugins/allPlugins.js +2 -2
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +63 -12
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +26 -24
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +12 -3
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/models/seriesType/heatmap.d.ts +2 -2
- package/modern/typeOverloads/modules.d.ts +13 -2
- package/package.json +5 -5
- package/tsconfig.build.tsbuildinfo +1 -1
- package/typeOverloads/modules.d.ts +13 -2
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["onItemClick"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { line as d3Line } from '@mui/x-charts-vendor/d3-shape';
|
|
7
|
+
import { getCurveFactory, cartesianSeriesTypes } from '@mui/x-charts/internals';
|
|
8
|
+
import { useXAxes, useYAxes } from '@mui/x-charts/hooks';
|
|
9
|
+
import { useTheme } from '@mui/material/styles';
|
|
10
|
+
import { FunnelSection } from "./FunnelSection.js";
|
|
11
|
+
import { alignLabel, positionLabel } from "./labelUtils.js";
|
|
12
|
+
import { funnelHorizontalStepCurve, funnelVerticalStepCurve } from "./funnelStepCurve.js";
|
|
13
|
+
import { useFunnelSeriesContext } from "../hooks/useFunnelSeries.js";
|
|
14
|
+
import { createElement as _createElement } from "react";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
cartesianSeriesTypes.addType('funnel');
|
|
17
|
+
const getFunnelCurve = (curve, isHorizontal) => {
|
|
18
|
+
if (curve === 'step') {
|
|
19
|
+
return isHorizontal ? funnelHorizontalStepCurve : funnelVerticalStepCurve;
|
|
20
|
+
}
|
|
21
|
+
if (curve === 'bump') {
|
|
22
|
+
return isHorizontal ? getCurveFactory('bumpX') : getCurveFactory('bumpY');
|
|
23
|
+
}
|
|
24
|
+
return getCurveFactory(curve ?? 'linear');
|
|
25
|
+
};
|
|
26
|
+
const useAggregatedData = () => {
|
|
27
|
+
const seriesData = useFunnelSeriesContext();
|
|
28
|
+
const {
|
|
29
|
+
xAxis,
|
|
30
|
+
xAxisIds
|
|
31
|
+
} = useXAxes();
|
|
32
|
+
const {
|
|
33
|
+
yAxis,
|
|
34
|
+
yAxisIds
|
|
35
|
+
} = useYAxes();
|
|
36
|
+
const allData = React.useMemo(() => {
|
|
37
|
+
if (seriesData === undefined) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
const {
|
|
41
|
+
series,
|
|
42
|
+
seriesOrder
|
|
43
|
+
} = seriesData;
|
|
44
|
+
const defaultXAxisId = xAxisIds[0];
|
|
45
|
+
const defaultYAxisId = yAxisIds[0];
|
|
46
|
+
const isHorizontal = Object.values(series).some(s => s.layout === 'horizontal');
|
|
47
|
+
const result = seriesOrder.map(seriesId => {
|
|
48
|
+
const currentSeries = series[seriesId];
|
|
49
|
+
const xAxisId = currentSeries.xAxisId ?? defaultXAxisId;
|
|
50
|
+
const yAxisId = currentSeries.yAxisId ?? defaultYAxisId;
|
|
51
|
+
const valueFormatter = currentSeries.valueFormatter;
|
|
52
|
+
const baseScaleConfig = isHorizontal ? xAxis[xAxisId] : yAxis[yAxisId];
|
|
53
|
+
const isXAxisBand = xAxis[xAxisId].scaleType === 'band';
|
|
54
|
+
const isYAxisBand = yAxis[yAxisId].scaleType === 'band';
|
|
55
|
+
const bandWidth = (isXAxisBand || isYAxisBand) && baseScaleConfig.scale?.bandwidth() || 0;
|
|
56
|
+
const xScale = xAxis[xAxisId].scale;
|
|
57
|
+
const yScale = yAxis[yAxisId].scale;
|
|
58
|
+
const curve = getFunnelCurve(currentSeries.curve, isHorizontal);
|
|
59
|
+
const xPosition = (value, bandIndex, stackOffset, useBand) => {
|
|
60
|
+
if (isXAxisBand) {
|
|
61
|
+
const position = xScale(bandIndex);
|
|
62
|
+
return useBand ? position + bandWidth : position;
|
|
63
|
+
}
|
|
64
|
+
return xScale(isHorizontal ? value + (stackOffset || 0) : value);
|
|
65
|
+
};
|
|
66
|
+
const yPosition = (value, bandIndex, stackOffset, useBand) => {
|
|
67
|
+
if (isYAxisBand) {
|
|
68
|
+
const position = yScale(bandIndex);
|
|
69
|
+
return useBand ? position + bandWidth : position;
|
|
70
|
+
}
|
|
71
|
+
return yScale(isHorizontal ? value : value + (stackOffset || 0));
|
|
72
|
+
};
|
|
73
|
+
return currentSeries.dataPoints.map((values, dataIndex) => {
|
|
74
|
+
const color = currentSeries.data[dataIndex].color;
|
|
75
|
+
const id = `${seriesId}-${dataIndex}`;
|
|
76
|
+
const sectionLabel = typeof currentSeries.sectionLabel === 'function' ? currentSeries.sectionLabel({
|
|
77
|
+
dataIndex,
|
|
78
|
+
seriesId,
|
|
79
|
+
value: currentSeries.data[dataIndex].value
|
|
80
|
+
}) : currentSeries.sectionLabel;
|
|
81
|
+
const line = d3Line().x(d => xPosition(d.x, baseScaleConfig.data?.[dataIndex], d.stackOffset, d.useBandWidth)).y(d => yPosition(d.y, baseScaleConfig.data?.[dataIndex], d.stackOffset, d.useBandWidth)).curve(curve);
|
|
82
|
+
return {
|
|
83
|
+
d: line(values),
|
|
84
|
+
color,
|
|
85
|
+
id,
|
|
86
|
+
seriesId,
|
|
87
|
+
dataIndex,
|
|
88
|
+
label: sectionLabel !== false && _extends({}, positionLabel(_extends({}, sectionLabel, {
|
|
89
|
+
xPosition,
|
|
90
|
+
yPosition,
|
|
91
|
+
isHorizontal,
|
|
92
|
+
values,
|
|
93
|
+
dataIndex,
|
|
94
|
+
baseScaleData: baseScaleConfig.data ?? []
|
|
95
|
+
})), alignLabel(sectionLabel ?? {}), {
|
|
96
|
+
value: valueFormatter ? valueFormatter(currentSeries.data[dataIndex], {
|
|
97
|
+
dataIndex
|
|
98
|
+
}) : currentSeries.data[dataIndex].value?.toLocaleString()
|
|
99
|
+
})
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
return result.flat();
|
|
104
|
+
}, [seriesData, xAxis, xAxisIds, yAxis, yAxisIds]);
|
|
105
|
+
return allData;
|
|
106
|
+
};
|
|
107
|
+
function FunnelPlot(props) {
|
|
108
|
+
const {
|
|
109
|
+
onItemClick
|
|
110
|
+
} = props,
|
|
111
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
112
|
+
const theme = useTheme();
|
|
113
|
+
const data = useAggregatedData();
|
|
114
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
115
|
+
children: [data.map(({
|
|
116
|
+
d,
|
|
117
|
+
color,
|
|
118
|
+
id,
|
|
119
|
+
seriesId,
|
|
120
|
+
dataIndex
|
|
121
|
+
}) => /*#__PURE__*/_createElement(FunnelSection, _extends({}, other, {
|
|
122
|
+
d: d,
|
|
123
|
+
color: color,
|
|
124
|
+
key: id,
|
|
125
|
+
dataIndex: dataIndex,
|
|
126
|
+
seriesId: seriesId,
|
|
127
|
+
onClick: onItemClick && (event => {
|
|
128
|
+
onItemClick(event, {
|
|
129
|
+
type: 'funnel',
|
|
130
|
+
seriesId,
|
|
131
|
+
dataIndex
|
|
132
|
+
});
|
|
133
|
+
})
|
|
134
|
+
}))), data.map(({
|
|
135
|
+
id,
|
|
136
|
+
label
|
|
137
|
+
}) => {
|
|
138
|
+
if (!label) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
return /*#__PURE__*/_jsx("text", {
|
|
142
|
+
x: label.x,
|
|
143
|
+
y: label.y,
|
|
144
|
+
textAnchor: label.textAnchor,
|
|
145
|
+
dominantBaseline: label.dominantBaseline,
|
|
146
|
+
stroke: "none",
|
|
147
|
+
pointerEvents: "none",
|
|
148
|
+
fontFamily: theme.typography.body2.fontFamily,
|
|
149
|
+
fontSize: theme.typography.body2.fontSize,
|
|
150
|
+
fontSizeAdjust: theme.typography.body2.fontSizeAdjust,
|
|
151
|
+
fontWeight: theme.typography.body2.fontWeight,
|
|
152
|
+
letterSpacing: theme.typography.body2.letterSpacing,
|
|
153
|
+
fontStretch: theme.typography.body2.fontStretch,
|
|
154
|
+
fontStyle: theme.typography.body2.fontStyle,
|
|
155
|
+
fontVariant: theme.typography.body2.fontVariant,
|
|
156
|
+
fill: (theme.vars || theme)?.palette?.text?.primary,
|
|
157
|
+
children: label.value
|
|
158
|
+
}, id);
|
|
159
|
+
})]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
process.env.NODE_ENV !== "production" ? FunnelPlot.propTypes = {
|
|
163
|
+
// ----------------------------- Warning --------------------------------
|
|
164
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
165
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
166
|
+
// ----------------------------------------------------------------------
|
|
167
|
+
/**
|
|
168
|
+
* Callback fired when a funnel item is clicked.
|
|
169
|
+
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
170
|
+
* @param {FunnelItemIdentifier} funnelItemIdentifier The funnel item identifier.
|
|
171
|
+
*/
|
|
172
|
+
onItemClick: PropTypes.func,
|
|
173
|
+
/**
|
|
174
|
+
* The props used for each component slot.
|
|
175
|
+
* @default {}
|
|
176
|
+
*/
|
|
177
|
+
slotProps: PropTypes.object,
|
|
178
|
+
/**
|
|
179
|
+
* Overridable component slots.
|
|
180
|
+
* @default {}
|
|
181
|
+
*/
|
|
182
|
+
slots: PropTypes.object
|
|
183
|
+
} : void 0;
|
|
184
|
+
export { FunnelPlot };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SeriesId } from '@mui/x-charts/internals';
|
|
3
|
+
import { FunnelSectionClasses } from "./funnelSectionClasses.js";
|
|
4
|
+
export interface FunnelSectionProps extends Omit<React.SVGProps<SVGPathElement>, 'ref' | 'id'> {
|
|
5
|
+
seriesId: SeriesId;
|
|
6
|
+
dataIndex: number;
|
|
7
|
+
color: string;
|
|
8
|
+
classes?: Partial<FunnelSectionClasses>;
|
|
9
|
+
}
|
|
10
|
+
export declare const FunnelSectionPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, React.SVGProps<SVGPathElement>, {}>;
|
|
11
|
+
/**
|
|
12
|
+
* @ignore - internal component.
|
|
13
|
+
*/
|
|
14
|
+
declare const FunnelSection: React.ForwardRefExoticComponent<FunnelSectionProps & React.RefAttributes<{}>>;
|
|
15
|
+
export { FunnelSection };
|
|
@@ -0,0 +1,56 @@
|
|
|
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 = ["seriesId", "dataIndex", "classes", "color", "onClick", "className"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { styled } from '@mui/material/styles';
|
|
8
|
+
import { useInteractionItemProps, consumeSlots } from '@mui/x-charts/internals';
|
|
9
|
+
import { useItemHighlighted } from '@mui/x-charts/hooks';
|
|
10
|
+
import clsx from 'clsx';
|
|
11
|
+
import { useUtilityClasses } from "./funnelSectionClasses.js";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
export const FunnelSectionPath = styled('path')(() => ({
|
|
14
|
+
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @ignore - internal component.
|
|
19
|
+
*/
|
|
20
|
+
const FunnelSection = consumeSlots('MuiFunnelSection', 'funnelSection', {
|
|
21
|
+
classesResolver: useUtilityClasses
|
|
22
|
+
}, function FunnelSection(props, ref) {
|
|
23
|
+
const {
|
|
24
|
+
seriesId,
|
|
25
|
+
dataIndex,
|
|
26
|
+
classes,
|
|
27
|
+
color,
|
|
28
|
+
onClick,
|
|
29
|
+
className
|
|
30
|
+
} = props,
|
|
31
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
32
|
+
const getInteractionItemProps = useInteractionItemProps();
|
|
33
|
+
const {
|
|
34
|
+
isFaded,
|
|
35
|
+
isHighlighted
|
|
36
|
+
} = useItemHighlighted({
|
|
37
|
+
seriesId,
|
|
38
|
+
dataIndex
|
|
39
|
+
});
|
|
40
|
+
return /*#__PURE__*/_jsx(FunnelSectionPath, _extends({}, getInteractionItemProps({
|
|
41
|
+
type: 'funnel',
|
|
42
|
+
seriesId,
|
|
43
|
+
dataIndex
|
|
44
|
+
}), {
|
|
45
|
+
filter: isHighlighted ? 'brightness(120%)' : undefined,
|
|
46
|
+
opacity: isFaded ? 0.3 : 1,
|
|
47
|
+
fill: color,
|
|
48
|
+
stroke: "none",
|
|
49
|
+
cursor: onClick ? 'pointer' : 'unset',
|
|
50
|
+
onClick: onClick,
|
|
51
|
+
className: clsx(classes?.root, className, isHighlighted && classes?.highlighted, isFaded && classes?.faded)
|
|
52
|
+
}, other, {
|
|
53
|
+
ref: ref
|
|
54
|
+
}));
|
|
55
|
+
});
|
|
56
|
+
export { FunnelSection };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AxisConfig, ScaleName } from '@mui/x-charts/models';
|
|
2
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
+
export type CategoryAxis = {
|
|
4
|
+
/**
|
|
5
|
+
* The categories to be displayed on the axis.
|
|
6
|
+
* The order of the categories is the order in which they are displayed.
|
|
7
|
+
*/
|
|
8
|
+
categories?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* The position of the axis.
|
|
11
|
+
* - 'left' - The axis is positioned on the left side of the chart.
|
|
12
|
+
* - 'right' - The axis is positioned on the right side of the chart.
|
|
13
|
+
* - 'top' - The axis is positioned on the top side of the chart.
|
|
14
|
+
* - 'bottom' - The axis is positioned on the bottom side of the chart.
|
|
15
|
+
* - 'none' - The axis is not displayed.
|
|
16
|
+
*/
|
|
17
|
+
position?: 'left' | 'right' | 'top' | 'bottom' | 'none';
|
|
18
|
+
/**
|
|
19
|
+
* The size of the axis.
|
|
20
|
+
* - If the axis is horizontal, the size is the height of the axis.
|
|
21
|
+
* - If the axis is vertical, the size is the width of the axis.
|
|
22
|
+
*/
|
|
23
|
+
size?: number;
|
|
24
|
+
} & MakeOptional<Pick<AxisConfig<ScaleName, any>, 'disableLine' | 'disableTicks' | 'scaleType' | 'tickLabelStyle' | 'tickSize' | 'id'>, 'id'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { ChartsLabelMarkProps } from '@mui/x-charts/ChartsLabel';
|
|
2
|
+
import { CommonSeriesType, CartesianSeriesType, CommonDefaultizedProps, SeriesId } from '@mui/x-charts/internals';
|
|
3
|
+
import { CurveType, Position } from '@mui/x-charts/models';
|
|
4
|
+
import { DefaultizedProps, MakeRequired } from '@mui/x-internals/types';
|
|
5
|
+
export type FunnelItemId = string | number;
|
|
6
|
+
export type FunnelCurveType = Extract<CurveType, 'linear' | 'step'> | 'bump';
|
|
7
|
+
export type FunnelValueType = {
|
|
8
|
+
/**
|
|
9
|
+
* A unique identifier of the funnel section.
|
|
10
|
+
*/
|
|
11
|
+
id?: FunnelItemId;
|
|
12
|
+
/**
|
|
13
|
+
* The value of the funnel section.
|
|
14
|
+
*/
|
|
15
|
+
value: number;
|
|
16
|
+
/**
|
|
17
|
+
* The label to display on the tooltip, funnel section, or the legend. It can be a string or a function.
|
|
18
|
+
*/
|
|
19
|
+
label?: string | ((location: 'tooltip' | 'legend' | 'section') => string);
|
|
20
|
+
/**
|
|
21
|
+
* The color of the funnel section
|
|
22
|
+
*/
|
|
23
|
+
color?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Defines the mark type for the funnel item.
|
|
26
|
+
* @default 'square'
|
|
27
|
+
*/
|
|
28
|
+
labelMarkType?: ChartsLabelMarkProps['type'];
|
|
29
|
+
};
|
|
30
|
+
export interface FunnelSeriesType extends Omit<CommonSeriesType<FunnelValueType>, 'color'>, CartesianSeriesType {
|
|
31
|
+
type: 'funnel';
|
|
32
|
+
/**
|
|
33
|
+
* Data associated to the funnel section.
|
|
34
|
+
*/
|
|
35
|
+
data: Readonly<FunnelValueType[]>;
|
|
36
|
+
/**
|
|
37
|
+
* The label to display on the tooltip or the legend. It can be a string or a function.
|
|
38
|
+
*/
|
|
39
|
+
label?: string | ((location: 'tooltip' | 'legend') => string);
|
|
40
|
+
/**
|
|
41
|
+
* Layout of the funnel.
|
|
42
|
+
* @default 'vertical'
|
|
43
|
+
*/
|
|
44
|
+
layout?: 'horizontal' | 'vertical';
|
|
45
|
+
/**
|
|
46
|
+
* The type of curve to use for the line. Read more about curves at
|
|
47
|
+
* [line interpolation](https://mui.com/x/react-charts/lines/#interpolation).
|
|
48
|
+
* @default 'linear'
|
|
49
|
+
*/
|
|
50
|
+
curve?: FunnelCurveType;
|
|
51
|
+
/**
|
|
52
|
+
* The label configuration for the funnel plot.
|
|
53
|
+
* Allows to customize the position and margin of the label that is displayed on the funnel sections.
|
|
54
|
+
*
|
|
55
|
+
* If set to `false`, the label will not be displayed.
|
|
56
|
+
* @default { vertical: 'middle', horizontal: 'center' }
|
|
57
|
+
*/
|
|
58
|
+
sectionLabel?: FunnelLabelOptions | ((item: FunnelItem) => FunnelLabelOptions | false) | false;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* An object that allows to identify a funnel item.
|
|
62
|
+
* Used for item interaction
|
|
63
|
+
*/
|
|
64
|
+
export type FunnelItemIdentifier = {
|
|
65
|
+
type: 'funnel';
|
|
66
|
+
/**
|
|
67
|
+
* The series id of the funnel.
|
|
68
|
+
*/
|
|
69
|
+
seriesId: SeriesId;
|
|
70
|
+
/**
|
|
71
|
+
* The index of the data point in the series.
|
|
72
|
+
*/
|
|
73
|
+
dataIndex: number;
|
|
74
|
+
};
|
|
75
|
+
export type FunnelItem = {
|
|
76
|
+
/**
|
|
77
|
+
* The series id of the funnel.
|
|
78
|
+
*/
|
|
79
|
+
seriesId: SeriesId;
|
|
80
|
+
/**
|
|
81
|
+
* The index of the data point in the series.
|
|
82
|
+
*/
|
|
83
|
+
dataIndex: number;
|
|
84
|
+
/**
|
|
85
|
+
* The value of the data point.
|
|
86
|
+
*/
|
|
87
|
+
value: number;
|
|
88
|
+
};
|
|
89
|
+
export interface DefaultizedFunnelSeriesType extends DefaultizedProps<FunnelSeriesType, CommonDefaultizedProps | 'layout'> {
|
|
90
|
+
dataPoints: FunnelDataPoints[][];
|
|
91
|
+
data: Readonly<MakeRequired<FunnelValueType, 'id' | 'color'>[]>;
|
|
92
|
+
}
|
|
93
|
+
export type FunnelDataPoints = Record<'x' | 'y', number> & {
|
|
94
|
+
useBandWidth: boolean;
|
|
95
|
+
stackOffset: number;
|
|
96
|
+
};
|
|
97
|
+
export type FunnelLabelOptions = {
|
|
98
|
+
/**
|
|
99
|
+
* The position of the label.
|
|
100
|
+
* @default { vertical: 'middle', horizontal: 'center' }
|
|
101
|
+
*/
|
|
102
|
+
position?: Position;
|
|
103
|
+
/**
|
|
104
|
+
* The text anchor of the label. Affects the horizontal alignment of the text.
|
|
105
|
+
*
|
|
106
|
+
* Default value depends on the position.
|
|
107
|
+
*/
|
|
108
|
+
textAnchor?: 'start' | 'middle' | 'end';
|
|
109
|
+
/**
|
|
110
|
+
* The dominant baseline of the label. Affects the vertical alignment of the text.
|
|
111
|
+
*
|
|
112
|
+
* Default value depends on the position.
|
|
113
|
+
*/
|
|
114
|
+
dominantBaseline?: 'auto' | 'baseline' | 'hanging' | 'middle' | 'central' | 'text-after-edge' | 'text-before-edge';
|
|
115
|
+
/**
|
|
116
|
+
* The offset of the label from the anchor point.
|
|
117
|
+
* If a single number is provided, the offset will be applied in both directions.
|
|
118
|
+
* @default 0
|
|
119
|
+
*/
|
|
120
|
+
offset?: number | {
|
|
121
|
+
x?: number;
|
|
122
|
+
y?: number;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FunnelSectionProps } from './FunnelSection';
|
|
3
|
+
export interface FunnelPlotSlots {
|
|
4
|
+
funnelSection?: React.ElementType<FunnelSectionProps>;
|
|
5
|
+
}
|
|
6
|
+
export interface FunnelPlotSlotProps {
|
|
7
|
+
funnelSection?: FunnelSectionProps;
|
|
8
|
+
}
|
|
9
|
+
export interface FunnelPlotSlotExtension {
|
|
10
|
+
/**
|
|
11
|
+
* Overridable component slots.
|
|
12
|
+
* @default {}
|
|
13
|
+
*/
|
|
14
|
+
slots?: FunnelPlotSlots;
|
|
15
|
+
/**
|
|
16
|
+
* The props used for each component slot.
|
|
17
|
+
* @default {}
|
|
18
|
+
*/
|
|
19
|
+
slotProps?: FunnelPlotSlotProps;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FunnelSectionProps } from './FunnelSection';
|
|
2
|
+
export interface FunnelSectionClasses {
|
|
3
|
+
/** Styles applied to the root element. */
|
|
4
|
+
root: string;
|
|
5
|
+
/** Styles applied to the root element if `highlighted={true}`. */
|
|
6
|
+
highlighted: string;
|
|
7
|
+
/** Styles applied to the root element if `faded={true}`. */
|
|
8
|
+
faded: string;
|
|
9
|
+
/** Styles applied to the label element. */
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const useUtilityClasses: (props: FunnelSectionProps) => Record<"label" | "highlighted" | "faded" | "root", string>;
|
|
13
|
+
export declare const funnelSectionClasses: FunnelSectionClasses;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
4
|
+
function getFunnelSectionUtilityClass(slot) {
|
|
5
|
+
return generateUtilityClass('MuiFunnelSection', slot);
|
|
6
|
+
}
|
|
7
|
+
export const useUtilityClasses = props => {
|
|
8
|
+
const {
|
|
9
|
+
classes,
|
|
10
|
+
seriesId
|
|
11
|
+
} = props;
|
|
12
|
+
const slots = {
|
|
13
|
+
root: ['root', `series-${seriesId}`],
|
|
14
|
+
highlighted: ['highlighted'],
|
|
15
|
+
faded: ['faded'],
|
|
16
|
+
label: ['label']
|
|
17
|
+
};
|
|
18
|
+
return composeClasses(slots, getFunnelSectionUtilityClass, classes);
|
|
19
|
+
};
|
|
20
|
+
export const funnelSectionClasses = generateUtilityClasses('MuiFunnelSection', ['root', 'highlighted', 'faded', 'label']);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChartsOverlaySlotProps, ChartsOverlaySlots } from '@mui/x-charts/ChartsOverlay';
|
|
2
|
+
import { ChartsTooltipSlotProps, ChartsTooltipSlots } from '@mui/x-charts/ChartsTooltip';
|
|
3
|
+
import { ChartsAxisSlotProps, ChartsAxisSlots } from '@mui/x-charts/internals';
|
|
4
|
+
import { ChartsLegendSlotProps, ChartsLegendSlots } from '@mui/x-charts/ChartsLegend';
|
|
5
|
+
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 {}
|
|
8
|
+
export interface FunnelChartSlotExtension {
|
|
9
|
+
/**
|
|
10
|
+
* Overridable component slots.
|
|
11
|
+
* @default {}
|
|
12
|
+
*/
|
|
13
|
+
slots?: FunnelChartSlots;
|
|
14
|
+
/**
|
|
15
|
+
* The props used for each component slot.
|
|
16
|
+
* @default {}
|
|
17
|
+
*/
|
|
18
|
+
slotProps?: FunnelChartSlotProps;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a custom "step" curve generator for the funnel chart.
|
|
3
|
+
* It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
|
|
4
|
+
*
|
|
5
|
+
* It is based on the d3-shape step curve generator.
|
|
6
|
+
* https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
|
|
7
|
+
*/
|
|
8
|
+
class FunnelStep {
|
|
9
|
+
constructor(context, isHorizontal) {
|
|
10
|
+
this.context = void 0;
|
|
11
|
+
this.line = NaN;
|
|
12
|
+
this.x = NaN;
|
|
13
|
+
this.y = NaN;
|
|
14
|
+
this.currentPoint = 0;
|
|
15
|
+
this.isHorizontal = false;
|
|
16
|
+
this.context = context;
|
|
17
|
+
this.isHorizontal = isHorizontal;
|
|
18
|
+
}
|
|
19
|
+
areaStart() {
|
|
20
|
+
this.line = 0;
|
|
21
|
+
}
|
|
22
|
+
areaEnd() {
|
|
23
|
+
this.line = NaN;
|
|
24
|
+
}
|
|
25
|
+
lineStart() {
|
|
26
|
+
this.x = NaN;
|
|
27
|
+
this.y = NaN;
|
|
28
|
+
this.currentPoint = 0;
|
|
29
|
+
}
|
|
30
|
+
lineEnd() {
|
|
31
|
+
if (this.currentPoint === 2) {
|
|
32
|
+
this.context.lineTo(this.x, this.y);
|
|
33
|
+
}
|
|
34
|
+
if (this.line || this.line !== 0 && this.currentPoint === 1) {
|
|
35
|
+
this.context.closePath();
|
|
36
|
+
}
|
|
37
|
+
if (this.line >= 0) {
|
|
38
|
+
this.line = 1 - this.line;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
point(x, y) {
|
|
42
|
+
x = +x;
|
|
43
|
+
y = +y;
|
|
44
|
+
if (this.currentPoint === 0) {
|
|
45
|
+
this.context.moveTo(x, y);
|
|
46
|
+
} else if (this.isHorizontal && (this.currentPoint === 2 || this.currentPoint === 1)) {
|
|
47
|
+
this.context.lineTo(x, this.y);
|
|
48
|
+
this.context.lineTo(x, y);
|
|
49
|
+
} else if (this.currentPoint === 3 && !this.isHorizontal) {
|
|
50
|
+
this.context.lineTo(x, this.y);
|
|
51
|
+
this.context.lineTo(x, y);
|
|
52
|
+
} else {
|
|
53
|
+
this.context.lineTo(this.x, y);
|
|
54
|
+
this.context.lineTo(x, y);
|
|
55
|
+
}
|
|
56
|
+
this.currentPoint += 1;
|
|
57
|
+
this.x = x;
|
|
58
|
+
this.y = y;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const funnelHorizontalStepCurve = context => {
|
|
62
|
+
return new FunnelStep(context, true);
|
|
63
|
+
};
|
|
64
|
+
const funnelVerticalStepCurve = context => {
|
|
65
|
+
return new FunnelStep(context, false);
|
|
66
|
+
};
|
|
67
|
+
export { funnelHorizontalStepCurve, funnelVerticalStepCurve };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { FunnelChart as Unstable_FunnelChart } from "./FunnelChart.js";
|
|
2
|
+
export type { FunnelChartProps } from './FunnelChart';
|
|
3
|
+
export * from "./FunnelPlot.js";
|
|
4
|
+
export * from "./funnel.types.js";
|
|
5
|
+
export * from "./funnelSlots.types.js";
|
|
6
|
+
export { funnelSectionClasses } from "./funnelSectionClasses.js";
|
|
7
|
+
export type { FunnelSectionClasses } from './funnelSectionClasses';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FunnelDataPoints, FunnelLabelOptions } from "./funnel.types.js";
|
|
2
|
+
/**
|
|
3
|
+
* It tries to keep the label inside the bounds of the section based on the position.
|
|
4
|
+
*
|
|
5
|
+
* @returns The text anchor and dominant baseline of the label.
|
|
6
|
+
*/
|
|
7
|
+
export declare const alignLabel: ({
|
|
8
|
+
position,
|
|
9
|
+
textAnchor,
|
|
10
|
+
dominantBaseline
|
|
11
|
+
}: Omit<FunnelLabelOptions, "margin">) => {
|
|
12
|
+
textAnchor: string;
|
|
13
|
+
dominantBaseline: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* This function calculates the position of the label based on the position and margin.
|
|
17
|
+
*
|
|
18
|
+
* It is quite complex, because it needs to calculate the position based on the position of the points of a rectangle.
|
|
19
|
+
* And we are manually calculating each possible position of the label.
|
|
20
|
+
*
|
|
21
|
+
* @returns The x and y position of the label.
|
|
22
|
+
*/
|
|
23
|
+
export declare const positionLabel: ({
|
|
24
|
+
position,
|
|
25
|
+
offset,
|
|
26
|
+
xPosition,
|
|
27
|
+
yPosition,
|
|
28
|
+
isHorizontal,
|
|
29
|
+
values,
|
|
30
|
+
dataIndex,
|
|
31
|
+
baseScaleData
|
|
32
|
+
}: Omit<FunnelLabelOptions, "textAnchor" | "dominantBaseline"> & {
|
|
33
|
+
xPosition: (value: number, bandIndex: number, stackOffset?: number, useBand?: boolean) => number | undefined;
|
|
34
|
+
yPosition: (value: number, bandIndex: number, stackOffset?: number, useBand?: boolean) => number | undefined;
|
|
35
|
+
isHorizontal: boolean;
|
|
36
|
+
values: readonly FunnelDataPoints[];
|
|
37
|
+
dataIndex: number;
|
|
38
|
+
baseScaleData: readonly number[];
|
|
39
|
+
}) => {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
};
|