@mui/x-charts-pro 8.1.0 → 8.2.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.js +2 -1
- package/CHANGELOG.md +126 -7
- package/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -2
- package/FunnelChart/FunnelChart.js +7 -1
- package/FunnelChart/FunnelPlot.d.ts +5 -0
- package/FunnelChart/FunnelPlot.js +13 -16
- package/FunnelChart/curves/bump.d.ts +24 -0
- package/FunnelChart/curves/bump.js +82 -0
- package/FunnelChart/curves/curve.types.d.ts +8 -0
- package/FunnelChart/curves/curve.types.js +5 -0
- package/FunnelChart/curves/funnelStep.d.ts +25 -0
- package/FunnelChart/{funnelStepCurve.js → curves/funnelStep.js} +32 -19
- package/FunnelChart/curves/getFunnelCurve.d.ts +3 -0
- package/FunnelChart/curves/getFunnelCurve.js +22 -0
- package/FunnelChart/curves/index.d.ts +2 -0
- package/FunnelChart/curves/index.js +27 -0
- package/FunnelChart/curves/linear.d.ts +24 -0
- package/FunnelChart/curves/linear.js +113 -0
- package/FunnelChart/funnel.types.d.ts +2 -2
- package/FunnelChart/funnelPlotSlots.types.d.ts +1 -1
- package/FunnelChart/funnelSectionClasses.d.ts +1 -1
- package/FunnelChart/index.d.ts +3 -2
- package/FunnelChart/useFunnelChartProps.d.ts +1 -1
- package/FunnelChart/useFunnelChartProps.js +7 -4
- package/Heatmap/Heatmap.js +1 -1
- package/LineChartPro/LineChartPro.js +2 -1
- package/ScatterChartPro/ScatterChartPro.js +2 -1
- package/esm/BarChartPro/BarChartPro.js +2 -1
- package/esm/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -2
- package/esm/FunnelChart/FunnelChart.js +7 -1
- package/esm/FunnelChart/FunnelPlot.d.ts +5 -0
- package/esm/FunnelChart/FunnelPlot.js +14 -17
- package/esm/FunnelChart/curves/bump.d.ts +24 -0
- package/esm/FunnelChart/curves/bump.js +75 -0
- package/esm/FunnelChart/curves/curve.types.d.ts +8 -0
- package/esm/FunnelChart/curves/curve.types.js +1 -0
- package/esm/FunnelChart/curves/funnelStep.d.ts +25 -0
- package/esm/FunnelChart/{funnelStepCurve.js → curves/funnelStep.js} +32 -19
- package/esm/FunnelChart/curves/getFunnelCurve.d.ts +3 -0
- package/esm/FunnelChart/curves/getFunnelCurve.js +15 -0
- package/esm/FunnelChart/curves/index.d.ts +2 -0
- package/esm/FunnelChart/curves/index.js +2 -0
- package/esm/FunnelChart/curves/linear.d.ts +24 -0
- package/esm/FunnelChart/curves/linear.js +106 -0
- package/esm/FunnelChart/funnel.types.d.ts +2 -2
- package/esm/FunnelChart/funnelPlotSlots.types.d.ts +1 -1
- package/esm/FunnelChart/funnelSectionClasses.d.ts +1 -1
- package/esm/FunnelChart/index.d.ts +3 -2
- package/esm/FunnelChart/useFunnelChartProps.d.ts +1 -1
- package/esm/FunnelChart/useFunnelChartProps.js +7 -4
- package/esm/Heatmap/Heatmap.js +1 -1
- package/esm/LineChartPro/LineChartPro.js +2 -1
- package/esm/ScatterChartPro/ScatterChartPro.js +2 -1
- package/esm/index.js +1 -1
- package/esm/internals/plugins/useChartProExport/common.d.ts +1 -0
- package/esm/internals/plugins/useChartProExport/common.js +8 -0
- package/esm/internals/plugins/useChartProExport/exportImage.d.ts +3 -0
- package/esm/internals/plugins/useChartProExport/exportImage.js +85 -0
- package/esm/internals/plugins/useChartProExport/print.js +6 -50
- package/esm/internals/plugins/useChartProExport/useChartProExport.js +22 -2
- package/esm/internals/plugins/useChartProExport/useChartProExport.types.d.ts +32 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +1 -1
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +25 -25
- package/esm/themeAugmentation/components.d.ts +0 -4
- package/esm/themeAugmentation/components.js +1 -0
- package/esm/themeAugmentation/index.d.ts +3 -3
- package/esm/themeAugmentation/overrides.d.ts +0 -3
- package/esm/themeAugmentation/overrides.js +2 -0
- package/esm/themeAugmentation/props.d.ts +0 -6
- package/esm/themeAugmentation/props.js +2 -0
- package/index.js +1 -1
- package/internals/plugins/useChartProExport/common.d.ts +1 -0
- package/internals/plugins/useChartProExport/common.js +14 -0
- package/internals/plugins/useChartProExport/exportImage.d.ts +3 -0
- package/internals/plugins/useChartProExport/exportImage.js +95 -0
- package/internals/plugins/useChartProExport/print.js +6 -50
- package/internals/plugins/useChartProExport/useChartProExport.js +22 -2
- package/internals/plugins/useChartProExport/useChartProExport.types.d.ts +32 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.js +1 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +25 -25
- package/package.json +7 -4
- package/themeAugmentation/components.d.ts +0 -4
- package/themeAugmentation/components.js +5 -0
- package/themeAugmentation/index.d.ts +3 -3
- package/themeAugmentation/overrides.d.ts +0 -3
- package/themeAugmentation/overrides.js +5 -0
- package/themeAugmentation/props.d.ts +0 -6
- package/themeAugmentation/props.js +5 -0
- package/FunnelChart/funnelStepCurve.d.ts +0 -4
- package/esm/FunnelChart/funnelStepCurve.d.ts +0 -4
|
@@ -91,6 +91,7 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
91
91
|
// ----------------------------------------------------------------------
|
|
92
92
|
apiRef: _propTypes.default.shape({
|
|
93
93
|
current: _propTypes.default.shape({
|
|
94
|
+
exportAsImage: _propTypes.default.func.isRequired,
|
|
94
95
|
exportAsPrint: _propTypes.default.func.isRequired,
|
|
95
96
|
setZoomData: _propTypes.default.func.isRequired
|
|
96
97
|
})
|
|
@@ -202,7 +203,7 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
202
203
|
* The function called for onClick events.
|
|
203
204
|
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
204
205
|
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
|
|
205
|
-
* @param {null |
|
|
206
|
+
* @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
|
|
206
207
|
*/
|
|
207
208
|
onAxisClick: _propTypes.default.func,
|
|
208
209
|
/**
|
package/CHANGELOG.md
CHANGED
|
@@ -5,13 +5,128 @@
|
|
|
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.2.0
|
|
9
|
+
|
|
10
|
+
_May 1, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 📊 `<FunnelChart/>` now uses the `strawberrySky` sequential color palette by default.
|
|
15
|
+
<img width="481" alt="Screenshot 2025-04-29 at 13 55 21" src="https://github.com/user-attachments/assets/182085d1-a7ce-4e4d-9d8d-a4fe87f27167" />
|
|
16
|
+
- 📊 Add API to export a chart as an image: `apiRef.exportAsImage` — [Learn more](https://mui.com/x/react-charts/export/#export-as-image).
|
|
17
|
+
|
|
18
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
19
|
+
@federico-ntr, @nusr.
|
|
20
|
+
Following are all team members who have contributed to this release:
|
|
21
|
+
@alexfauquette, @arminmeh, @bernardobelchior, @hasdfa, @Janpot, @JCQuintas, @KenanYusuf, @LukasTy, @MBilalShafi, @michelengelen, @oliviertassinari, @romgrk.
|
|
22
|
+
|
|
23
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
24
|
+
|
|
25
|
+
### Data Grid
|
|
26
|
+
|
|
27
|
+
#### `@mui/x-data-grid@8.2.0`
|
|
28
|
+
|
|
29
|
+
- [DataGrid] Fix panel alignment (#17625) @KenanYusuf
|
|
30
|
+
- [DataGrid] Fix theme `defaultProps` causing unwanted re-renders (#17490) @KenanYusuf
|
|
31
|
+
- [DataGrid] Fix circular reference error (#17591) @romgrk
|
|
32
|
+
- [DataGrid] Fix `<GridEditInputCell />` break input (#16773) @nusr
|
|
33
|
+
|
|
34
|
+
#### `@mui/x-data-grid-pro@8.2.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
35
|
+
|
|
36
|
+
Same changes as in `@mui/x-data-grid@8.2.0`, plus:
|
|
37
|
+
|
|
38
|
+
- [DataGridPro] Use intersection observer to trigger server-side infinite loading (#17369) @arminmeh
|
|
39
|
+
|
|
40
|
+
#### `@mui/x-data-grid-premium@8.2.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
41
|
+
|
|
42
|
+
Same changes as in `@mui/x-data-grid-pro@8.2.0`.
|
|
43
|
+
|
|
44
|
+
### Date and Time Pickers
|
|
45
|
+
|
|
46
|
+
#### `@mui/x-date-pickers@8.2.0`
|
|
47
|
+
|
|
48
|
+
- [l10n] Improve Italian (it-IT) locale (#17600) @federico-ntr
|
|
49
|
+
- [pickers] Refactor owner state typing (#17517) @LukasTy
|
|
50
|
+
|
|
51
|
+
#### `@mui/x-date-pickers-pro@8.2.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
52
|
+
|
|
53
|
+
Same changes as in `@mui/x-date-pickers@8.2.0`.
|
|
54
|
+
|
|
55
|
+
### Charts
|
|
56
|
+
|
|
57
|
+
#### `@mui/x-charts@8.2.0`
|
|
58
|
+
|
|
59
|
+
- [charts] Add library name to errors (#17547) @bernardobelchior
|
|
60
|
+
- [charts] Add monochrome palettes (#17610) @JCQuintas
|
|
61
|
+
- [charts] Add screenshot of the tooltip (#17395) @alexfauquette
|
|
62
|
+
- [charts] Default bar chart x-axis scale type to band (#17519) @bernardobelchior
|
|
63
|
+
- [charts] Document axis ID uniqueness constraints (#17630) @bernardobelchior
|
|
64
|
+
- [charts] Refactor axis types (#17632) @bernardobelchior
|
|
65
|
+
- [charts] Use `<circle />` for circular legend mark (#17590) @alexfauquette
|
|
66
|
+
|
|
67
|
+
#### `@mui/x-charts-pro@8.2.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
68
|
+
|
|
69
|
+
Same changes as in `@mui/x-charts@8.2.0`, plus:
|
|
70
|
+
|
|
71
|
+
- [charts-pro] Add `gap` option to `<FunnelChart />` (#17642) @JCQuintas
|
|
72
|
+
- [charts-pro] Export charts as image (#17353) @bernardobelchior
|
|
73
|
+
- [charts-pro] Simplify zoom testing (#17525) @JCQuintas
|
|
74
|
+
- [charts-pro] Use new sequential color palette in `<FunnelChart />` (#17606) @JCQuintas
|
|
75
|
+
|
|
76
|
+
### Tree View
|
|
77
|
+
|
|
78
|
+
#### `@mui/x-tree-view@8.2.0`
|
|
79
|
+
|
|
80
|
+
Internal changes.
|
|
81
|
+
|
|
82
|
+
#### `@mui/x-tree-view-pro@8.2.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
83
|
+
|
|
84
|
+
Same changes as in `@mui/x-tree-view@8.2.0`.
|
|
85
|
+
|
|
86
|
+
### Docs
|
|
87
|
+
|
|
88
|
+
- [docs][charts] Add composition sections (#17377) @alexfauquette
|
|
89
|
+
- [docs][charts] Add docs on tooltip style (#17601) @bernardobelchior
|
|
90
|
+
- [docs][charts] Fix highlighting heading structure (#17581) @oliviertassinari
|
|
91
|
+
- [docs][charts] Improve export docs (#17538) @oliviertassinari
|
|
92
|
+
- [docs][charts] Similar introduction on most charts pages (#17374) @alexfauquette
|
|
93
|
+
- [docs][DataGrid] Clear component docs (#17540) @oliviertassinari
|
|
94
|
+
- [docs] Explicitly state that `groupingColDef` reference needs to be stable (#17544) @arminmeh
|
|
95
|
+
- [docs] Fix <kbd> a11y (#17536) @oliviertassinari
|
|
96
|
+
- [docs] Fix CodeSandbox spelling @oliviertassinari
|
|
97
|
+
- [docs] Fix coding style function @oliviertassinari
|
|
98
|
+
- [docs] Fix migration guide format (#17450) @oliviertassinari
|
|
99
|
+
- [docs] Improve data grid export docs (#17551) @MBilalShafi
|
|
100
|
+
- [docs] Remove leftover `@next` usages (#17542) @LukasTy
|
|
101
|
+
|
|
102
|
+
### Core
|
|
103
|
+
|
|
104
|
+
- [core] Add security label to dependabot PRs @oliviertassinari
|
|
105
|
+
- [core] Allow post-install vale @oliviertassinari
|
|
106
|
+
- [core] Component consistency @oliviertassinari
|
|
107
|
+
- [core] Fix all Vale errors @oliviertassinari
|
|
108
|
+
- [core] Move `loadStyleSheets` to internals and use it in data grid and charts (#17548) @bernardobelchior
|
|
109
|
+
- [core] Remove empty version (#17582) @oliviertassinari
|
|
110
|
+
- [core] Remove eslint from codemod spec files (#17443) @alexfauquette
|
|
111
|
+
- [core] Remove unnecessary versions (#17597) @oliviertassinari
|
|
112
|
+
- [code-infra] Allow postinstall scripts for packages requesting it (#17635) @LukasTy
|
|
113
|
+
- [code-infra] Data Grid `vitest` changes (#17619) @JCQuintas
|
|
114
|
+
- [code-infra] Fix date-time sensitive tests (#17644) @JCQuintas
|
|
115
|
+
- [code-infra] Fix extension handling for type imports (#17636) @Janpot
|
|
116
|
+
- [code-infra] Further remove `clock=fake` and add `async act` for datagrid (#17563) @JCQuintas
|
|
117
|
+
- [code-infra] Latest vitest picker changes (#17577) @JCQuintas
|
|
118
|
+
- [docs-infra] Fix Vale no longer working (#17602) @alexfauquette
|
|
119
|
+
- [docs-infra] Uniformize Vale between repositories @oliviertassinari
|
|
120
|
+
- [infra] Updates to `branch switch comments` (#17589) @michelengelen
|
|
121
|
+
- [x-telemetry] Fix issue with get machineid hash (#17614) @hasdfa
|
|
122
|
+
|
|
8
123
|
## 8.1.0
|
|
9
124
|
|
|
10
125
|
_Apr 24, 2025_
|
|
11
126
|
|
|
12
127
|
We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
13
128
|
|
|
14
|
-
- 📊 Add API to print a chart or export it as PDF: `apiRef.exportAsPrint`.
|
|
129
|
+
- 📊 Add API to print a chart or export it as PDF: `apiRef.exportAsPrint()`.
|
|
15
130
|
- 📚 Documentation improvements
|
|
16
131
|
- 🐞 Bugfixes
|
|
17
132
|
|
|
@@ -56,7 +171,7 @@ Same changes as in `@mui/x-date-pickers@8.1.0`.
|
|
|
56
171
|
|
|
57
172
|
### Charts
|
|
58
173
|
|
|
59
|
-
- Add API to print a chart or export it as PDF: `apiRef.exportAsPrint`.
|
|
174
|
+
- Add API to print a chart or export it as PDF: `apiRef.exportAsPrint()`.
|
|
60
175
|
|
|
61
176
|
#### `@mui/x-charts@8.1.0`
|
|
62
177
|
|
|
@@ -1821,7 +1936,7 @@ Same changes as in `@mui/x-tree-view@8.0.0-alpha.8`.
|
|
|
1821
1936
|
- [docs] Add example for custom legend (#16169) @alexfauquette
|
|
1822
1937
|
- [docs] Add full custom field creation example (#15194) @flaviendelangle
|
|
1823
1938
|
- [docs] Copyedit the Data Grid cell selection page (#16099) @samuelsycamore
|
|
1824
|
-
- [docs] Fix demo rendering issue on
|
|
1939
|
+
- [docs] Fix demo rendering issue on CodeSandbox (#16118) @arminmeh
|
|
1825
1940
|
- [docs] Remove broken links (#16167) @alexfauquette
|
|
1826
1941
|
- [docs] Split the Data Grid editing page (#14931) @MBilalShafi
|
|
1827
1942
|
- [docs] Fix wrong props warnings (#16119) @JCQuintas
|
|
@@ -2268,7 +2383,7 @@ Releasing to benefit from license package fix (#15814).
|
|
|
2268
2383
|
|
|
2269
2384
|
- [code-infra] Add Charts sandbox generation (#15830) @JCQuintas
|
|
2270
2385
|
- [code-infra] Remove redundant `@type/react-test-renderer` dep (#15766) @LukasTy
|
|
2271
|
-
- [license] Use `console.log` for the error message on
|
|
2386
|
+
- [license] Use `console.log` for the error message on CodeSandbox to avoid rendering error (#15814) @arminmeh
|
|
2272
2387
|
|
|
2273
2388
|
## 8.0.0-alpha.3
|
|
2274
2389
|
|
|
@@ -2484,6 +2599,8 @@ Same changes as in `@mui/x-tree-view@v8.0.0-alpha.2`.
|
|
|
2484
2599
|
|
|
2485
2600
|
### Docs
|
|
2486
2601
|
|
|
2602
|
+
<!-- vale MUI.CorrectRererenceCased = NO -->
|
|
2603
|
+
|
|
2487
2604
|
- [docs] Fix 404 links (#15575) @oliviertassinari
|
|
2488
2605
|
- [docs] Fix bash comments (#15571) @oliviertassinari
|
|
2489
2606
|
- [docs] Fix Pickers theme augmentation example (#15672) @LukasTy
|
|
@@ -2493,6 +2610,8 @@ Same changes as in `@mui/x-tree-view@v8.0.0-alpha.2`.
|
|
|
2493
2610
|
- [docs] Fix `anchorEl` API page for charts (#15625) @oliviertassinari
|
|
2494
2611
|
- [docs] Add documentation for the list view feature (#15344) @KenanYusuf
|
|
2495
2612
|
|
|
2613
|
+
<!-- vale MUI.CorrectRererenceCased = YES -->
|
|
2614
|
+
|
|
2496
2615
|
### Core
|
|
2497
2616
|
|
|
2498
2617
|
- [core] Follow `()` function convention for docs @oliviertassinari
|
|
@@ -3401,7 +3520,7 @@ Same changes as in `@mui/x-tree-view@7.24.0`.
|
|
|
3401
3520
|
### Docs
|
|
3402
3521
|
|
|
3403
3522
|
- [docs] Copyedit the Data Grid cell selection page (#16213) @samuelsycamore
|
|
3404
|
-
- [docs] Fix demo rendering issue on
|
|
3523
|
+
- [docs] Fix demo rendering issue on CodeSandbox (#16129) @arminmeh
|
|
3405
3524
|
|
|
3406
3525
|
### Core
|
|
3407
3526
|
|
|
@@ -3679,7 +3798,7 @@ Releasing to benefit from license package fix (#15818).
|
|
|
3679
3798
|
### Core
|
|
3680
3799
|
|
|
3681
3800
|
- [core] Add `@mui/x-tree-view-pro` to `releaseChangelog` (#15747) @flaviendelangle
|
|
3682
|
-
- [license] Use `console.log` for the error message on
|
|
3801
|
+
- [license] Use `console.log` for the error message on CodeSandbox to avoid rendering error (#15818) @arminmeh
|
|
3683
3802
|
|
|
3684
3803
|
## 7.23.1
|
|
3685
3804
|
|
|
@@ -7020,7 +7139,7 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-beta.4`.
|
|
|
7020
7139
|
/>
|
|
7021
7140
|
```
|
|
7022
7141
|
|
|
7023
|
-
- The headless field hooks (
|
|
7142
|
+
- The headless field hooks (for example `useDateField()`) now returns a new prop called `enableAccessibleFieldDOMStructure`.
|
|
7024
7143
|
This property is utilized to determine whether the anticipated UI is constructed using an accessible DOM structure.
|
|
7025
7144
|
Learn more about this new accessible DOM structure in the [v8 migration guide](https://v7.mui.com/x/migration/migration-pickers-v7/#new-dom-structure-for-the-field).
|
|
7026
7145
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChartAnyPluginSignature, ChartSeriesType, UseChartContainerPropsReturnValue } from '@mui/x-charts/internals';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ChartDataProviderProps } from '@mui/x-charts/ChartDataProvider';
|
|
4
|
-
import type { ChartContainerProProps } from
|
|
4
|
+
import type { ChartContainerProProps } from "./ChartContainerPro.js";
|
|
5
5
|
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>;
|
|
@@ -17,7 +17,7 @@ var _useLicenseVerifier = require("@mui/x-license/useLicenseVerifier");
|
|
|
17
17
|
var _allPlugins = require("../internals/plugins/allPlugins");
|
|
18
18
|
var _useChartDataProviderProProps = require("./useChartDataProviderProProps");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const releaseInfo = "
|
|
20
|
+
const releaseInfo = "MTc0NjA0NjgwMDAwMA==";
|
|
21
21
|
const packageIdentifier = 'x-charts-pro';
|
|
22
22
|
/**
|
|
23
23
|
* Orchestrates the data providers for the chart components and hooks.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartAnyPluginSignature, ChartSeriesType } from '@mui/x-charts/internals';
|
|
2
|
-
import type { ChartDataProviderProProps } from
|
|
3
|
-
import type { AllPluginSignatures } from
|
|
2
|
+
import type { ChartDataProviderProProps } from "./ChartDataProviderPro.js";
|
|
3
|
+
import type { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
4
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
|
localeText: Partial<import("@mui/x-charts/locales").ChartsLocaleText> | undefined;
|
|
@@ -70,6 +70,7 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
70
70
|
// ----------------------------------------------------------------------
|
|
71
71
|
apiRef: _propTypes.default.shape({
|
|
72
72
|
current: _propTypes.default.shape({
|
|
73
|
+
exportAsImage: _propTypes.default.func.isRequired,
|
|
73
74
|
exportAsPrint: _propTypes.default.func.isRequired,
|
|
74
75
|
setZoomData: _propTypes.default.func.isRequired
|
|
75
76
|
})
|
|
@@ -183,6 +184,11 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
183
184
|
* @default false
|
|
184
185
|
*/
|
|
185
186
|
disableAxisListener: _propTypes.default.bool,
|
|
187
|
+
/**
|
|
188
|
+
* The gap, in pixels, between funnel sections.
|
|
189
|
+
* @default 0
|
|
190
|
+
*/
|
|
191
|
+
gap: _propTypes.default.number,
|
|
186
192
|
/**
|
|
187
193
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
188
194
|
*/
|
|
@@ -239,7 +245,7 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
239
245
|
* The function called for onClick events.
|
|
240
246
|
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
241
247
|
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
|
|
242
|
-
* @param {null |
|
|
248
|
+
* @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
|
|
243
249
|
*/
|
|
244
250
|
onAxisClick: _propTypes.default.func,
|
|
245
251
|
/**
|
|
@@ -2,6 +2,11 @@ import * as React from 'react';
|
|
|
2
2
|
import { FunnelItemIdentifier } from "./funnel.types.js";
|
|
3
3
|
import { FunnelPlotSlotExtension } from "./funnelPlotSlots.types.js";
|
|
4
4
|
export interface FunnelPlotProps extends FunnelPlotSlotExtension {
|
|
5
|
+
/**
|
|
6
|
+
* The gap, in pixels, between funnel sections.
|
|
7
|
+
* @default 0
|
|
8
|
+
*/
|
|
9
|
+
gap?: number;
|
|
5
10
|
/**
|
|
6
11
|
* Callback fired when a funnel item is clicked.
|
|
7
12
|
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
@@ -17,21 +17,12 @@ var _hooks = require("@mui/x-charts/hooks");
|
|
|
17
17
|
var _styles = require("@mui/material/styles");
|
|
18
18
|
var _FunnelSection = require("./FunnelSection");
|
|
19
19
|
var _labelUtils = require("./labelUtils");
|
|
20
|
-
var _funnelStepCurve = require("./funnelStepCurve");
|
|
21
20
|
var _useFunnelSeries = require("../hooks/useFunnelSeries");
|
|
21
|
+
var _curves = require("./curves");
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
const _excluded = ["onItemClick"];
|
|
23
|
+
const _excluded = ["onItemClick", "gap"];
|
|
24
24
|
_internals.cartesianSeriesTypes.addType('funnel');
|
|
25
|
-
const
|
|
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 = () => {
|
|
25
|
+
const useAggregatedData = gap => {
|
|
35
26
|
const seriesData = (0, _useFunnelSeries.useFunnelSeriesContext)();
|
|
36
27
|
const {
|
|
37
28
|
xAxis,
|
|
@@ -63,7 +54,7 @@ const useAggregatedData = () => {
|
|
|
63
54
|
const bandWidth = (isXAxisBand || isYAxisBand) && baseScaleConfig.scale?.bandwidth() || 0;
|
|
64
55
|
const xScale = xAxis[xAxisId].scale;
|
|
65
56
|
const yScale = yAxis[yAxisId].scale;
|
|
66
|
-
const curve = getFunnelCurve(currentSeries.curve, isHorizontal);
|
|
57
|
+
const curve = (0, _curves.getFunnelCurve)(currentSeries.curve, isHorizontal, gap);
|
|
67
58
|
const xPosition = (value, bandIndex, stackOffset, useBand) => {
|
|
68
59
|
if (isXAxisBand) {
|
|
69
60
|
const position = xScale(bandIndex);
|
|
@@ -109,16 +100,17 @@ const useAggregatedData = () => {
|
|
|
109
100
|
});
|
|
110
101
|
});
|
|
111
102
|
return result.flat();
|
|
112
|
-
}, [seriesData, xAxis, xAxisIds, yAxis, yAxisIds]);
|
|
103
|
+
}, [seriesData, xAxis, xAxisIds, yAxis, yAxisIds, gap]);
|
|
113
104
|
return allData;
|
|
114
105
|
};
|
|
115
106
|
function FunnelPlot(props) {
|
|
116
107
|
const {
|
|
117
|
-
onItemClick
|
|
108
|
+
onItemClick,
|
|
109
|
+
gap
|
|
118
110
|
} = props,
|
|
119
111
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
120
112
|
const theme = (0, _styles.useTheme)();
|
|
121
|
-
const data = useAggregatedData();
|
|
113
|
+
const data = useAggregatedData(gap);
|
|
122
114
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
123
115
|
children: [data.map(({
|
|
124
116
|
d,
|
|
@@ -172,6 +164,11 @@ process.env.NODE_ENV !== "production" ? FunnelPlot.propTypes = {
|
|
|
172
164
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
173
165
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
174
166
|
// ----------------------------------------------------------------------
|
|
167
|
+
/**
|
|
168
|
+
* The gap, in pixels, between funnel sections.
|
|
169
|
+
* @default 0
|
|
170
|
+
*/
|
|
171
|
+
gap: _propTypes.default.number,
|
|
175
172
|
/**
|
|
176
173
|
* Callback fired when a funnel item is clicked.
|
|
177
174
|
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
|
|
2
|
+
/**
|
|
3
|
+
* This is a custom "bump" curve generator.
|
|
4
|
+
*
|
|
5
|
+
* It takes into account the gap between the points and draws a smooth curve between them.
|
|
6
|
+
*
|
|
7
|
+
* It is based on the d3-shape bump curve generator.
|
|
8
|
+
* https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/bump.js
|
|
9
|
+
*/
|
|
10
|
+
export declare class Bump implements CurveGenerator {
|
|
11
|
+
private context;
|
|
12
|
+
private line;
|
|
13
|
+
private x;
|
|
14
|
+
private y;
|
|
15
|
+
private currentPoint;
|
|
16
|
+
private isHorizontal;
|
|
17
|
+
private gap;
|
|
18
|
+
constructor(context: CanvasRenderingContext2D, isHorizontal: boolean, gap?: number);
|
|
19
|
+
areaStart(): void;
|
|
20
|
+
areaEnd(): void;
|
|
21
|
+
lineStart(): void;
|
|
22
|
+
lineEnd(): void;
|
|
23
|
+
point(x: number, y: number): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Bump = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This is a custom "bump" curve generator.
|
|
9
|
+
*
|
|
10
|
+
* It takes into account the gap between the points and draws a smooth curve between them.
|
|
11
|
+
*
|
|
12
|
+
* It is based on the d3-shape bump curve generator.
|
|
13
|
+
* https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/bump.js
|
|
14
|
+
*/
|
|
15
|
+
class Bump {
|
|
16
|
+
constructor(context, isHorizontal, gap = 0) {
|
|
17
|
+
this.context = void 0;
|
|
18
|
+
this.line = NaN;
|
|
19
|
+
this.x = NaN;
|
|
20
|
+
this.y = NaN;
|
|
21
|
+
this.currentPoint = 0;
|
|
22
|
+
this.isHorizontal = false;
|
|
23
|
+
this.gap = 0;
|
|
24
|
+
this.context = context;
|
|
25
|
+
this.isHorizontal = isHorizontal;
|
|
26
|
+
this.gap = gap / 2;
|
|
27
|
+
}
|
|
28
|
+
areaStart() {
|
|
29
|
+
this.line = 0;
|
|
30
|
+
}
|
|
31
|
+
areaEnd() {
|
|
32
|
+
this.line = NaN;
|
|
33
|
+
}
|
|
34
|
+
lineStart() {
|
|
35
|
+
this.currentPoint = 0;
|
|
36
|
+
}
|
|
37
|
+
lineEnd() {
|
|
38
|
+
if (this.line || this.line !== 0 && this.currentPoint === 1) {
|
|
39
|
+
this.context.closePath();
|
|
40
|
+
}
|
|
41
|
+
this.line = 1 - this.line;
|
|
42
|
+
}
|
|
43
|
+
point(x, y) {
|
|
44
|
+
x = +x;
|
|
45
|
+
y = +y;
|
|
46
|
+
|
|
47
|
+
// 0 is the top-left corner.
|
|
48
|
+
if (this.isHorizontal) {
|
|
49
|
+
if (this.currentPoint === 0) {
|
|
50
|
+
this.context.moveTo(x + this.gap, y);
|
|
51
|
+
this.context.lineTo(x + this.gap, y);
|
|
52
|
+
} else if (this.currentPoint === 1) {
|
|
53
|
+
this.context.bezierCurveTo((this.x + x) / 2, this.y, (this.x + x) / 2, y, x - this.gap, y);
|
|
54
|
+
} else if (this.currentPoint === 2) {
|
|
55
|
+
this.context.lineTo(x - this.gap, y);
|
|
56
|
+
} else {
|
|
57
|
+
this.context.bezierCurveTo((this.x + x) / 2, this.y, (this.x + x) / 2, y, x + this.gap, y);
|
|
58
|
+
}
|
|
59
|
+
this.currentPoint += 1;
|
|
60
|
+
this.x = x;
|
|
61
|
+
this.y = y;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 0 is the top-right corner.
|
|
66
|
+
if (this.currentPoint === 0) {
|
|
67
|
+
// X from Y
|
|
68
|
+
this.context.moveTo(x, y + this.gap);
|
|
69
|
+
this.context.lineTo(x, y + this.gap);
|
|
70
|
+
} else if (this.currentPoint === 1) {
|
|
71
|
+
this.context.bezierCurveTo(this.x, (this.y + y) / 2, x, (this.y + y) / 2, x, y - this.gap);
|
|
72
|
+
} else if (this.currentPoint === 2) {
|
|
73
|
+
this.context.lineTo(x, y - this.gap);
|
|
74
|
+
} else {
|
|
75
|
+
this.context.bezierCurveTo(this.x, (this.y + y) / 2, x, (this.y + y) / 2, x, y + this.gap);
|
|
76
|
+
}
|
|
77
|
+
this.currentPoint += 1;
|
|
78
|
+
this.x = x;
|
|
79
|
+
this.y = y;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.Bump = Bump;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
|
|
2
|
+
/**
|
|
3
|
+
* This is a custom "step" curve generator for the funnel chart.
|
|
4
|
+
* It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
|
|
5
|
+
*
|
|
6
|
+
* It takes into account the gap between the points and draws a smooth curve between them.
|
|
7
|
+
*
|
|
8
|
+
* It is based on the d3-shape step curve generator.
|
|
9
|
+
* https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
|
|
10
|
+
*/
|
|
11
|
+
export declare class FunnelStep implements CurveGenerator {
|
|
12
|
+
private context;
|
|
13
|
+
private line;
|
|
14
|
+
private x;
|
|
15
|
+
private y;
|
|
16
|
+
private currentPoint;
|
|
17
|
+
private isHorizontal;
|
|
18
|
+
private gap;
|
|
19
|
+
constructor(context: CanvasRenderingContext2D, isHorizontal: boolean, gap?: number);
|
|
20
|
+
areaStart(): void;
|
|
21
|
+
areaEnd(): void;
|
|
22
|
+
lineStart(): void;
|
|
23
|
+
lineEnd(): void;
|
|
24
|
+
point(x: number, y: number): void;
|
|
25
|
+
}
|
|
@@ -3,24 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.FunnelStep = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* This is a custom "step" curve generator for the funnel chart.
|
|
9
9
|
* It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
|
|
10
10
|
*
|
|
11
|
+
* It takes into account the gap between the points and draws a smooth curve between them.
|
|
12
|
+
*
|
|
11
13
|
* It is based on the d3-shape step curve generator.
|
|
12
14
|
* https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
|
|
13
15
|
*/
|
|
14
16
|
class FunnelStep {
|
|
15
|
-
constructor(context, isHorizontal) {
|
|
17
|
+
constructor(context, isHorizontal, gap = 0) {
|
|
16
18
|
this.context = void 0;
|
|
17
19
|
this.line = NaN;
|
|
18
20
|
this.x = NaN;
|
|
19
21
|
this.y = NaN;
|
|
20
22
|
this.currentPoint = 0;
|
|
21
23
|
this.isHorizontal = false;
|
|
24
|
+
this.gap = 0;
|
|
22
25
|
this.context = context;
|
|
23
26
|
this.isHorizontal = isHorizontal;
|
|
27
|
+
this.gap = gap / 2;
|
|
24
28
|
}
|
|
25
29
|
areaStart() {
|
|
26
30
|
this.line = 0;
|
|
@@ -47,28 +51,37 @@ class FunnelStep {
|
|
|
47
51
|
point(x, y) {
|
|
48
52
|
x = +x;
|
|
49
53
|
y = +y;
|
|
54
|
+
|
|
55
|
+
// 0 is the top-left corner.
|
|
56
|
+
if (this.isHorizontal) {
|
|
57
|
+
if (this.currentPoint === 0) {
|
|
58
|
+
this.context.moveTo(x + this.gap, y);
|
|
59
|
+
} else if (this.currentPoint === 1 || this.currentPoint === 2) {
|
|
60
|
+
this.context.lineTo(x - this.gap, this.y);
|
|
61
|
+
this.context.lineTo(x - this.gap, y);
|
|
62
|
+
} else {
|
|
63
|
+
this.context.lineTo(this.x - this.gap, y);
|
|
64
|
+
this.context.lineTo(x + this.gap, y);
|
|
65
|
+
}
|
|
66
|
+
this.currentPoint += 1;
|
|
67
|
+
this.x = x;
|
|
68
|
+
this.y = y;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// 0 is the top-right corner.
|
|
50
73
|
if (this.currentPoint === 0) {
|
|
51
|
-
this.context.moveTo(x, y);
|
|
52
|
-
} else if (this.
|
|
53
|
-
this.context.lineTo(x, this.y);
|
|
54
|
-
this.context.lineTo(x, y);
|
|
55
|
-
} else if (this.currentPoint === 3 && !this.isHorizontal) {
|
|
56
|
-
this.context.lineTo(x, this.y);
|
|
57
|
-
this.context.lineTo(x, y);
|
|
74
|
+
this.context.moveTo(x, y + this.gap);
|
|
75
|
+
} else if (this.currentPoint === 3) {
|
|
76
|
+
this.context.lineTo(x, this.y - this.gap);
|
|
77
|
+
this.context.lineTo(x, y + this.gap);
|
|
58
78
|
} else {
|
|
59
|
-
this.context.lineTo(this.x, y);
|
|
60
|
-
this.context.lineTo(x, y);
|
|
79
|
+
this.context.lineTo(this.x, y - this.gap);
|
|
80
|
+
this.context.lineTo(x, y - this.gap);
|
|
61
81
|
}
|
|
62
82
|
this.currentPoint += 1;
|
|
63
83
|
this.x = x;
|
|
64
84
|
this.y = y;
|
|
65
85
|
}
|
|
66
86
|
}
|
|
67
|
-
|
|
68
|
-
return new FunnelStep(context, true);
|
|
69
|
-
};
|
|
70
|
-
exports.funnelHorizontalStepCurve = funnelHorizontalStepCurve;
|
|
71
|
-
const funnelVerticalStepCurve = context => {
|
|
72
|
-
return new FunnelStep(context, false);
|
|
73
|
-
};
|
|
74
|
-
exports.funnelVerticalStepCurve = funnelVerticalStepCurve;
|
|
87
|
+
exports.FunnelStep = FunnelStep;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getFunnelCurve = void 0;
|
|
7
|
+
var _funnelStep = require("./funnelStep");
|
|
8
|
+
var _linear = require("./linear");
|
|
9
|
+
var _bump = require("./bump");
|
|
10
|
+
const curveConstructor = curve => {
|
|
11
|
+
if (curve === 'step') {
|
|
12
|
+
return _funnelStep.FunnelStep;
|
|
13
|
+
}
|
|
14
|
+
if (curve === 'bump') {
|
|
15
|
+
return _bump.Bump;
|
|
16
|
+
}
|
|
17
|
+
return _linear.Linear;
|
|
18
|
+
};
|
|
19
|
+
const getFunnelCurve = (curve, isHorizontal, gap = 0) => {
|
|
20
|
+
return context => new (curveConstructor(curve))(context, isHorizontal, gap);
|
|
21
|
+
};
|
|
22
|
+
exports.getFunnelCurve = getFunnelCurve;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _curve = require("./curve.types");
|
|
7
|
+
Object.keys(_curve).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _curve[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _curve[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _getFunnelCurve = require("./getFunnelCurve");
|
|
18
|
+
Object.keys(_getFunnelCurve).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _getFunnelCurve[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _getFunnelCurve[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|