@mui/x-charts-pro 8.13.1 → 8.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChartPro/BarChartPro.js +49 -37
- package/CHANGELOG.md +204 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/FunnelChart/funnelAxisPlugin/computeAxisValue.js +38 -36
- package/Heatmap/Heatmap.js +0 -4
- package/LineChartPro/LineChartPro.js +49 -37
- package/SankeyChart/SankeyChart.d.ts +1 -1
- package/SankeyChart/SankeyChart.js +30 -0
- package/SankeyChart/SankeyChart.plugins.d.ts +3 -2
- package/SankeyChart/SankeyChart.plugins.js +2 -1
- package/SankeyChart/SankeyLinkElement.d.ts +1 -1
- package/SankeyChart/SankeyLinkElement.js +15 -2
- package/SankeyChart/SankeyNodeElement.d.ts +1 -1
- package/SankeyChart/SankeyNodeElement.js +16 -1
- package/SankeyChart/SankeyPlot.js +13 -1
- package/SankeyChart/plugins/index.d.ts +3 -0
- package/SankeyChart/plugins/index.js +49 -0
- package/SankeyChart/plugins/useSankeyHighlight.d.ts +7 -0
- package/SankeyChart/plugins/useSankeyHighlight.js +76 -0
- package/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +68 -0
- package/SankeyChart/plugins/useSankeyHighlight.selectors.js +126 -0
- package/SankeyChart/plugins/useSankeyHighlight.types.d.ts +55 -0
- package/SankeyChart/plugins/useSankeyHighlight.types.js +5 -0
- package/SankeyChart/sankey.highlight.types.d.ts +42 -0
- package/SankeyChart/sankey.highlight.types.js +6 -0
- package/SankeyChart/sankey.types.d.ts +3 -2
- package/SankeyChart/sankeyClasses.d.ts +1 -1
- package/SankeyChart/useSankeyChartProps.js +5 -5
- package/ScatterChartPro/ScatterChartPro.js +49 -37
- package/esm/BarChartPro/BarChartPro.js +49 -37
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/esm/FunnelChart/funnelAxisPlugin/computeAxisValue.js +39 -37
- package/esm/Heatmap/Heatmap.js +0 -4
- package/esm/LineChartPro/LineChartPro.js +49 -37
- package/esm/SankeyChart/SankeyChart.d.ts +1 -1
- package/esm/SankeyChart/SankeyChart.js +30 -0
- package/esm/SankeyChart/SankeyChart.plugins.d.ts +3 -2
- package/esm/SankeyChart/SankeyChart.plugins.js +3 -4
- package/esm/SankeyChart/SankeyLinkElement.d.ts +1 -1
- package/esm/SankeyChart/SankeyLinkElement.js +16 -3
- package/esm/SankeyChart/SankeyNodeElement.d.ts +1 -1
- package/esm/SankeyChart/SankeyNodeElement.js +17 -2
- package/esm/SankeyChart/SankeyPlot.js +15 -3
- package/esm/SankeyChart/plugins/index.d.ts +3 -0
- package/esm/SankeyChart/plugins/index.js +3 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.d.ts +7 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.js +68 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +68 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.js +120 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.types.d.ts +55 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.types.js +1 -0
- package/esm/SankeyChart/sankey.highlight.types.d.ts +42 -0
- package/esm/SankeyChart/sankey.highlight.types.js +3 -0
- package/esm/SankeyChart/sankey.types.d.ts +3 -2
- package/esm/SankeyChart/sankeyClasses.d.ts +1 -1
- package/esm/SankeyChart/useSankeyChartProps.js +5 -5
- package/esm/ScatterChartPro/ScatterChartPro.js +49 -37
- package/esm/index.js +1 -1
- package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -6
- package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +5 -1
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +8 -0
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +73 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +2 -0
- package/index.js +1 -1
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -6
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +5 -1
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +8 -0
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +80 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.js +2 -0
- package/package.json +7 -7
|
@@ -324,8 +324,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
324
324
|
ignoreTooltip: _propTypes.default.bool,
|
|
325
325
|
label: _propTypes.default.string,
|
|
326
326
|
labelStyle: _propTypes.default.object,
|
|
327
|
-
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
328
|
-
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
329
327
|
offset: _propTypes.default.number,
|
|
330
328
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
331
329
|
reverse: _propTypes.default.bool,
|
|
@@ -393,8 +391,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
393
391
|
ignoreTooltip: _propTypes.default.bool,
|
|
394
392
|
label: _propTypes.default.string,
|
|
395
393
|
labelStyle: _propTypes.default.object,
|
|
396
|
-
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
397
|
-
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
398
394
|
offset: _propTypes.default.number,
|
|
399
395
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
400
396
|
reverse: _propTypes.default.bool,
|
|
@@ -452,8 +448,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
452
448
|
ignoreTooltip: _propTypes.default.bool,
|
|
453
449
|
label: _propTypes.default.string,
|
|
454
450
|
labelStyle: _propTypes.default.object,
|
|
455
|
-
max: _propTypes.default.
|
|
456
|
-
min: _propTypes.default.
|
|
451
|
+
max: _propTypes.default.number,
|
|
452
|
+
min: _propTypes.default.number,
|
|
457
453
|
offset: _propTypes.default.number,
|
|
458
454
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
459
455
|
reverse: _propTypes.default.bool,
|
|
@@ -512,8 +508,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
512
508
|
ignoreTooltip: _propTypes.default.bool,
|
|
513
509
|
label: _propTypes.default.string,
|
|
514
510
|
labelStyle: _propTypes.default.object,
|
|
515
|
-
max: _propTypes.default.
|
|
516
|
-
min: _propTypes.default.
|
|
511
|
+
max: _propTypes.default.number,
|
|
512
|
+
min: _propTypes.default.number,
|
|
517
513
|
offset: _propTypes.default.number,
|
|
518
514
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
519
515
|
reverse: _propTypes.default.bool,
|
|
@@ -571,8 +567,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
571
567
|
ignoreTooltip: _propTypes.default.bool,
|
|
572
568
|
label: _propTypes.default.string,
|
|
573
569
|
labelStyle: _propTypes.default.object,
|
|
574
|
-
max: _propTypes.default.
|
|
575
|
-
min: _propTypes.default.
|
|
570
|
+
max: _propTypes.default.number,
|
|
571
|
+
min: _propTypes.default.number,
|
|
576
572
|
offset: _propTypes.default.number,
|
|
577
573
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
578
574
|
reverse: _propTypes.default.bool,
|
|
@@ -630,8 +626,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
630
626
|
ignoreTooltip: _propTypes.default.bool,
|
|
631
627
|
label: _propTypes.default.string,
|
|
632
628
|
labelStyle: _propTypes.default.object,
|
|
633
|
-
max: _propTypes.default.
|
|
634
|
-
min: _propTypes.default.
|
|
629
|
+
max: _propTypes.default.number,
|
|
630
|
+
min: _propTypes.default.number,
|
|
635
631
|
offset: _propTypes.default.number,
|
|
636
632
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
637
633
|
reverse: _propTypes.default.bool,
|
|
@@ -689,8 +685,12 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
689
685
|
ignoreTooltip: _propTypes.default.bool,
|
|
690
686
|
label: _propTypes.default.string,
|
|
691
687
|
labelStyle: _propTypes.default.object,
|
|
692
|
-
max: _propTypes.default.oneOfType([_propTypes.default.
|
|
693
|
-
|
|
688
|
+
max: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
689
|
+
valueOf: _propTypes.default.func.isRequired
|
|
690
|
+
})]),
|
|
691
|
+
min: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
692
|
+
valueOf: _propTypes.default.func.isRequired
|
|
693
|
+
})]),
|
|
694
694
|
offset: _propTypes.default.number,
|
|
695
695
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
696
696
|
reverse: _propTypes.default.bool,
|
|
@@ -748,8 +748,12 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
748
748
|
ignoreTooltip: _propTypes.default.bool,
|
|
749
749
|
label: _propTypes.default.string,
|
|
750
750
|
labelStyle: _propTypes.default.object,
|
|
751
|
-
max: _propTypes.default.oneOfType([_propTypes.default.
|
|
752
|
-
|
|
751
|
+
max: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
752
|
+
valueOf: _propTypes.default.func.isRequired
|
|
753
|
+
})]),
|
|
754
|
+
min: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
755
|
+
valueOf: _propTypes.default.func.isRequired
|
|
756
|
+
})]),
|
|
753
757
|
offset: _propTypes.default.number,
|
|
754
758
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
755
759
|
reverse: _propTypes.default.bool,
|
|
@@ -807,8 +811,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
807
811
|
ignoreTooltip: _propTypes.default.bool,
|
|
808
812
|
label: _propTypes.default.string,
|
|
809
813
|
labelStyle: _propTypes.default.object,
|
|
810
|
-
max: _propTypes.default.
|
|
811
|
-
min: _propTypes.default.
|
|
814
|
+
max: _propTypes.default.number,
|
|
815
|
+
min: _propTypes.default.number,
|
|
812
816
|
offset: _propTypes.default.number,
|
|
813
817
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
814
818
|
reverse: _propTypes.default.bool,
|
|
@@ -883,8 +887,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
883
887
|
ignoreTooltip: _propTypes.default.bool,
|
|
884
888
|
label: _propTypes.default.string,
|
|
885
889
|
labelStyle: _propTypes.default.object,
|
|
886
|
-
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
887
|
-
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
888
890
|
offset: _propTypes.default.number,
|
|
889
891
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
890
892
|
reverse: _propTypes.default.bool,
|
|
@@ -951,8 +953,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
951
953
|
ignoreTooltip: _propTypes.default.bool,
|
|
952
954
|
label: _propTypes.default.string,
|
|
953
955
|
labelStyle: _propTypes.default.object,
|
|
954
|
-
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
955
|
-
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
956
956
|
offset: _propTypes.default.number,
|
|
957
957
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
958
958
|
reverse: _propTypes.default.bool,
|
|
@@ -1009,8 +1009,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1009
1009
|
ignoreTooltip: _propTypes.default.bool,
|
|
1010
1010
|
label: _propTypes.default.string,
|
|
1011
1011
|
labelStyle: _propTypes.default.object,
|
|
1012
|
-
max: _propTypes.default.
|
|
1013
|
-
min: _propTypes.default.
|
|
1012
|
+
max: _propTypes.default.number,
|
|
1013
|
+
min: _propTypes.default.number,
|
|
1014
1014
|
offset: _propTypes.default.number,
|
|
1015
1015
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1016
1016
|
reverse: _propTypes.default.bool,
|
|
@@ -1068,8 +1068,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1068
1068
|
ignoreTooltip: _propTypes.default.bool,
|
|
1069
1069
|
label: _propTypes.default.string,
|
|
1070
1070
|
labelStyle: _propTypes.default.object,
|
|
1071
|
-
max: _propTypes.default.
|
|
1072
|
-
min: _propTypes.default.
|
|
1071
|
+
max: _propTypes.default.number,
|
|
1072
|
+
min: _propTypes.default.number,
|
|
1073
1073
|
offset: _propTypes.default.number,
|
|
1074
1074
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1075
1075
|
reverse: _propTypes.default.bool,
|
|
@@ -1126,8 +1126,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1126
1126
|
ignoreTooltip: _propTypes.default.bool,
|
|
1127
1127
|
label: _propTypes.default.string,
|
|
1128
1128
|
labelStyle: _propTypes.default.object,
|
|
1129
|
-
max: _propTypes.default.
|
|
1130
|
-
min: _propTypes.default.
|
|
1129
|
+
max: _propTypes.default.number,
|
|
1130
|
+
min: _propTypes.default.number,
|
|
1131
1131
|
offset: _propTypes.default.number,
|
|
1132
1132
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1133
1133
|
reverse: _propTypes.default.bool,
|
|
@@ -1184,8 +1184,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1184
1184
|
ignoreTooltip: _propTypes.default.bool,
|
|
1185
1185
|
label: _propTypes.default.string,
|
|
1186
1186
|
labelStyle: _propTypes.default.object,
|
|
1187
|
-
max: _propTypes.default.
|
|
1188
|
-
min: _propTypes.default.
|
|
1187
|
+
max: _propTypes.default.number,
|
|
1188
|
+
min: _propTypes.default.number,
|
|
1189
1189
|
offset: _propTypes.default.number,
|
|
1190
1190
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1191
1191
|
reverse: _propTypes.default.bool,
|
|
@@ -1242,8 +1242,12 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1242
1242
|
ignoreTooltip: _propTypes.default.bool,
|
|
1243
1243
|
label: _propTypes.default.string,
|
|
1244
1244
|
labelStyle: _propTypes.default.object,
|
|
1245
|
-
max: _propTypes.default.oneOfType([_propTypes.default.
|
|
1246
|
-
|
|
1245
|
+
max: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
1246
|
+
valueOf: _propTypes.default.func.isRequired
|
|
1247
|
+
})]),
|
|
1248
|
+
min: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
1249
|
+
valueOf: _propTypes.default.func.isRequired
|
|
1250
|
+
})]),
|
|
1247
1251
|
offset: _propTypes.default.number,
|
|
1248
1252
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1249
1253
|
reverse: _propTypes.default.bool,
|
|
@@ -1300,8 +1304,12 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1300
1304
|
ignoreTooltip: _propTypes.default.bool,
|
|
1301
1305
|
label: _propTypes.default.string,
|
|
1302
1306
|
labelStyle: _propTypes.default.object,
|
|
1303
|
-
max: _propTypes.default.oneOfType([_propTypes.default.
|
|
1304
|
-
|
|
1307
|
+
max: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
1308
|
+
valueOf: _propTypes.default.func.isRequired
|
|
1309
|
+
})]),
|
|
1310
|
+
min: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
1311
|
+
valueOf: _propTypes.default.func.isRequired
|
|
1312
|
+
})]),
|
|
1305
1313
|
offset: _propTypes.default.number,
|
|
1306
1314
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1307
1315
|
reverse: _propTypes.default.bool,
|
|
@@ -1358,8 +1366,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1358
1366
|
ignoreTooltip: _propTypes.default.bool,
|
|
1359
1367
|
label: _propTypes.default.string,
|
|
1360
1368
|
labelStyle: _propTypes.default.object,
|
|
1361
|
-
max: _propTypes.default.
|
|
1362
|
-
min: _propTypes.default.
|
|
1369
|
+
max: _propTypes.default.number,
|
|
1370
|
+
min: _propTypes.default.number,
|
|
1363
1371
|
offset: _propTypes.default.number,
|
|
1364
1372
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1365
1373
|
reverse: _propTypes.default.bool,
|
|
@@ -1431,10 +1439,14 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1431
1439
|
* Configuration for zoom interactions.
|
|
1432
1440
|
*/
|
|
1433
1441
|
zoomInteractionConfig: _propTypes.default.shape({
|
|
1434
|
-
pan: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf(['drag']), _propTypes.default.shape({
|
|
1442
|
+
pan: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf(['drag', 'pressAndDrag']), _propTypes.default.shape({
|
|
1435
1443
|
pointerMode: _propTypes.default.oneOf(['mouse', 'touch']),
|
|
1436
1444
|
requiredKeys: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
1437
1445
|
type: _propTypes.default.oneOf(['drag']).isRequired
|
|
1446
|
+
}), _propTypes.default.shape({
|
|
1447
|
+
pointerMode: _propTypes.default.oneOf(['mouse', 'touch']),
|
|
1448
|
+
requiredKeys: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
1449
|
+
type: _propTypes.default.oneOf(['pressAndDrag']).isRequired
|
|
1438
1450
|
})]).isRequired),
|
|
1439
1451
|
zoom: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf(['pinch', 'tapAndDrag', 'wheel']), _propTypes.default.shape({
|
|
1440
1452
|
pointerMode: _propTypes.default.any,
|
|
@@ -7,7 +7,7 @@ import { type SankeyChartPluginSignatures } from "./SankeyChart.plugins.js";
|
|
|
7
7
|
import type { SankeySeriesType } from "./sankey.types.js";
|
|
8
8
|
import type { SankeyChartSlotExtension } from "./sankeySlots.types.js";
|
|
9
9
|
export type SankeySeries = MakeOptional<SankeySeriesType, 'type'>;
|
|
10
|
-
export interface SankeyChartProps extends Omit<ChartContainerProProps<'sankey', SankeyChartPluginSignatures>, 'plugins' | 'series' | 'slotProps' | 'slots' | 'dataset' | 'hideLegend' | 'skipAnimation'
|
|
10
|
+
export interface SankeyChartProps extends Omit<ChartContainerProProps<'sankey', SankeyChartPluginSignatures>, 'plugins' | 'series' | 'slotProps' | 'slots' | 'dataset' | 'hideLegend' | 'skipAnimation'>, Omit<SankeyPlotProps, 'data'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, SankeyChartSlotExtension {
|
|
11
11
|
/**
|
|
12
12
|
* The series to display in the Sankey chart.
|
|
13
13
|
* A single object is expected.
|
|
@@ -101,6 +101,30 @@ process.env.NODE_ENV !== "production" ? SankeyChart.propTypes = {
|
|
|
101
101
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
102
102
|
*/
|
|
103
103
|
height: _propTypes.default.number,
|
|
104
|
+
/**
|
|
105
|
+
* The highlighted item.
|
|
106
|
+
* Used when the highlight is controlled.
|
|
107
|
+
*/
|
|
108
|
+
highlightedItem: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
109
|
+
nodeId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
110
|
+
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
111
|
+
subType: _propTypes.default.oneOf([
|
|
112
|
+
/**
|
|
113
|
+
* Subtype to differentiate between node and link
|
|
114
|
+
*/
|
|
115
|
+
'node']).isRequired,
|
|
116
|
+
type: _propTypes.default.oneOf(['sankey']).isRequired
|
|
117
|
+
}), _propTypes.default.shape({
|
|
118
|
+
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
119
|
+
sourceId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
120
|
+
subType: _propTypes.default.oneOf([
|
|
121
|
+
/**
|
|
122
|
+
* Subtype to differentiate between node and link
|
|
123
|
+
*/
|
|
124
|
+
'link']).isRequired,
|
|
125
|
+
targetId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
126
|
+
type: _propTypes.default.oneOf(['sankey']).isRequired
|
|
127
|
+
})]),
|
|
104
128
|
/**
|
|
105
129
|
* This prop is used to help implement the accessibility logic.
|
|
106
130
|
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
@@ -127,6 +151,12 @@ process.env.NODE_ENV !== "production" ? SankeyChart.propTypes = {
|
|
|
127
151
|
right: _propTypes.default.number,
|
|
128
152
|
top: _propTypes.default.number
|
|
129
153
|
})]),
|
|
154
|
+
/**
|
|
155
|
+
* The callback fired when the highlighted item changes.
|
|
156
|
+
*
|
|
157
|
+
* @param {SankeyHighlightItemData | null} highlightedItem The newly highlighted item.
|
|
158
|
+
*/
|
|
159
|
+
onHighlightChange: _propTypes.default.func,
|
|
130
160
|
/**
|
|
131
161
|
* Callback fired when a sankey item is clicked.
|
|
132
162
|
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ConvertSignaturesIntoPlugins,
|
|
1
|
+
import { ConvertSignaturesIntoPlugins, UseChartInteractionSignature } from '@mui/x-charts/internals';
|
|
2
2
|
import { UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
|
|
3
|
-
|
|
3
|
+
import { type UseSankeyHighlightSignature } from "./plugins/index.js";
|
|
4
|
+
export type SankeyChartPluginSignatures = [UseChartInteractionSignature, UseSankeyHighlightSignature, UseChartProExportSignature];
|
|
4
5
|
export declare const SANKEY_CHART_PLUGINS: ConvertSignaturesIntoPlugins<SankeyChartPluginSignatures>;
|
|
@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.SANKEY_CHART_PLUGINS = void 0;
|
|
7
7
|
var _internals = require("@mui/x-charts/internals");
|
|
8
8
|
var _useChartProExport = require("../internals/plugins/useChartProExport");
|
|
9
|
-
|
|
9
|
+
var _plugins = require("./plugins");
|
|
10
|
+
const SANKEY_CHART_PLUGINS = exports.SANKEY_CHART_PLUGINS = [_internals.useChartInteraction, _plugins.useSankeyHighlight, _useChartProExport.useChartProExport];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { SeriesId } from '@mui/x-charts/internals';
|
|
3
|
-
import { SankeyLayoutLink,
|
|
3
|
+
import type { SankeyLayoutLink, SankeyLinkIdentifierWithData } from "./sankey.types.js";
|
|
4
4
|
export interface SankeyLinkElementProps {
|
|
5
5
|
/**
|
|
6
6
|
* The series ID to which the link belongs
|
|
@@ -11,6 +11,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
13
13
|
var _internals = require("@mui/x-charts/internals");
|
|
14
|
+
var _plugins = require("./plugins");
|
|
15
|
+
var _useSankeyHighlight = require("./plugins/useSankeyHighlight.selectors");
|
|
14
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
17
|
/**
|
|
16
18
|
* @ignore - internal component.
|
|
@@ -22,6 +24,7 @@ const SankeyLinkElement = exports.SankeyLinkElement = /*#__PURE__*/React.forward
|
|
|
22
24
|
onClick,
|
|
23
25
|
seriesId
|
|
24
26
|
} = props;
|
|
27
|
+
const store = (0, _internals.useStore)();
|
|
25
28
|
const identifier = {
|
|
26
29
|
type: 'sankey',
|
|
27
30
|
seriesId,
|
|
@@ -30,6 +33,8 @@ const SankeyLinkElement = exports.SankeyLinkElement = /*#__PURE__*/React.forward
|
|
|
30
33
|
sourceId: link.source.id,
|
|
31
34
|
link
|
|
32
35
|
};
|
|
36
|
+
const isHighlighted = (0, _internals.useSelector)(store, _plugins.selectorIsLinkHighlighted, [link]);
|
|
37
|
+
const isFaded = (0, _internals.useSelector)(store, _useSankeyHighlight.selectorIsSankeyItemFaded, [isHighlighted]);
|
|
33
38
|
|
|
34
39
|
// Add interaction props for tooltips
|
|
35
40
|
const interactionProps = (0, _internals.useInteractionItemProps)(identifier);
|
|
@@ -37,15 +42,23 @@ const SankeyLinkElement = exports.SankeyLinkElement = /*#__PURE__*/React.forward
|
|
|
37
42
|
onClick?.(event, identifier);
|
|
38
43
|
});
|
|
39
44
|
if (!link.path) {
|
|
40
|
-
return null;
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
let finalOpacity = opacity;
|
|
48
|
+
if (isFaded) {
|
|
49
|
+
finalOpacity = opacity * 0.3;
|
|
50
|
+
} else if (isHighlighted) {
|
|
51
|
+
finalOpacity = Math.min(opacity * 1.2, 1);
|
|
41
52
|
}
|
|
42
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
|
|
43
54
|
ref: ref,
|
|
44
55
|
d: link.path,
|
|
45
56
|
fill: link.color,
|
|
46
|
-
opacity:
|
|
57
|
+
opacity: finalOpacity,
|
|
47
58
|
"data-link-source": link.source.id,
|
|
48
59
|
"data-link-target": link.target.id,
|
|
60
|
+
"data-highlighted": isHighlighted || undefined,
|
|
61
|
+
"data-faded": isFaded || undefined,
|
|
49
62
|
onClick: onClick ? handleClick : undefined,
|
|
50
63
|
cursor: onClick ? 'pointer' : 'default'
|
|
51
64
|
}, interactionProps));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { SeriesId } from '@mui/x-charts/internals';
|
|
3
|
-
import { SankeyLayoutNode,
|
|
3
|
+
import type { SankeyLayoutNode, SankeyNodeIdentifierWithData } from "./sankey.types.js";
|
|
4
4
|
export interface SankeyNodeElementProps {
|
|
5
5
|
/**
|
|
6
6
|
* The series ID to which the node belongs
|
|
@@ -12,6 +12,8 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
13
13
|
var _internals = require("@mui/x-charts/internals");
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _plugins = require("./plugins");
|
|
16
|
+
var _useSankeyHighlight = require("./plugins/useSankeyHighlight.selectors");
|
|
15
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
18
|
/**
|
|
17
19
|
* @ignore - internal component.
|
|
@@ -24,6 +26,7 @@ const SankeyNodeElement = exports.SankeyNodeElement = /*#__PURE__*/React.forward
|
|
|
24
26
|
seriesId
|
|
25
27
|
} = props;
|
|
26
28
|
const theme = (0, _styles.useTheme)();
|
|
29
|
+
const store = (0, _internals.useStore)();
|
|
27
30
|
const x0 = node.x0 ?? 0;
|
|
28
31
|
const y0 = node.y0 ?? 0;
|
|
29
32
|
const x1 = node.x1 ?? 0;
|
|
@@ -43,12 +46,20 @@ const SankeyNodeElement = exports.SankeyNodeElement = /*#__PURE__*/React.forward
|
|
|
43
46
|
nodeId: node.id,
|
|
44
47
|
node
|
|
45
48
|
};
|
|
49
|
+
const isHighlighted = (0, _internals.useSelector)(store, _plugins.selectorIsNodeHighlighted, [node]);
|
|
50
|
+
const isFaded = (0, _internals.useSelector)(store, _useSankeyHighlight.selectorIsSankeyItemFaded, [isHighlighted]);
|
|
46
51
|
|
|
47
52
|
// Add interaction props for tooltips
|
|
48
53
|
const interactionProps = (0, _internals.useInteractionItemProps)(identifier);
|
|
49
54
|
const handleClick = (0, _useEventCallback.default)(event => {
|
|
50
55
|
onClick?.(event, identifier);
|
|
51
56
|
});
|
|
57
|
+
let opacity = 1;
|
|
58
|
+
if (isFaded) {
|
|
59
|
+
opacity = 0.3;
|
|
60
|
+
} else if (isHighlighted) {
|
|
61
|
+
opacity = 1;
|
|
62
|
+
}
|
|
52
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
53
64
|
ref: ref,
|
|
54
65
|
"data-node": node.id,
|
|
@@ -58,9 +69,12 @@ const SankeyNodeElement = exports.SankeyNodeElement = /*#__PURE__*/React.forward
|
|
|
58
69
|
width: nodeWidth,
|
|
59
70
|
height: nodeHeight,
|
|
60
71
|
fill: node.color,
|
|
72
|
+
opacity: opacity,
|
|
61
73
|
onClick: onClick ? handleClick : undefined,
|
|
62
74
|
cursor: onClick ? 'pointer' : 'default',
|
|
63
|
-
stroke: "none"
|
|
75
|
+
stroke: "none",
|
|
76
|
+
"data-highlighted": isHighlighted || undefined,
|
|
77
|
+
"data-faded": isFaded || undefined
|
|
64
78
|
}, interactionProps)), showLabel && node.label && /*#__PURE__*/(0, _jsxRuntime.jsx)("text", {
|
|
65
79
|
x: labelX,
|
|
66
80
|
y: (y0 + y1) / 2,
|
|
@@ -69,6 +83,7 @@ const SankeyNodeElement = exports.SankeyNodeElement = /*#__PURE__*/React.forward
|
|
|
69
83
|
fontSize: theme.typography.caption.fontSize,
|
|
70
84
|
fontFamily: theme.typography.fontFamily,
|
|
71
85
|
pointerEvents: "none",
|
|
86
|
+
opacity: opacity,
|
|
72
87
|
children: node.label
|
|
73
88
|
})]
|
|
74
89
|
});
|
|
@@ -18,6 +18,18 @@ var _SankeyLinkLabel = require("./SankeyLinkLabel");
|
|
|
18
18
|
var _useSankeySeries = require("../hooks/useSankeySeries");
|
|
19
19
|
var _sankeyClasses = require("./sankeyClasses");
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
const SankeyPlotRoot = (0, _styles.styled)('g')({
|
|
22
|
+
[`.${_sankeyClasses.sankeyPlotClasses.links} path, .${_sankeyClasses.sankeyPlotClasses.nodes} rect`]: {
|
|
23
|
+
transition: 'opacity 0.1s ease-out, filter 0.1s ease-out'
|
|
24
|
+
},
|
|
25
|
+
'& [data-faded=true]': {
|
|
26
|
+
filter: 'saturate(80%)'
|
|
27
|
+
},
|
|
28
|
+
'& [data-highlighted=true]': {
|
|
29
|
+
filter: 'saturate(120%)'
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
21
33
|
/**
|
|
22
34
|
* Renders a Sankey diagram plot.
|
|
23
35
|
*/
|
|
@@ -50,7 +62,7 @@ function SankeyPlot(props) {
|
|
|
50
62
|
if (!data || !data.links) {
|
|
51
63
|
return null;
|
|
52
64
|
}
|
|
53
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
65
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(SankeyPlotRoot, {
|
|
54
66
|
className: classes.root,
|
|
55
67
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
56
68
|
className: classes.links,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
useSankeyHighlight: true,
|
|
8
|
+
selectorIsFaded: true,
|
|
9
|
+
selectorIsLinkHighlighted: true,
|
|
10
|
+
selectorIsNodeHighlighted: true
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "selectorIsFaded", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _useSankeyHighlight3.selectorIsSankeyItemFaded;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "selectorIsLinkHighlighted", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _useSankeyHighlight3.selectorIsLinkHighlighted;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "selectorIsNodeHighlighted", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _useSankeyHighlight3.selectorIsNodeHighlighted;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "useSankeyHighlight", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _useSankeyHighlight.useSankeyHighlight;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var _useSankeyHighlight = require("./useSankeyHighlight");
|
|
37
|
+
var _useSankeyHighlight2 = require("./useSankeyHighlight.types");
|
|
38
|
+
Object.keys(_useSankeyHighlight2).forEach(function (key) {
|
|
39
|
+
if (key === "default" || key === "__esModule") return;
|
|
40
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
41
|
+
if (key in exports && exports[key] === _useSankeyHighlight2[key]) return;
|
|
42
|
+
Object.defineProperty(exports, key, {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _useSankeyHighlight2[key];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
var _useSankeyHighlight3 = require("./useSankeyHighlight.selectors");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChartPlugin } from '@mui/x-charts/internals';
|
|
2
|
+
import type { UseSankeyHighlightSignature } from "./useSankeyHighlight.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Custom highlight plugin for Sankey charts that uses SankeyItemIdentifier
|
|
5
|
+
* instead of the standard HighlightItemData.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useSankeyHighlight: ChartPlugin<UseSankeyHighlightSignature>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useSankeyHighlight = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _useAssertModelConsistency = require("@mui/x-internals/useAssertModelConsistency");
|
|
10
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
11
|
+
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
12
|
+
var _fastObjectShallowCompare = require("@mui/x-internals/fastObjectShallowCompare");
|
|
13
|
+
/**
|
|
14
|
+
* Custom highlight plugin for Sankey charts that uses SankeyItemIdentifier
|
|
15
|
+
* instead of the standard HighlightItemData.
|
|
16
|
+
*/
|
|
17
|
+
const useSankeyHighlight = ({
|
|
18
|
+
store,
|
|
19
|
+
params
|
|
20
|
+
}) => {
|
|
21
|
+
(0, _useAssertModelConsistency.useAssertModelConsistency)({
|
|
22
|
+
warningPrefix: 'MUI X Charts',
|
|
23
|
+
componentName: 'SankeyChart',
|
|
24
|
+
propName: 'highlightedItem',
|
|
25
|
+
controlled: params.highlightedItem,
|
|
26
|
+
defaultValue: null
|
|
27
|
+
});
|
|
28
|
+
(0, _useEnhancedEffect.default)(() => {
|
|
29
|
+
store.update(prevState => prevState.highlight.item === params.highlightedItem ? prevState : (0, _extends2.default)({}, prevState, {
|
|
30
|
+
highlight: (0, _extends2.default)({}, prevState.highlight, {
|
|
31
|
+
item: params.highlightedItem
|
|
32
|
+
})
|
|
33
|
+
}));
|
|
34
|
+
}, [store, params.highlightedItem]);
|
|
35
|
+
const clearHighlight = (0, _useEventCallback.default)(() => {
|
|
36
|
+
params.onHighlightChange?.(null);
|
|
37
|
+
store.update(prev => (0, _extends2.default)({}, prev, {
|
|
38
|
+
highlight: {
|
|
39
|
+
item: null
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
});
|
|
43
|
+
const setHighlight = (0, _useEventCallback.default)(newItem => {
|
|
44
|
+
const prevItem = store.getSnapshot().highlight.item;
|
|
45
|
+
if ((0, _fastObjectShallowCompare.fastObjectShallowCompare)(prevItem, newItem)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
params.onHighlightChange?.(newItem);
|
|
49
|
+
store.update(prev => (0, _extends2.default)({}, prev, {
|
|
50
|
+
highlight: {
|
|
51
|
+
item: newItem
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
instance: {
|
|
57
|
+
clearHighlight,
|
|
58
|
+
setHighlight
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
exports.useSankeyHighlight = useSankeyHighlight;
|
|
63
|
+
useSankeyHighlight.getDefaultizedParams = ({
|
|
64
|
+
params
|
|
65
|
+
}) => (0, _extends2.default)({}, params, {
|
|
66
|
+
highlightedItem: params.highlightedItem ?? null
|
|
67
|
+
});
|
|
68
|
+
useSankeyHighlight.getInitialState = params => ({
|
|
69
|
+
highlight: {
|
|
70
|
+
item: params.highlightedItem
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
useSankeyHighlight.params = {
|
|
74
|
+
highlightedItem: true,
|
|
75
|
+
onHighlightChange: true
|
|
76
|
+
};
|