@mui/x-charts-pro 8.0.0-alpha.13 → 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/CHANGELOG.md +131 -0
- package/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- 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/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/esm/BarChartPro/BarChartPro.d.ts +2 -1
- package/esm/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- 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/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/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/utils/releaseInfo.js +1 -1
- 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/utils/releaseInfo.js +1 -1
- package/modern/BarChartPro/BarChartPro.d.ts +2 -1
- package/modern/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- 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/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/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/utils/releaseInfo.js +1 -1
- package/modern/typeOverloads/modules.d.ts +13 -2
- package/package.json +4 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/typeOverloads/modules.d.ts +13 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BarChartProps } from '@mui/x-charts/BarChart';
|
|
3
3
|
import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
4
|
-
|
|
4
|
+
import { BarChartProPluginsSignatures } from "./BarChartPro.plugins.js";
|
|
5
|
+
export interface BarChartProProps extends Omit<BarChartProps, 'apiRef'>, Omit<ChartContainerProProps<'bar', BarChartProPluginsSignatures>, 'series' | 'plugins' | 'seriesConfig'> {}
|
|
5
6
|
/**
|
|
6
7
|
* Demos:
|
|
7
8
|
*
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,137 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.0.0-alpha.14
|
|
9
|
+
|
|
10
|
+
_Mar 7, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 🚀📊 New Pro Chart: It is now possible to create Funnel charts—perfect for visualizing conversions, sales pipelines and more!
|
|
15
|
+
<img width="418" alt="Screenshot 2025-01-31 at 12 22 31" src="https://github.com/user-attachments/assets/8cd26821-5f11-46bf-a9bb-34d212880a47" />
|
|
16
|
+
- 🎁 The first iteration of the radar chart is available. Features and refinements will be added in the coming weeks.
|
|
17
|
+
- 🛠️ New and improved [Toolbar component](https://next.mui.com/x/react-data-grid/components/toolbar/) for the data grid
|
|
18
|
+
- 🐞 Bugfixes
|
|
19
|
+
|
|
20
|
+
Special thanks go out to the community member for their valuable contributions:
|
|
21
|
+
@vadimka123.
|
|
22
|
+
|
|
23
|
+
Following are all team members who have contributed to this release:
|
|
24
|
+
@alexfauquette, @arminmeh, @bernardobelchior, @cherniavskii, @flaviendelangle, @JCQuintas, @KenanYusuf, @LukasTy, @michelengelen, @noraleonte, @oliviertassinari.
|
|
25
|
+
|
|
26
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
27
|
+
|
|
28
|
+
### Data Grid
|
|
29
|
+
|
|
30
|
+
#### Breaking changes
|
|
31
|
+
|
|
32
|
+
- The density selector has been removed from the toolbar. It is still possible to set the density programmatically via the `density` prop. A density selector can be added to a custom toolbar passed to `slots.toolbar`. See [Toolbar component—Settings menu](https://next.mui.com/x/react-data-grid/components/toolbar/#settings-menu) for an example.
|
|
33
|
+
- The quick filter is now shown in the toolbar by default. Use `slotProps={{ toolbar: { showQuickFilter: false } }}` to hide it.
|
|
34
|
+
- The `<GridSaveAltIcon />` icon is not exported anymore. Import `SaveAlt` from `@mui/icons-material` instead.
|
|
35
|
+
|
|
36
|
+
#### `@mui/x-data-grid@8.0.0-alpha.14`
|
|
37
|
+
|
|
38
|
+
- [DataGrid] Fix `aria-hidden` console error when scrollbar is dragged (#16829) @arminmeh
|
|
39
|
+
- [DataGrid] Fix scroll jump with dynamic row height (#16763) @cherniavskii
|
|
40
|
+
- [DataGrid] New `<Toolbar />` component (#14611) @KenanYusuf
|
|
41
|
+
- [DataGrid] Use new toolbar by default (#16814) @KenanYusuf
|
|
42
|
+
- [DataGrid] Remove the quick filtering on a given column (#16738) @vadimka123
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-data-grid-pro@8.0.0-alpha.14` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
45
|
+
|
|
46
|
+
Same changes as in `@mui/x-data-grid@8.0.0-alpha.14`.
|
|
47
|
+
|
|
48
|
+
#### `@mui/x-data-grid-premium@8.0.0-alpha.14` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
49
|
+
|
|
50
|
+
Same changes as in `@mui/x-data-grid-pro@8.0.0-alpha.14`.
|
|
51
|
+
|
|
52
|
+
### Date and Time Pickers
|
|
53
|
+
|
|
54
|
+
#### Breaking changes
|
|
55
|
+
|
|
56
|
+
- All Date Time Picker variants now use Digital Clock for time editing.
|
|
57
|
+
- Stop passing invalid date to `onChange` when the date is partially filled — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#treat-partially-filled-date-as-null-in-onchange).
|
|
58
|
+
|
|
59
|
+
#### `@mui/x-date-pickers@8.0.0-alpha.14`
|
|
60
|
+
|
|
61
|
+
- [DateTimePicker] Use Digital Clock in all component variants (#16678) @LukasTy
|
|
62
|
+
- [fields] Always use `props.value` as the source of truth when defined (#15875) @flaviendelangle
|
|
63
|
+
- [fields] Fix Fields aria relationship with `helperText` (#16821) @LukasTy
|
|
64
|
+
- [pickers] Add `TValidationProps` generic to the `PickerManager` interface (#16832) @flaviendelangle
|
|
65
|
+
- [pickers] Fix `edge` property setting in different button position cases (#16838) @LukasTy
|
|
66
|
+
- [pickers] Fix typo in JSDoc (#16831) @flaviendelangle
|
|
67
|
+
- [pickers] Refactor the files in the `usePicker` folder (#16680) @flaviendelangle
|
|
68
|
+
|
|
69
|
+
#### `@mui/x-date-pickers-pro@8.0.0-alpha.14` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
70
|
+
|
|
71
|
+
Same changes as in `@mui/x-date-pickers@8.0.0-alpha.14`.
|
|
72
|
+
|
|
73
|
+
### Charts
|
|
74
|
+
|
|
75
|
+
#### `@mui/x-charts@8.0.0-alpha.14`
|
|
76
|
+
|
|
77
|
+
- [charts] Fix `undefined` behaving differently from missing value for axis size (#16844) @bernardobelchior
|
|
78
|
+
- [charts] Fix x-axis text anchor default when language is RTL (#16836) @bernardobelchior
|
|
79
|
+
- [charts] Add Radar chart (#16406) @alexfauquette
|
|
80
|
+
- [charts] Move series default color generation in the series config (#16752) @alexfauquette
|
|
81
|
+
- [charts] Render axis title within axis size (#16730) @bernardobelchior
|
|
82
|
+
- [charts] Split `defaultizeAxis` function into two (#16745) @bernardobelchior
|
|
83
|
+
- [charts] Warn if axes data don't have enough elements (#16830) @alexfauquette
|
|
84
|
+
- [charts] XAxis: Add defaults for `textAnchor` and `dominantBaseline` based on `angle` (#16817) @bernardobelchior
|
|
85
|
+
|
|
86
|
+
#### `@mui/x-charts-pro@8.0.0-alpha.14` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
87
|
+
|
|
88
|
+
Same changes as in `@mui/x-charts@8.0.0-alpha.14`, plus:
|
|
89
|
+
|
|
90
|
+
- [charts] Add Funnel chart (#14804) @JCQuintas
|
|
91
|
+
|
|
92
|
+
### Tree View
|
|
93
|
+
|
|
94
|
+
#### Breaking changes
|
|
95
|
+
|
|
96
|
+
- The `selectItem` method has been renamed `setItemSelection`:
|
|
97
|
+
|
|
98
|
+
```diff
|
|
99
|
+
const { publicAPI } = useTreeItemUtils();
|
|
100
|
+
|
|
101
|
+
const handleSelectItem() {
|
|
102
|
+
- publicAPI.selectItem({ event, itemId: props.itemId, shouldBeSelected: true })
|
|
103
|
+
+ publicAPI.setItemSelection({ event, itemId: props.itemId, shouldBeSelected: true })
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- The `setItemExpansion` method now receives a single object instead of a list of parameters:
|
|
108
|
+
|
|
109
|
+
```diff
|
|
110
|
+
const { publicAPI } = useTreeItemUtils();
|
|
111
|
+
|
|
112
|
+
const handleExpandItem() {
|
|
113
|
+
- publicAPI.setItemExpansion(event, props.itemId, true)
|
|
114
|
+
+ publicAPI.setItemExpansion({ event, itemId: props.itemId, shouldBeExpanded: true })
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### `@mui/x-tree-view@8.0.0-alpha.14`
|
|
119
|
+
|
|
120
|
+
- [TreeView] Clean the expansion and selection API methods (#16795) @flaviendelangle
|
|
121
|
+
|
|
122
|
+
#### `@mui/x-tree-view-pro@8.0.0-alpha.14` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
123
|
+
|
|
124
|
+
Same changes as in `@mui/x-tree-view@8.0.0-alpha.14`.
|
|
125
|
+
|
|
126
|
+
### Docs
|
|
127
|
+
|
|
128
|
+
- [docs] Fix padding package install on mobile (#16794) @oliviertassinari
|
|
129
|
+
- [docs] Typo fixes (#16835) @alexfauquette
|
|
130
|
+
|
|
131
|
+
### Core
|
|
132
|
+
|
|
133
|
+
- [code-infra] Fix console warning in telemetry package (#16816) @JCQuintas
|
|
134
|
+
- [code-infra] Split date-picker test files (#16825) @JCQuintas
|
|
135
|
+
- [infra] Replace PR label check workflow with reusable version (#16762) @michelengelen
|
|
136
|
+
- [infra] Update label in priority-support issue template (#16767) @michelengelen
|
|
137
|
+
- [test] Add timeout to flaky screenshot tests (#16852) @LukasTy
|
|
138
|
+
|
|
8
139
|
## 8.0.0-alpha.13
|
|
9
140
|
|
|
10
141
|
_Feb 28, 2025_
|
|
@@ -6,4 +6,4 @@ import { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
|
6
6
|
export type UseChartContainerProPropsReturnValue<TSeries extends ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[]> = Pick<UseChartContainerPropsReturnValue<TSeries, TSignatures>, 'chartsSurfaceProps' | 'children'> & {
|
|
7
7
|
chartDataProviderProProps: ChartDataProviderProps<TSeries, TSignatures>;
|
|
8
8
|
};
|
|
9
|
-
export declare const useChartContainerProProps: <TSeries extends ChartSeriesType =
|
|
9
|
+
export declare const useChartContainerProProps: <TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(props: ChartContainerProProps<TSeries, TSignatures>, ref: React.Ref<SVGSVGElement>) => UseChartContainerProPropsReturnValue<TSeries, TSignatures>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChartAnyPluginSignature, ChartSeriesType } from '@mui/x-charts/internals';
|
|
2
2
|
import type { ChartDataProviderProProps } from './ChartDataProviderPro';
|
|
3
3
|
import type { AllPluginSignatures } from '../internals/plugins/allPlugins';
|
|
4
|
-
export declare const useChartDataProviderProProps: <TSeries extends ChartSeriesType =
|
|
4
|
+
export declare const useChartDataProviderProProps: <TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(props: ChartDataProviderProProps<TSeries, TSignatures>) => {
|
|
5
5
|
children: import("react").ReactNode;
|
|
6
6
|
animationProviderProps: Omit<import("@mui/x-charts/internals").AnimationProviderProps, "children">;
|
|
7
7
|
chartProviderProps: Omit<import("@mui/x-charts/internals").ChartProviderProps<TSeries, TSignatures>, "children">;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsOverlayProps } from '@mui/x-charts/ChartsOverlay';
|
|
3
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
4
|
+
import { ChartsAxisHighlightProps } from '@mui/x-charts/ChartsAxisHighlight';
|
|
5
|
+
import { FunnelPlotProps } from "./FunnelPlot.js";
|
|
6
|
+
import { FunnelSeriesType } from "./funnel.types.js";
|
|
7
|
+
import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
8
|
+
import { FunnelChartSlotExtension } from "./funnelSlots.types.js";
|
|
9
|
+
import { CategoryAxis } from "./categoryAxis.types.js";
|
|
10
|
+
export interface FunnelChartProps extends Omit<ChartContainerProProps<'funnel'>, 'series' | 'plugins' | 'zAxis' | 'zoom' | 'onZoomChange' | 'dataset' | 'yAxis' | 'xAxis' | 'rotationAxis' | 'radiusAxis'>, Omit<FunnelPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, FunnelChartSlotExtension {
|
|
11
|
+
/**
|
|
12
|
+
* The series to display in the funnel chart.
|
|
13
|
+
* An array of [[FunnelSeriesType]] objects.
|
|
14
|
+
*/
|
|
15
|
+
series: Readonly<MakeOptional<FunnelSeriesType, 'type'>[]>;
|
|
16
|
+
/**
|
|
17
|
+
* The configuration of the category axis.
|
|
18
|
+
*
|
|
19
|
+
* @default { position: 'none' }
|
|
20
|
+
*/
|
|
21
|
+
categoryAxis?: CategoryAxis;
|
|
22
|
+
/**
|
|
23
|
+
* If `true`, the legend is not rendered.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
hideLegend?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The configuration of axes highlight.
|
|
29
|
+
* Default is set to 'band' in the bar direction.
|
|
30
|
+
* Depends on `layout` prop.
|
|
31
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
axisHighlight?: ChartsAxisHighlightProps;
|
|
35
|
+
}
|
|
36
|
+
declare const FunnelChart: React.ForwardRefExoticComponent<FunnelChartProps & React.RefAttributes<SVGSVGElement>>;
|
|
37
|
+
export { FunnelChart };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.FunnelChart = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _ChartsOverlay = require("@mui/x-charts/ChartsOverlay");
|
|
15
|
+
var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
|
|
16
|
+
var _internals = require("@mui/x-charts/internals");
|
|
17
|
+
var _ChartsLegend = require("@mui/x-charts/ChartsLegend");
|
|
18
|
+
var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
|
|
19
|
+
var _ChartsSurface = require("@mui/x-charts/ChartsSurface");
|
|
20
|
+
var _ChartsAxisHighlight = require("@mui/x-charts/ChartsAxisHighlight");
|
|
21
|
+
var _ChartsAxis = require("@mui/x-charts/ChartsAxis");
|
|
22
|
+
var _FunnelPlot = require("./FunnelPlot");
|
|
23
|
+
var _useFunnelChartProps = require("./useFunnelChartProps");
|
|
24
|
+
var _seriesConfig = require("./seriesConfig");
|
|
25
|
+
var _useChartContainerProProps = require("../ChartContainerPro/useChartContainerProProps");
|
|
26
|
+
var _ChartDataProviderPro = require("../ChartDataProviderPro");
|
|
27
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
+
const seriesConfig = {
|
|
29
|
+
funnel: _seriesConfig.seriesConfig
|
|
30
|
+
};
|
|
31
|
+
const FunnelChart = exports.FunnelChart = /*#__PURE__*/React.forwardRef(function FunnelChart(props, ref) {
|
|
32
|
+
const themedProps = (0, _styles.useThemeProps)({
|
|
33
|
+
props,
|
|
34
|
+
name: 'MuiFunnelChart'
|
|
35
|
+
});
|
|
36
|
+
const {
|
|
37
|
+
chartContainerProps,
|
|
38
|
+
funnelPlotProps,
|
|
39
|
+
overlayProps,
|
|
40
|
+
legendProps,
|
|
41
|
+
clipPathGroupProps,
|
|
42
|
+
chartsAxisProps,
|
|
43
|
+
clipPathProps,
|
|
44
|
+
chartsWrapperProps,
|
|
45
|
+
axisHighlightProps,
|
|
46
|
+
children
|
|
47
|
+
} = (0, _useFunnelChartProps.useFunnelChartProps)(themedProps);
|
|
48
|
+
const {
|
|
49
|
+
chartDataProviderProProps,
|
|
50
|
+
chartsSurfaceProps
|
|
51
|
+
} = (0, _useChartContainerProProps.useChartContainerProProps)(chartContainerProps, ref);
|
|
52
|
+
const Tooltip = themedProps.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, (0, _extends2.default)({}, chartDataProviderProProps, {
|
|
54
|
+
seriesConfig: seriesConfig,
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_internals.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
56
|
+
children: [!themedProps.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
57
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
58
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FunnelPlot.FunnelPlot, (0, _extends2.default)({}, funnelPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
|
|
59
|
+
})), !themedProps.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, themedProps.slotProps?.tooltip, {
|
|
60
|
+
trigger: "item"
|
|
61
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
62
|
+
}))]
|
|
63
|
+
}))
|
|
64
|
+
}));
|
|
65
|
+
});
|
|
66
|
+
process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
67
|
+
// ----------------------------- Warning --------------------------------
|
|
68
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
69
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
70
|
+
// ----------------------------------------------------------------------
|
|
71
|
+
apiRef: _propTypes.default.shape({
|
|
72
|
+
current: _propTypes.default.shape({
|
|
73
|
+
setZoomData: _propTypes.default.func.isRequired
|
|
74
|
+
})
|
|
75
|
+
}),
|
|
76
|
+
/**
|
|
77
|
+
* The configuration of axes highlight.
|
|
78
|
+
* Default is set to 'band' in the bar direction.
|
|
79
|
+
* Depends on `layout` prop.
|
|
80
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
81
|
+
*/
|
|
82
|
+
axisHighlight: _propTypes.default.shape({
|
|
83
|
+
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
84
|
+
y: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
85
|
+
}),
|
|
86
|
+
/**
|
|
87
|
+
* The configuration of the category axis.
|
|
88
|
+
*
|
|
89
|
+
* @default { position: 'none' }
|
|
90
|
+
*/
|
|
91
|
+
categoryAxis: _propTypes.default.shape({
|
|
92
|
+
categories: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
93
|
+
disableLine: _propTypes.default.bool,
|
|
94
|
+
disableTicks: _propTypes.default.bool,
|
|
95
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
96
|
+
position: _propTypes.default.oneOf(['bottom', 'left', 'none', 'right', 'top']),
|
|
97
|
+
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
98
|
+
size: _propTypes.default.number,
|
|
99
|
+
tickLabelStyle: _propTypes.default.object,
|
|
100
|
+
tickSize: _propTypes.default.number
|
|
101
|
+
}),
|
|
102
|
+
children: _propTypes.default.node,
|
|
103
|
+
className: _propTypes.default.string,
|
|
104
|
+
/**
|
|
105
|
+
* Color palette used to colorize multiple series.
|
|
106
|
+
* @default rainbowSurgePalette
|
|
107
|
+
*/
|
|
108
|
+
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
109
|
+
desc: _propTypes.default.string,
|
|
110
|
+
/**
|
|
111
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
112
|
+
* It might break interactive features, but will improve performance.
|
|
113
|
+
* @default false
|
|
114
|
+
*/
|
|
115
|
+
disableAxisListener: _propTypes.default.bool,
|
|
116
|
+
/**
|
|
117
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
118
|
+
*/
|
|
119
|
+
height: _propTypes.default.number,
|
|
120
|
+
/**
|
|
121
|
+
* If `true`, the legend is not rendered.
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
hideLegend: _propTypes.default.bool,
|
|
125
|
+
/**
|
|
126
|
+
* The highlighted item.
|
|
127
|
+
* Used when the highlight is controlled.
|
|
128
|
+
*/
|
|
129
|
+
highlightedItem: _propTypes.default.shape({
|
|
130
|
+
dataIndex: _propTypes.default.number,
|
|
131
|
+
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired
|
|
132
|
+
}),
|
|
133
|
+
/**
|
|
134
|
+
* This prop is used to help implement the accessibility logic.
|
|
135
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
136
|
+
*/
|
|
137
|
+
id: _propTypes.default.string,
|
|
138
|
+
/**
|
|
139
|
+
* The list of zoom data related to each axis.
|
|
140
|
+
* Used to initialize the zoom in a specific configuration without controlling it.
|
|
141
|
+
*/
|
|
142
|
+
initialZoom: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
143
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
144
|
+
end: _propTypes.default.number.isRequired,
|
|
145
|
+
start: _propTypes.default.number.isRequired
|
|
146
|
+
})),
|
|
147
|
+
/**
|
|
148
|
+
* If `true`, a loading overlay is displayed.
|
|
149
|
+
* @default false
|
|
150
|
+
*/
|
|
151
|
+
loading: _propTypes.default.bool,
|
|
152
|
+
/**
|
|
153
|
+
* The margin between the SVG and the drawing area.
|
|
154
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
155
|
+
*
|
|
156
|
+
* Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
157
|
+
*/
|
|
158
|
+
margin: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
159
|
+
bottom: _propTypes.default.number,
|
|
160
|
+
left: _propTypes.default.number,
|
|
161
|
+
right: _propTypes.default.number,
|
|
162
|
+
top: _propTypes.default.number
|
|
163
|
+
})]),
|
|
164
|
+
/**
|
|
165
|
+
* The function called for onClick events.
|
|
166
|
+
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
167
|
+
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
|
|
168
|
+
* @param {null | AxisData} data The data about the clicked axis and items associated with it.
|
|
169
|
+
*/
|
|
170
|
+
onAxisClick: _propTypes.default.func,
|
|
171
|
+
/**
|
|
172
|
+
* The callback fired when the highlighted item changes.
|
|
173
|
+
*
|
|
174
|
+
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
175
|
+
*/
|
|
176
|
+
onHighlightChange: _propTypes.default.func,
|
|
177
|
+
/**
|
|
178
|
+
* Callback fired when a funnel item is clicked.
|
|
179
|
+
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
180
|
+
* @param {FunnelItemIdentifier} funnelItemIdentifier The funnel item identifier.
|
|
181
|
+
*/
|
|
182
|
+
onItemClick: _propTypes.default.func,
|
|
183
|
+
/**
|
|
184
|
+
* The series to display in the funnel chart.
|
|
185
|
+
* An array of [[FunnelSeriesType]] objects.
|
|
186
|
+
*/
|
|
187
|
+
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
188
|
+
/**
|
|
189
|
+
* If `true`, animations are skipped.
|
|
190
|
+
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
191
|
+
*/
|
|
192
|
+
skipAnimation: _propTypes.default.bool,
|
|
193
|
+
/**
|
|
194
|
+
* The props used for each component slot.
|
|
195
|
+
* @default {}
|
|
196
|
+
*/
|
|
197
|
+
slotProps: _propTypes.default.object,
|
|
198
|
+
/**
|
|
199
|
+
* Overridable component slots.
|
|
200
|
+
* @default {}
|
|
201
|
+
*/
|
|
202
|
+
slots: _propTypes.default.object,
|
|
203
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
204
|
+
theme: _propTypes.default.oneOf(['dark', 'light']),
|
|
205
|
+
title: _propTypes.default.string,
|
|
206
|
+
/**
|
|
207
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
208
|
+
*/
|
|
209
|
+
width: _propTypes.default.number,
|
|
210
|
+
/**
|
|
211
|
+
* The list of zoom data related to each axis.
|
|
212
|
+
*/
|
|
213
|
+
zoomData: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
214
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
215
|
+
end: _propTypes.default.number.isRequired,
|
|
216
|
+
start: _propTypes.default.number.isRequired
|
|
217
|
+
}))
|
|
218
|
+
} : void 0;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FunnelItemIdentifier } from "./funnel.types.js";
|
|
3
|
+
import { FunnelPlotSlotExtension } from "./funnelPlotSlots.types.js";
|
|
4
|
+
export interface FunnelPlotProps extends FunnelPlotSlotExtension {
|
|
5
|
+
/**
|
|
6
|
+
* Callback fired when a funnel item is clicked.
|
|
7
|
+
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
8
|
+
* @param {FunnelItemIdentifier} funnelItemIdentifier The funnel item identifier.
|
|
9
|
+
*/
|
|
10
|
+
onItemClick?: (event: React.MouseEvent<SVGElement, MouseEvent>, funnelItemIdentifier: FunnelItemIdentifier) => void;
|
|
11
|
+
}
|
|
12
|
+
declare function FunnelPlot(props: FunnelPlotProps): React.JSX.Element;
|
|
13
|
+
declare namespace FunnelPlot {
|
|
14
|
+
var propTypes: any;
|
|
15
|
+
}
|
|
16
|
+
export { FunnelPlot };
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.FunnelPlot = FunnelPlot;
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
|
|
15
|
+
var _internals = require("@mui/x-charts/internals");
|
|
16
|
+
var _hooks = require("@mui/x-charts/hooks");
|
|
17
|
+
var _styles = require("@mui/material/styles");
|
|
18
|
+
var _FunnelSection = require("./FunnelSection");
|
|
19
|
+
var _labelUtils = require("./labelUtils");
|
|
20
|
+
var _funnelStepCurve = require("./funnelStepCurve");
|
|
21
|
+
var _useFunnelSeries = require("../hooks/useFunnelSeries");
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
const _excluded = ["onItemClick"];
|
|
24
|
+
_internals.cartesianSeriesTypes.addType('funnel');
|
|
25
|
+
const getFunnelCurve = (curve, isHorizontal) => {
|
|
26
|
+
if (curve === 'step') {
|
|
27
|
+
return isHorizontal ? _funnelStepCurve.funnelHorizontalStepCurve : _funnelStepCurve.funnelVerticalStepCurve;
|
|
28
|
+
}
|
|
29
|
+
if (curve === 'bump') {
|
|
30
|
+
return isHorizontal ? (0, _internals.getCurveFactory)('bumpX') : (0, _internals.getCurveFactory)('bumpY');
|
|
31
|
+
}
|
|
32
|
+
return (0, _internals.getCurveFactory)(curve ?? 'linear');
|
|
33
|
+
};
|
|
34
|
+
const useAggregatedData = () => {
|
|
35
|
+
const seriesData = (0, _useFunnelSeries.useFunnelSeriesContext)();
|
|
36
|
+
const {
|
|
37
|
+
xAxis,
|
|
38
|
+
xAxisIds
|
|
39
|
+
} = (0, _hooks.useXAxes)();
|
|
40
|
+
const {
|
|
41
|
+
yAxis,
|
|
42
|
+
yAxisIds
|
|
43
|
+
} = (0, _hooks.useYAxes)();
|
|
44
|
+
const allData = React.useMemo(() => {
|
|
45
|
+
if (seriesData === undefined) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
const {
|
|
49
|
+
series,
|
|
50
|
+
seriesOrder
|
|
51
|
+
} = seriesData;
|
|
52
|
+
const defaultXAxisId = xAxisIds[0];
|
|
53
|
+
const defaultYAxisId = yAxisIds[0];
|
|
54
|
+
const isHorizontal = Object.values(series).some(s => s.layout === 'horizontal');
|
|
55
|
+
const result = seriesOrder.map(seriesId => {
|
|
56
|
+
const currentSeries = series[seriesId];
|
|
57
|
+
const xAxisId = currentSeries.xAxisId ?? defaultXAxisId;
|
|
58
|
+
const yAxisId = currentSeries.yAxisId ?? defaultYAxisId;
|
|
59
|
+
const valueFormatter = currentSeries.valueFormatter;
|
|
60
|
+
const baseScaleConfig = isHorizontal ? xAxis[xAxisId] : yAxis[yAxisId];
|
|
61
|
+
const isXAxisBand = xAxis[xAxisId].scaleType === 'band';
|
|
62
|
+
const isYAxisBand = yAxis[yAxisId].scaleType === 'band';
|
|
63
|
+
const bandWidth = (isXAxisBand || isYAxisBand) && baseScaleConfig.scale?.bandwidth() || 0;
|
|
64
|
+
const xScale = xAxis[xAxisId].scale;
|
|
65
|
+
const yScale = yAxis[yAxisId].scale;
|
|
66
|
+
const curve = getFunnelCurve(currentSeries.curve, isHorizontal);
|
|
67
|
+
const xPosition = (value, bandIndex, stackOffset, useBand) => {
|
|
68
|
+
if (isXAxisBand) {
|
|
69
|
+
const position = xScale(bandIndex);
|
|
70
|
+
return useBand ? position + bandWidth : position;
|
|
71
|
+
}
|
|
72
|
+
return xScale(isHorizontal ? value + (stackOffset || 0) : value);
|
|
73
|
+
};
|
|
74
|
+
const yPosition = (value, bandIndex, stackOffset, useBand) => {
|
|
75
|
+
if (isYAxisBand) {
|
|
76
|
+
const position = yScale(bandIndex);
|
|
77
|
+
return useBand ? position + bandWidth : position;
|
|
78
|
+
}
|
|
79
|
+
return yScale(isHorizontal ? value : value + (stackOffset || 0));
|
|
80
|
+
};
|
|
81
|
+
return currentSeries.dataPoints.map((values, dataIndex) => {
|
|
82
|
+
const color = currentSeries.data[dataIndex].color;
|
|
83
|
+
const id = `${seriesId}-${dataIndex}`;
|
|
84
|
+
const sectionLabel = typeof currentSeries.sectionLabel === 'function' ? currentSeries.sectionLabel({
|
|
85
|
+
dataIndex,
|
|
86
|
+
seriesId,
|
|
87
|
+
value: currentSeries.data[dataIndex].value
|
|
88
|
+
}) : currentSeries.sectionLabel;
|
|
89
|
+
const line = (0, _d3Shape.line)().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);
|
|
90
|
+
return {
|
|
91
|
+
d: line(values),
|
|
92
|
+
color,
|
|
93
|
+
id,
|
|
94
|
+
seriesId,
|
|
95
|
+
dataIndex,
|
|
96
|
+
label: sectionLabel !== false && (0, _extends2.default)({}, (0, _labelUtils.positionLabel)((0, _extends2.default)({}, sectionLabel, {
|
|
97
|
+
xPosition,
|
|
98
|
+
yPosition,
|
|
99
|
+
isHorizontal,
|
|
100
|
+
values,
|
|
101
|
+
dataIndex,
|
|
102
|
+
baseScaleData: baseScaleConfig.data ?? []
|
|
103
|
+
})), (0, _labelUtils.alignLabel)(sectionLabel ?? {}), {
|
|
104
|
+
value: valueFormatter ? valueFormatter(currentSeries.data[dataIndex], {
|
|
105
|
+
dataIndex
|
|
106
|
+
}) : currentSeries.data[dataIndex].value?.toLocaleString()
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
return result.flat();
|
|
112
|
+
}, [seriesData, xAxis, xAxisIds, yAxis, yAxisIds]);
|
|
113
|
+
return allData;
|
|
114
|
+
};
|
|
115
|
+
function FunnelPlot(props) {
|
|
116
|
+
const {
|
|
117
|
+
onItemClick
|
|
118
|
+
} = props,
|
|
119
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
120
|
+
const theme = (0, _styles.useTheme)();
|
|
121
|
+
const data = useAggregatedData();
|
|
122
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
123
|
+
children: [data.map(({
|
|
124
|
+
d,
|
|
125
|
+
color,
|
|
126
|
+
id,
|
|
127
|
+
seriesId,
|
|
128
|
+
dataIndex
|
|
129
|
+
}) => /*#__PURE__*/(0, _react.createElement)(_FunnelSection.FunnelSection, (0, _extends2.default)({}, other, {
|
|
130
|
+
d: d,
|
|
131
|
+
color: color,
|
|
132
|
+
key: id,
|
|
133
|
+
dataIndex: dataIndex,
|
|
134
|
+
seriesId: seriesId,
|
|
135
|
+
onClick: onItemClick && (event => {
|
|
136
|
+
onItemClick(event, {
|
|
137
|
+
type: 'funnel',
|
|
138
|
+
seriesId,
|
|
139
|
+
dataIndex
|
|
140
|
+
});
|
|
141
|
+
})
|
|
142
|
+
}))), data.map(({
|
|
143
|
+
id,
|
|
144
|
+
label
|
|
145
|
+
}) => {
|
|
146
|
+
if (!label) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("text", {
|
|
150
|
+
x: label.x,
|
|
151
|
+
y: label.y,
|
|
152
|
+
textAnchor: label.textAnchor,
|
|
153
|
+
dominantBaseline: label.dominantBaseline,
|
|
154
|
+
stroke: "none",
|
|
155
|
+
pointerEvents: "none",
|
|
156
|
+
fontFamily: theme.typography.body2.fontFamily,
|
|
157
|
+
fontSize: theme.typography.body2.fontSize,
|
|
158
|
+
fontSizeAdjust: theme.typography.body2.fontSizeAdjust,
|
|
159
|
+
fontWeight: theme.typography.body2.fontWeight,
|
|
160
|
+
letterSpacing: theme.typography.body2.letterSpacing,
|
|
161
|
+
fontStretch: theme.typography.body2.fontStretch,
|
|
162
|
+
fontStyle: theme.typography.body2.fontStyle,
|
|
163
|
+
fontVariant: theme.typography.body2.fontVariant,
|
|
164
|
+
fill: (theme.vars || theme)?.palette?.text?.primary,
|
|
165
|
+
children: label.value
|
|
166
|
+
}, id);
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
process.env.NODE_ENV !== "production" ? FunnelPlot.propTypes = {
|
|
171
|
+
// ----------------------------- Warning --------------------------------
|
|
172
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
173
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
174
|
+
// ----------------------------------------------------------------------
|
|
175
|
+
/**
|
|
176
|
+
* Callback fired when a funnel item is clicked.
|
|
177
|
+
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
178
|
+
* @param {FunnelItemIdentifier} funnelItemIdentifier The funnel item identifier.
|
|
179
|
+
*/
|
|
180
|
+
onItemClick: _propTypes.default.func,
|
|
181
|
+
/**
|
|
182
|
+
* The props used for each component slot.
|
|
183
|
+
* @default {}
|
|
184
|
+
*/
|
|
185
|
+
slotProps: _propTypes.default.object,
|
|
186
|
+
/**
|
|
187
|
+
* Overridable component slots.
|
|
188
|
+
* @default {}
|
|
189
|
+
*/
|
|
190
|
+
slots: _propTypes.default.object
|
|
191
|
+
} : void 0;
|
|
@@ -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 };
|