@spteck/fluentui-react-charts 1.1.2 → 1.1.4
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/dist/charts/BarChart/BarChart.d.ts +4 -1
- package/dist/charts/ComboChart/ComboChart.d.ts +4 -1
- package/dist/charts/Doughnut/DoughnutChart.d.ts +4 -1
- package/dist/charts/PieChart/PieChart.d.ts +4 -1
- package/dist/charts/areaChart/AreaChart.d.ts +4 -1
- package/dist/charts/barHorizontalChart/BarHotizontalChart.d.ts +4 -1
- package/dist/charts/bubbleChart/BubbleChart.d.ts +4 -1
- package/dist/charts/floatBarChart/FloatBarChart.d.ts +4 -1
- package/dist/charts/index.d.ts +1 -0
- package/dist/charts/lineChart/LineChart.d.ts +4 -1
- package/dist/charts/polarChart/PolarChart.d.ts +4 -1
- package/dist/charts/radarChart/RadarChart.d.ts +4 -1
- package/dist/charts/scatterChart/ScatterChart.d.ts +4 -1
- package/dist/charts/stackedLineChart/StackedLineChart.d.ts +4 -1
- package/dist/charts/steamChart/SteamChart.d.ts +4 -1
- package/dist/constants/palettes.d.ts +8 -0
- package/dist/fluentui-react-charts.cjs.development.js +200 -79
- package/dist/fluentui-react-charts.cjs.development.js.map +1 -1
- package/dist/fluentui-react-charts.cjs.production.min.js +1 -1
- package/dist/fluentui-react-charts.cjs.production.min.js.map +1 -1
- package/dist/fluentui-react-charts.esm.js +200 -79
- package/dist/fluentui-react-charts.esm.js.map +1 -1
- package/dist/hooks/useChartUtils.d.ts +6 -4
- package/dist/models/IChart.d.ts +3 -0
- package/package.json +1 -1
|
@@ -769,6 +769,33 @@ function LegendContainer(props) {
|
|
|
769
769
|
}))))));
|
|
770
770
|
}
|
|
771
771
|
|
|
772
|
+
var paletteDark4 = ['#F87171', '#FB923C', '#FDE047', '#86EFAC', '#7DD3FC', '#C084FC', '#F9A8D4', '#FED7AA' // Peach
|
|
773
|
+
];
|
|
774
|
+
var paletteLight4 = ['#DC2626', '#EA580C', '#EAB308', '#16A34A', '#0284C7', '#9333EA', '#DB2777', '#C2410C' // Peach
|
|
775
|
+
];
|
|
776
|
+
var paletteDark3 = ['#60A5FA', '#34D399', '#FBBF24', '#F472B6', '#A78BFA', '#FB923C', '#2DD4BF', '#FB7185' // Rose
|
|
777
|
+
];
|
|
778
|
+
var paletteLight3 = ['#2563EB', '#059669', '#D97706', '#DB2777', '#7C3AED', '#EA580C', '#0D9488', '#E11D48' // Rose
|
|
779
|
+
];
|
|
780
|
+
var paletteLight1 = ['#289CEF', '#f05075ff', '#45B0A2', '#a4262c', '#F49E31', '#A366FF', '#FCCE51', '#062843ff', '#7f7f82ff', '#376102ff', '#4e79a7'];
|
|
781
|
+
var paletteLight2 = ['#f28e2c', '#e15759', '#76b7b2', '#59a14f', '#edc949', '#af7aa1', '#ff9da7', '#9c755f', '#bab0ab', '#8cd17d', '#b6992d', '#d37295', '#fabfd2', '#79706e'];
|
|
782
|
+
var paletteDark1 = ['#2899f5', '#ff8c00', '#32cd32', '#f06b71', '#c390f2', '#00b7c3', '#ffb900', '#b4a0ff', '#60cdff', '#92c353'];
|
|
783
|
+
var paletteDark2 = /*#__PURE__*/[].concat(paletteLight2);
|
|
784
|
+
|
|
785
|
+
var getPalleteById = function getPalleteById(id, isDark) {
|
|
786
|
+
switch (id) {
|
|
787
|
+
case 1:
|
|
788
|
+
return isDark ? paletteDark1 : paletteLight1;
|
|
789
|
+
case 2:
|
|
790
|
+
return isDark ? paletteDark2 : paletteLight2;
|
|
791
|
+
case 3:
|
|
792
|
+
return isDark ? paletteDark3 : paletteLight3;
|
|
793
|
+
case 4:
|
|
794
|
+
return isDark ? paletteDark4 : paletteLight4;
|
|
795
|
+
default:
|
|
796
|
+
return isDark ? paletteDark1 : paletteLight1;
|
|
797
|
+
}
|
|
798
|
+
};
|
|
772
799
|
/**
|
|
773
800
|
* Lightens a given hex color by a percentage amount (0 to 1).
|
|
774
801
|
*/
|
|
@@ -786,21 +813,10 @@ var lightenColor = function lightenColor(hex, amount) {
|
|
|
786
813
|
};
|
|
787
814
|
return "#" + toHex(r) + toHex(g) + toHex(b);
|
|
788
815
|
};
|
|
789
|
-
var getFluentPalette = function getFluentPalette(theme) {
|
|
816
|
+
var getFluentPalette = function getFluentPalette(theme, paletteId) {
|
|
790
817
|
// Check if theme is dark by looking at global color tokens
|
|
791
818
|
var isDark = theme.colorNeutralBackground1.startsWith('#1') || theme.colorNeutralBackground1 === '#000000';
|
|
792
|
-
return
|
|
793
|
-
/* '#289CEF', // Communication Blue
|
|
794
|
-
'#f05075ff', // Deep Orange
|
|
795
|
-
'#45B0A2', // **DARK FOREST GREEN** (New)
|
|
796
|
-
'#a4262c', // Dark Red
|
|
797
|
-
'#F49E31', // Rich Purple
|
|
798
|
-
'#A366FF', // **DARK TEAL/PINE** (New)
|
|
799
|
-
'#FCCE51', // Berry
|
|
800
|
-
'#062843ff', // Navy
|
|
801
|
-
'#7f7f82ff', // Orchid
|
|
802
|
-
'#376102ff', // Moss Green (Darker than original) */
|
|
803
|
-
'#4e79a7', '#f28e2c', '#e15759', '#76b7b2', '#59a14f', '#edc949', '#af7aa1', '#ff9da7', '#9c755f', '#bab0ab', '#8cd17d', '#b6992d', '#d37295', '#fabfd2', '#79706e'];
|
|
819
|
+
return getPalleteById(paletteId != null ? paletteId : 1, isDark);
|
|
804
820
|
};
|
|
805
821
|
/**
|
|
806
822
|
* Returns animation configuration for instant interactions.
|
|
@@ -822,7 +838,12 @@ var getInstantInteractionAnimations = function getInstantInteractionAnimations()
|
|
|
822
838
|
* Smart Fluent tooltip generator with chart-type awareness.
|
|
823
839
|
* Optimized for fast performance with reduced animation delays.
|
|
824
840
|
*/
|
|
825
|
-
function createFluentTooltip(theme
|
|
841
|
+
function createFluentTooltip(theme,
|
|
842
|
+
// optional options: allow a global extraField (string or function) that will be
|
|
843
|
+
// appended to the default label. If a dataset supplies `extraField` (string or
|
|
844
|
+
// array indexed by data point) that value will be used instead of the global
|
|
845
|
+
// option. Example: value (x%) where x% is the extraField value.
|
|
846
|
+
opts) {
|
|
826
847
|
var fontFamily = theme.fontFamilyBase;
|
|
827
848
|
var fontSize = parseInt(theme.fontSizeBase200.replace('px', '')) || 14;
|
|
828
849
|
var tooltipBg = theme.colorNeutralBackground1;
|
|
@@ -835,29 +856,45 @@ function createFluentTooltip(theme) {
|
|
|
835
856
|
return (_context$0$label = (_context$ = context[0]) == null ? void 0 : _context$.label) != null ? _context$0$label : '';
|
|
836
857
|
},
|
|
837
858
|
label: function label(item) {
|
|
838
|
-
var
|
|
859
|
+
var dataset = item.dataset;
|
|
860
|
+
var datasetLabel = 'label' in dataset && typeof dataset.label === 'string' ? dataset.label : 'Value';
|
|
839
861
|
var raw = item.raw;
|
|
862
|
+
// determine extraField value, precedence: dataset.extraField > opts.extraField
|
|
863
|
+
var extra;
|
|
864
|
+
if (dataset && dataset.extraField !== undefined) {
|
|
865
|
+
var _item$dataIndex;
|
|
866
|
+
var ef = dataset.extraField;
|
|
867
|
+
// dataset extraField can be array (per-data) or single value
|
|
868
|
+
if (Array.isArray(ef)) extra = ef[(_item$dataIndex = item.dataIndex) != null ? _item$dataIndex : 0];else extra = ef;
|
|
869
|
+
} else if (opts && opts.extraField) {
|
|
870
|
+
if (typeof opts.extraField === 'function') {
|
|
871
|
+
extra = opts.extraField(item);
|
|
872
|
+
} else {
|
|
873
|
+
extra = opts.extraField;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
var suffix = extra !== undefined && extra !== null ? " (" + String(extra) + ")" : '';
|
|
840
877
|
// Bubble format { x, y, r }
|
|
841
878
|
if (typeof raw === 'object' && raw !== null && 'x' in raw && 'y' in raw && 'r' in raw) {
|
|
842
879
|
var x = raw.x,
|
|
843
880
|
y = raw.y,
|
|
844
881
|
r = raw.r;
|
|
845
|
-
return datasetLabel + " \u2014 x: " + x + ", y: " + y + ", r: " + r;
|
|
882
|
+
return datasetLabel + " \u2014 x: " + x + ", y: " + y + ", r: " + r + suffix;
|
|
846
883
|
}
|
|
847
884
|
// Scatter format { x, y }
|
|
848
885
|
if (typeof raw === 'object' && raw !== null && 'x' in raw && 'y' in raw) {
|
|
849
886
|
var _x = raw.x,
|
|
850
887
|
_y = raw.y;
|
|
851
|
-
return datasetLabel + " \u2014 x: " + _x + ", y: " + _y;
|
|
888
|
+
return datasetLabel + " \u2014 x: " + _x + ", y: " + _y + suffix;
|
|
852
889
|
}
|
|
853
890
|
// Floating bar [min, max]
|
|
854
891
|
if (Array.isArray(raw) && raw.length === 2) {
|
|
855
892
|
var min = raw[0],
|
|
856
893
|
max = raw[1];
|
|
857
|
-
return datasetLabel + ": " + min + " \u2013 " + max;
|
|
894
|
+
return datasetLabel + ": " + min + " \u2013 " + max + suffix;
|
|
858
895
|
}
|
|
859
896
|
// Default: single number or string
|
|
860
|
-
return datasetLabel + ": " + raw;
|
|
897
|
+
return datasetLabel + ": " + raw + suffix;
|
|
861
898
|
},
|
|
862
899
|
beforeTitle: function beforeTitle() {
|
|
863
900
|
return '';
|
|
@@ -879,13 +916,13 @@ function createFluentTooltip(theme) {
|
|
|
879
916
|
},
|
|
880
917
|
// Provide sensible defaults for tooltip label colors using dataset colors when available
|
|
881
918
|
labelColor: function labelColor(item) {
|
|
882
|
-
var _item$
|
|
919
|
+
var _item$dataIndex2, _item$dataIndex3, _ref, _ref2;
|
|
883
920
|
var ds = item.dataset || {};
|
|
884
921
|
// dataset colors can be a single value or an array per data point
|
|
885
922
|
var bg = ds.backgroundColor;
|
|
886
|
-
if (Array.isArray(bg)) bg = bg[(_item$
|
|
923
|
+
if (Array.isArray(bg)) bg = bg[(_item$dataIndex2 = item.dataIndex) != null ? _item$dataIndex2 : 0];
|
|
887
924
|
var border = ds.borderColor;
|
|
888
|
-
if (Array.isArray(border)) border = border[(_item$
|
|
925
|
+
if (Array.isArray(border)) border = border[(_item$dataIndex3 = item.dataIndex) != null ? _item$dataIndex3 : 0];
|
|
889
926
|
var backgroundColor = (_ref = bg != null ? bg : ds.pointBackgroundColor) != null ? _ref : tooltipBg;
|
|
890
927
|
var borderColorOut = (_ref2 = border != null ? border : ds.pointBorderColor) != null ? _ref2 : borderColor;
|
|
891
928
|
return {
|
|
@@ -1070,7 +1107,10 @@ function AreaChart(_ref) {
|
|
|
1070
1107
|
_ref$theme = _ref.theme,
|
|
1071
1108
|
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
1072
1109
|
_ref$stacked = _ref.stacked,
|
|
1073
|
-
stacked = _ref$stacked === void 0 ? false : _ref$stacked
|
|
1110
|
+
stacked = _ref$stacked === void 0 ? false : _ref$stacked,
|
|
1111
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
1112
|
+
_ref$paletteId = _ref.paletteId,
|
|
1113
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
1074
1114
|
var _useState = React.useState(function () {
|
|
1075
1115
|
var _data$;
|
|
1076
1116
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -1086,13 +1126,14 @@ function AreaChart(_ref) {
|
|
|
1086
1126
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1087
1127
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1088
1128
|
var seriesColors = React.useMemo(function () {
|
|
1129
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
1089
1130
|
return data.reduce(function (acc, series, idx) {
|
|
1090
|
-
var base =
|
|
1131
|
+
var base = palette[idx % palette.length];
|
|
1091
1132
|
var color = lightenColor(base, 0.3);
|
|
1092
1133
|
acc[series.label] = color;
|
|
1093
1134
|
return acc;
|
|
1094
1135
|
}, {});
|
|
1095
|
-
}, [data, theme]);
|
|
1136
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
1096
1137
|
var toggleSeries = function toggleSeries(label) {
|
|
1097
1138
|
setVisibleSeries(function (prev) {
|
|
1098
1139
|
var isVisible = prev.includes(label);
|
|
@@ -1177,7 +1218,9 @@ function AreaChart(_ref) {
|
|
|
1177
1218
|
legend: {
|
|
1178
1219
|
display: false
|
|
1179
1220
|
},
|
|
1180
|
-
tooltip: createFluentTooltip(theme
|
|
1221
|
+
tooltip: createFluentTooltip(theme, {
|
|
1222
|
+
extraField: renderTooltipLabel
|
|
1223
|
+
})
|
|
1181
1224
|
},
|
|
1182
1225
|
scales: {
|
|
1183
1226
|
x: {
|
|
@@ -1234,7 +1277,10 @@ function BarChart(_ref) {
|
|
|
1234
1277
|
showDatalabels = _ref$showDatalabels === void 0 ? false : _ref$showDatalabels,
|
|
1235
1278
|
_ref$stacked = _ref.stacked,
|
|
1236
1279
|
stacked = _ref$stacked === void 0 ? false : _ref$stacked,
|
|
1237
|
-
theme = _ref.theme
|
|
1280
|
+
theme = _ref.theme,
|
|
1281
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
1282
|
+
_ref$paletteId = _ref.paletteId,
|
|
1283
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
1238
1284
|
var _useState = React.useState(function () {
|
|
1239
1285
|
var _data$;
|
|
1240
1286
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -1250,13 +1296,14 @@ function BarChart(_ref) {
|
|
|
1250
1296
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1251
1297
|
var styles = useGraphGlobalStyles();
|
|
1252
1298
|
var seriesColors = React.useMemo(function () {
|
|
1299
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
1253
1300
|
return data.reduce(function (acc, series, idx) {
|
|
1254
|
-
var base =
|
|
1301
|
+
var base = palette[idx % palette.length];
|
|
1255
1302
|
var color = lightenColor(base, 0.3);
|
|
1256
1303
|
acc[series.label] = color;
|
|
1257
1304
|
return acc;
|
|
1258
1305
|
}, {});
|
|
1259
|
-
}, [data]);
|
|
1306
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
1260
1307
|
var toggleSeries = function toggleSeries(label) {
|
|
1261
1308
|
setVisibleSeries(function (prev) {
|
|
1262
1309
|
var isVisible = prev.includes(label);
|
|
@@ -1341,7 +1388,9 @@ function BarChart(_ref) {
|
|
|
1341
1388
|
legend: {
|
|
1342
1389
|
display: false
|
|
1343
1390
|
},
|
|
1344
|
-
tooltip: createFluentTooltip(theme
|
|
1391
|
+
tooltip: createFluentTooltip(theme, {
|
|
1392
|
+
extraField: renderTooltipLabel
|
|
1393
|
+
})
|
|
1345
1394
|
},
|
|
1346
1395
|
scales: _extends({
|
|
1347
1396
|
x: {
|
|
@@ -1426,7 +1475,10 @@ function BarHorizontalChart(_ref) {
|
|
|
1426
1475
|
_ref$showDatalabels = _ref.showDatalabels,
|
|
1427
1476
|
showDatalabels = _ref$showDatalabels === void 0 ? false : _ref$showDatalabels,
|
|
1428
1477
|
title = _ref.title,
|
|
1429
|
-
theme = _ref.theme
|
|
1478
|
+
theme = _ref.theme,
|
|
1479
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
1480
|
+
_ref$paletteId = _ref.paletteId,
|
|
1481
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
1430
1482
|
var _useState = React.useState(function () {
|
|
1431
1483
|
var _data$;
|
|
1432
1484
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -1442,13 +1494,14 @@ function BarHorizontalChart(_ref) {
|
|
|
1442
1494
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1443
1495
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1444
1496
|
var seriesColors = React.useMemo(function () {
|
|
1497
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
1445
1498
|
return data.reduce(function (acc, series, idx) {
|
|
1446
|
-
var base =
|
|
1499
|
+
var base = palette[idx % palette.length];
|
|
1447
1500
|
var color = lightenColor(base, 0.3);
|
|
1448
1501
|
acc[series.label] = color;
|
|
1449
1502
|
return acc;
|
|
1450
1503
|
}, {});
|
|
1451
|
-
}, [data]);
|
|
1504
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
1452
1505
|
var toggleSeries = function toggleSeries(label) {
|
|
1453
1506
|
setVisibleSeries(function (prev) {
|
|
1454
1507
|
var isVisible = prev.includes(label);
|
|
@@ -1530,7 +1583,9 @@ function BarHorizontalChart(_ref) {
|
|
|
1530
1583
|
legend: {
|
|
1531
1584
|
display: false
|
|
1532
1585
|
},
|
|
1533
|
-
tooltip: createFluentTooltip(theme
|
|
1586
|
+
tooltip: createFluentTooltip(theme, {
|
|
1587
|
+
extraField: renderTooltipLabel
|
|
1588
|
+
})
|
|
1534
1589
|
},
|
|
1535
1590
|
scales: {
|
|
1536
1591
|
x: {
|
|
@@ -1587,8 +1642,11 @@ function BubbleChart(_ref) {
|
|
|
1587
1642
|
getRadius = _ref.getRadius,
|
|
1588
1643
|
showDataLabels = _ref.showDataLabels,
|
|
1589
1644
|
title = _ref.title,
|
|
1645
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
1590
1646
|
_ref$theme = _ref.theme,
|
|
1591
|
-
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme
|
|
1647
|
+
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
1648
|
+
_ref$paletteId = _ref.paletteId,
|
|
1649
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
1592
1650
|
var _useState = React.useState(function () {
|
|
1593
1651
|
var _data$;
|
|
1594
1652
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -1604,13 +1662,14 @@ function BubbleChart(_ref) {
|
|
|
1604
1662
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1605
1663
|
var styles = useGraphGlobalStyles();
|
|
1606
1664
|
var seriesColors = React.useMemo(function () {
|
|
1665
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
1607
1666
|
return data.reduce(function (acc, series, idx) {
|
|
1608
|
-
var base =
|
|
1667
|
+
var base = palette[idx % palette.length];
|
|
1609
1668
|
var color = lightenColor(base, 0.3);
|
|
1610
1669
|
acc[series.label] = color;
|
|
1611
1670
|
return acc;
|
|
1612
1671
|
}, {});
|
|
1613
|
-
}, [data, theme]);
|
|
1672
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
1614
1673
|
var toggleSeries = function toggleSeries(label) {
|
|
1615
1674
|
setVisibleSeries(function (prev) {
|
|
1616
1675
|
var isVisible = prev.includes(label);
|
|
@@ -1686,7 +1745,9 @@ function BubbleChart(_ref) {
|
|
|
1686
1745
|
legend: {
|
|
1687
1746
|
display: false
|
|
1688
1747
|
},
|
|
1689
|
-
tooltip: createFluentTooltip(theme
|
|
1748
|
+
tooltip: createFluentTooltip(theme, {
|
|
1749
|
+
extraField: renderTooltipLabel
|
|
1750
|
+
})
|
|
1690
1751
|
},
|
|
1691
1752
|
scales: {
|
|
1692
1753
|
x: {
|
|
@@ -1746,7 +1807,10 @@ function ComboChart(_ref) {
|
|
|
1746
1807
|
_ref$theme = _ref.theme,
|
|
1747
1808
|
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
1748
1809
|
_ref$axesMode = _ref.axesMode,
|
|
1749
|
-
axesMode = _ref$axesMode === void 0 ? 'legacy' : _ref$axesMode
|
|
1810
|
+
axesMode = _ref$axesMode === void 0 ? 'legacy' : _ref$axesMode,
|
|
1811
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
1812
|
+
_ref$paletteId = _ref.paletteId,
|
|
1813
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
1750
1814
|
var _useState = React.useState(function () {
|
|
1751
1815
|
return data.map(function (s) {
|
|
1752
1816
|
return s.label;
|
|
@@ -1761,12 +1825,13 @@ function ComboChart(_ref) {
|
|
|
1761
1825
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1762
1826
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1763
1827
|
var seriesColors = React.useMemo(function () {
|
|
1828
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
1764
1829
|
return data.reduce(function (acc, series, idx) {
|
|
1765
|
-
var base =
|
|
1830
|
+
var base = palette[idx % palette.length];
|
|
1766
1831
|
acc[series.label] = lightenColor(base, 0.3);
|
|
1767
1832
|
return acc;
|
|
1768
1833
|
}, {});
|
|
1769
|
-
}, [data, theme]);
|
|
1834
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
1770
1835
|
var toggleSeries = function toggleSeries(label) {
|
|
1771
1836
|
setVisibleSeries(function (prev) {
|
|
1772
1837
|
var isVisible = prev.includes(label);
|
|
@@ -1865,7 +1930,9 @@ function ComboChart(_ref) {
|
|
|
1865
1930
|
legend: {
|
|
1866
1931
|
display: false
|
|
1867
1932
|
},
|
|
1868
|
-
tooltip: createFluentTooltip(theme
|
|
1933
|
+
tooltip: createFluentTooltip(theme, {
|
|
1934
|
+
extraField: renderTooltipLabel
|
|
1935
|
+
})
|
|
1869
1936
|
}
|
|
1870
1937
|
});
|
|
1871
1938
|
if (axesMode === 'dual') {
|
|
@@ -2000,7 +2067,10 @@ function DoughnutChart(_ref) {
|
|
|
2000
2067
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2001
2068
|
showDataLabels = _ref$showDataLabels === void 0 ? true : _ref$showDataLabels,
|
|
2002
2069
|
_ref$theme = _ref.theme,
|
|
2003
|
-
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme
|
|
2070
|
+
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
2071
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2072
|
+
_ref$paletteId = _ref.paletteId,
|
|
2073
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2004
2074
|
var styles = useGraphGlobalStyles();
|
|
2005
2075
|
var _useChartUtils = useChartUtils(theme),
|
|
2006
2076
|
lightenColor = _useChartUtils.lightenColor,
|
|
@@ -2030,7 +2100,7 @@ function DoughnutChart(_ref) {
|
|
|
2030
2100
|
}, [data, getLabel, getValue]);
|
|
2031
2101
|
var _useMemo = React.useMemo(function () {
|
|
2032
2102
|
var allLabels = Array.from(valueMap.keys());
|
|
2033
|
-
var palette = getFluentPalette(theme);
|
|
2103
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2034
2104
|
var colors = allLabels.map(function (_, i) {
|
|
2035
2105
|
return lightenColor(palette[i % palette.length], 0.3);
|
|
2036
2106
|
});
|
|
@@ -2038,7 +2108,7 @@ function DoughnutChart(_ref) {
|
|
|
2038
2108
|
allLabels: allLabels,
|
|
2039
2109
|
colors: colors
|
|
2040
2110
|
};
|
|
2041
|
-
}, [valueMap, getFluentPalette, theme, lightenColor]),
|
|
2111
|
+
}, [valueMap, getFluentPalette, theme, lightenColor, paletteId]),
|
|
2042
2112
|
allLabels = _useMemo.allLabels,
|
|
2043
2113
|
colors = _useMemo.colors;
|
|
2044
2114
|
var _useMemo2 = React.useMemo(function () {
|
|
@@ -2089,7 +2159,9 @@ function DoughnutChart(_ref) {
|
|
|
2089
2159
|
legend: {
|
|
2090
2160
|
display: false
|
|
2091
2161
|
},
|
|
2092
|
-
tooltip: createFluentTooltip(theme
|
|
2162
|
+
tooltip: createFluentTooltip(theme, {
|
|
2163
|
+
extraField: renderTooltipLabel
|
|
2164
|
+
}),
|
|
2093
2165
|
title: {
|
|
2094
2166
|
display: !!title,
|
|
2095
2167
|
text: title,
|
|
@@ -2144,7 +2216,10 @@ function FloatingBarChart(_ref) {
|
|
|
2144
2216
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2145
2217
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
2146
2218
|
_ref$theme = _ref.theme,
|
|
2147
|
-
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme
|
|
2219
|
+
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
2220
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2221
|
+
_ref$paletteId = _ref.paletteId,
|
|
2222
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2148
2223
|
var _useState = React.useState(function () {
|
|
2149
2224
|
var _data$;
|
|
2150
2225
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -2160,13 +2235,14 @@ function FloatingBarChart(_ref) {
|
|
|
2160
2235
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
2161
2236
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2162
2237
|
var seriesColors = React.useMemo(function () {
|
|
2238
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2163
2239
|
return data.reduce(function (acc, series, idx) {
|
|
2164
|
-
var base =
|
|
2240
|
+
var base = palette[idx % palette.length];
|
|
2165
2241
|
var color = lightenColor(base, 0.3);
|
|
2166
2242
|
acc[series.label] = color;
|
|
2167
2243
|
return acc;
|
|
2168
2244
|
}, {});
|
|
2169
|
-
}, [data, theme]);
|
|
2245
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
2170
2246
|
var toggleSeries = function toggleSeries(label) {
|
|
2171
2247
|
setVisibleSeries(function (prev) {
|
|
2172
2248
|
var isVisible = prev.includes(label);
|
|
@@ -2248,7 +2324,9 @@ function FloatingBarChart(_ref) {
|
|
|
2248
2324
|
legend: {
|
|
2249
2325
|
display: false
|
|
2250
2326
|
},
|
|
2251
|
-
tooltip: createFluentTooltip(theme
|
|
2327
|
+
tooltip: createFluentTooltip(theme, {
|
|
2328
|
+
extraField: renderTooltipLabel
|
|
2329
|
+
})
|
|
2252
2330
|
},
|
|
2253
2331
|
scales: {
|
|
2254
2332
|
x: {
|
|
@@ -2305,7 +2383,10 @@ function LineChart(_ref) {
|
|
|
2305
2383
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2306
2384
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
2307
2385
|
_ref$theme = _ref.theme,
|
|
2308
|
-
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme
|
|
2386
|
+
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
2387
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2388
|
+
_ref$paletteId = _ref.paletteId,
|
|
2389
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2309
2390
|
var _useState = React.useState(function () {
|
|
2310
2391
|
var _data$;
|
|
2311
2392
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -2321,13 +2402,14 @@ function LineChart(_ref) {
|
|
|
2321
2402
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
2322
2403
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2323
2404
|
var seriesColors = React.useMemo(function () {
|
|
2405
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2324
2406
|
return data.reduce(function (acc, series, idx) {
|
|
2325
|
-
var base =
|
|
2407
|
+
var base = palette[idx % palette.length];
|
|
2326
2408
|
var color = lightenColor(base, 0.3);
|
|
2327
2409
|
acc[series.label] = color;
|
|
2328
2410
|
return acc;
|
|
2329
2411
|
}, {});
|
|
2330
|
-
}, [data, theme]);
|
|
2412
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
2331
2413
|
var toggleSeries = function toggleSeries(label) {
|
|
2332
2414
|
setVisibleSeries(function (prev) {
|
|
2333
2415
|
var isVisible = prev.includes(label);
|
|
@@ -2412,7 +2494,9 @@ function LineChart(_ref) {
|
|
|
2412
2494
|
legend: {
|
|
2413
2495
|
display: false
|
|
2414
2496
|
},
|
|
2415
|
-
tooltip: createFluentTooltip(theme
|
|
2497
|
+
tooltip: createFluentTooltip(theme, {
|
|
2498
|
+
extraField: renderTooltipLabel
|
|
2499
|
+
})
|
|
2416
2500
|
},
|
|
2417
2501
|
scales: {
|
|
2418
2502
|
x: {
|
|
@@ -2469,7 +2553,10 @@ function PieChart(_ref) {
|
|
|
2469
2553
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2470
2554
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
2471
2555
|
_ref$theme = _ref.theme,
|
|
2472
|
-
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme
|
|
2556
|
+
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
2557
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2558
|
+
_ref$paletteId = _ref.paletteId,
|
|
2559
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2473
2560
|
var _useChartUtils = useChartUtils(theme),
|
|
2474
2561
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2475
2562
|
lightenColor = _useChartUtils.lightenColor;
|
|
@@ -2497,7 +2584,7 @@ function PieChart(_ref) {
|
|
|
2497
2584
|
}, [data, getLabel, getValue]);
|
|
2498
2585
|
var _useMemo = React.useMemo(function () {
|
|
2499
2586
|
var allLabels = Array.from(valueMap.keys());
|
|
2500
|
-
var palette = getFluentPalette(theme);
|
|
2587
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2501
2588
|
var colors = allLabels.map(function (_, i) {
|
|
2502
2589
|
return lightenColor(palette[i % palette.length], 0.3);
|
|
2503
2590
|
});
|
|
@@ -2518,7 +2605,7 @@ function PieChart(_ref) {
|
|
|
2518
2605
|
values: values,
|
|
2519
2606
|
visibleColors: visibleColors
|
|
2520
2607
|
};
|
|
2521
|
-
}, [valueMap, getFluentPalette, lightenColor, theme, hiddenLabels]),
|
|
2608
|
+
}, [valueMap, getFluentPalette, lightenColor, theme, hiddenLabels, paletteId]),
|
|
2522
2609
|
allLabels = _useMemo.allLabels,
|
|
2523
2610
|
colors = _useMemo.colors,
|
|
2524
2611
|
filteredLabels = _useMemo.filteredLabels,
|
|
@@ -2553,7 +2640,9 @@ function PieChart(_ref) {
|
|
|
2553
2640
|
maintainAspectRatio: false
|
|
2554
2641
|
}, getInstantInteractionAnimations(), {
|
|
2555
2642
|
plugins: {
|
|
2556
|
-
tooltip: createFluentTooltip(theme
|
|
2643
|
+
tooltip: createFluentTooltip(theme, {
|
|
2644
|
+
extraField: renderTooltipLabel
|
|
2645
|
+
}),
|
|
2557
2646
|
legend: {
|
|
2558
2647
|
display: false
|
|
2559
2648
|
},
|
|
@@ -2638,7 +2727,10 @@ function PolarChart(_ref) {
|
|
|
2638
2727
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2639
2728
|
showDataLabels = _ref$showDataLabels === void 0 ? true : _ref$showDataLabels,
|
|
2640
2729
|
_ref$theme = _ref.theme,
|
|
2641
|
-
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme
|
|
2730
|
+
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
2731
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2732
|
+
_ref$paletteId = _ref.paletteId,
|
|
2733
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2642
2734
|
var _useChartUtils = useChartUtils(theme),
|
|
2643
2735
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2644
2736
|
lightenColor = _useChartUtils.lightenColor,
|
|
@@ -2667,7 +2759,7 @@ function PolarChart(_ref) {
|
|
|
2667
2759
|
}, [data, getLabel, getValue]);
|
|
2668
2760
|
var _useMemo = React.useMemo(function () {
|
|
2669
2761
|
var allLabels = Array.from(valueMap.keys());
|
|
2670
|
-
var palette = getFluentPalette(theme);
|
|
2762
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2671
2763
|
var colors = allLabels.map(function (_, i) {
|
|
2672
2764
|
return lightenColor(palette[i % palette.length], 0.3);
|
|
2673
2765
|
});
|
|
@@ -2688,7 +2780,7 @@ function PolarChart(_ref) {
|
|
|
2688
2780
|
values: values,
|
|
2689
2781
|
visibleColors: visibleColors
|
|
2690
2782
|
};
|
|
2691
|
-
}, [valueMap, getFluentPalette, lightenColor, theme, hiddenLabels]),
|
|
2783
|
+
}, [valueMap, getFluentPalette, lightenColor, theme, hiddenLabels, paletteId]),
|
|
2692
2784
|
allLabels = _useMemo.allLabels,
|
|
2693
2785
|
colors = _useMemo.colors,
|
|
2694
2786
|
filteredLabels = _useMemo.filteredLabels,
|
|
@@ -2735,7 +2827,9 @@ function PolarChart(_ref) {
|
|
|
2735
2827
|
return value;
|
|
2736
2828
|
}
|
|
2737
2829
|
},
|
|
2738
|
-
tooltip: createFluentTooltip(theme
|
|
2830
|
+
tooltip: createFluentTooltip(theme, {
|
|
2831
|
+
extraField: renderTooltipLabel
|
|
2832
|
+
}),
|
|
2739
2833
|
legend: {
|
|
2740
2834
|
display: false
|
|
2741
2835
|
}
|
|
@@ -2784,7 +2878,10 @@ function RadarChart(_ref) {
|
|
|
2784
2878
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2785
2879
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
2786
2880
|
_ref$theme = _ref.theme,
|
|
2787
|
-
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme
|
|
2881
|
+
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
2882
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2883
|
+
_ref$paletteId = _ref.paletteId,
|
|
2884
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2788
2885
|
var _useState = React.useState(function () {
|
|
2789
2886
|
return data.map(function (s) {
|
|
2790
2887
|
return s.label;
|
|
@@ -2798,12 +2895,13 @@ function RadarChart(_ref) {
|
|
|
2798
2895
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2799
2896
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2800
2897
|
var seriesColors = React.useMemo(function () {
|
|
2898
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2801
2899
|
return data.reduce(function (acc, series, idx) {
|
|
2802
|
-
var base =
|
|
2900
|
+
var base = palette[idx % palette.length];
|
|
2803
2901
|
acc[series.label] = lightenColor(base, 0.3);
|
|
2804
2902
|
return acc;
|
|
2805
2903
|
}, {});
|
|
2806
|
-
}, [data, getFluentPalette, lightenColor, theme]);
|
|
2904
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
2807
2905
|
var toggleSeries = function toggleSeries(label) {
|
|
2808
2906
|
setVisibleSeries(function (prev) {
|
|
2809
2907
|
return prev.includes(label) ? prev.filter(function (l) {
|
|
@@ -2882,7 +2980,9 @@ function RadarChart(_ref) {
|
|
|
2882
2980
|
size: parseInt(theme.fontSizeBase200.replace('px', '')) || 14
|
|
2883
2981
|
}
|
|
2884
2982
|
},
|
|
2885
|
-
tooltip: createFluentTooltip(theme
|
|
2983
|
+
tooltip: createFluentTooltip(theme, {
|
|
2984
|
+
extraField: renderTooltipLabel
|
|
2985
|
+
}),
|
|
2886
2986
|
legend: {
|
|
2887
2987
|
display: false
|
|
2888
2988
|
}
|
|
@@ -2938,7 +3038,10 @@ function ScatterChart(_ref) {
|
|
|
2938
3038
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2939
3039
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
2940
3040
|
_ref$theme = _ref.theme,
|
|
2941
|
-
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme
|
|
3041
|
+
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
3042
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
3043
|
+
_ref$paletteId = _ref.paletteId,
|
|
3044
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2942
3045
|
var _useState = React.useState(function () {
|
|
2943
3046
|
return data.map(function (s) {
|
|
2944
3047
|
return s.label;
|
|
@@ -2953,12 +3056,13 @@ function ScatterChart(_ref) {
|
|
|
2953
3056
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
2954
3057
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2955
3058
|
var seriesColors = React.useMemo(function () {
|
|
3059
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2956
3060
|
return data.reduce(function (acc, series, idx) {
|
|
2957
|
-
var base =
|
|
3061
|
+
var base = palette[idx % palette.length];
|
|
2958
3062
|
acc[series.label] = lightenColor(base, 0.3);
|
|
2959
3063
|
return acc;
|
|
2960
3064
|
}, {});
|
|
2961
|
-
}, [data, theme]);
|
|
3065
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
2962
3066
|
var toggleSeries = React__default.useCallback(function (label) {
|
|
2963
3067
|
setVisibleSeries(function (prev) {
|
|
2964
3068
|
return prev.includes(label) ? prev.filter(function (l) {
|
|
@@ -3029,7 +3133,9 @@ function ScatterChart(_ref) {
|
|
|
3029
3133
|
legend: {
|
|
3030
3134
|
display: false
|
|
3031
3135
|
},
|
|
3032
|
-
tooltip: createFluentTooltip(theme
|
|
3136
|
+
tooltip: createFluentTooltip(theme, {
|
|
3137
|
+
extraField: renderTooltipLabel
|
|
3138
|
+
})
|
|
3033
3139
|
},
|
|
3034
3140
|
scales: {
|
|
3035
3141
|
x: {
|
|
@@ -3087,7 +3193,10 @@ function StackedLineChart(_ref) {
|
|
|
3087
3193
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
3088
3194
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
3089
3195
|
_ref$theme = _ref.theme,
|
|
3090
|
-
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme
|
|
3196
|
+
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
3197
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
3198
|
+
_ref$paletteId = _ref.paletteId,
|
|
3199
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
3091
3200
|
var _useState = React.useState(function () {
|
|
3092
3201
|
var _data$;
|
|
3093
3202
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -3103,13 +3212,14 @@ function StackedLineChart(_ref) {
|
|
|
3103
3212
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
3104
3213
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
3105
3214
|
var seriesColors = React.useMemo(function () {
|
|
3215
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
3106
3216
|
return data.reduce(function (acc, series, idx) {
|
|
3107
|
-
var base =
|
|
3217
|
+
var base = palette[idx % palette.length];
|
|
3108
3218
|
var color = lightenColor(base, 0.3);
|
|
3109
3219
|
acc[series.label] = color;
|
|
3110
3220
|
return acc;
|
|
3111
3221
|
}, {});
|
|
3112
|
-
}, [data, theme]);
|
|
3222
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
3113
3223
|
var toggleSeries = function toggleSeries(label) {
|
|
3114
3224
|
setVisibleSeries(function (prev) {
|
|
3115
3225
|
var isVisible = prev.includes(label);
|
|
@@ -3194,7 +3304,9 @@ function StackedLineChart(_ref) {
|
|
|
3194
3304
|
legend: {
|
|
3195
3305
|
display: false
|
|
3196
3306
|
},
|
|
3197
|
-
tooltip: createFluentTooltip(theme
|
|
3307
|
+
tooltip: createFluentTooltip(theme, {
|
|
3308
|
+
extraField: renderTooltipLabel
|
|
3309
|
+
})
|
|
3198
3310
|
},
|
|
3199
3311
|
scales: {
|
|
3200
3312
|
x: {
|
|
@@ -3251,7 +3363,10 @@ function SteamChart(_ref) {
|
|
|
3251
3363
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
3252
3364
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
3253
3365
|
_ref$theme = _ref.theme,
|
|
3254
|
-
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme
|
|
3366
|
+
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
3367
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
3368
|
+
_ref$paletteId = _ref.paletteId,
|
|
3369
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
3255
3370
|
var _useState = React.useState(function () {
|
|
3256
3371
|
var _data$;
|
|
3257
3372
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -3269,12 +3384,13 @@ function SteamChart(_ref) {
|
|
|
3269
3384
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
3270
3385
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
3271
3386
|
var seriesColors = React.useMemo(function () {
|
|
3387
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
3272
3388
|
return data.reduce(function (acc, series, idx) {
|
|
3273
|
-
var base =
|
|
3389
|
+
var base = palette[idx % palette.length];
|
|
3274
3390
|
acc[series.label] = lightenColor(base, 0.3);
|
|
3275
3391
|
return acc;
|
|
3276
3392
|
}, {});
|
|
3277
|
-
}, [data, getFluentPalette, lightenColor, theme]);
|
|
3393
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
3278
3394
|
var toggleSeries = React__default.useCallback(function (label) {
|
|
3279
3395
|
setVisibleSeries(function (prev) {
|
|
3280
3396
|
var isVisible = prev.includes(label);
|
|
@@ -3371,7 +3487,9 @@ function SteamChart(_ref) {
|
|
|
3371
3487
|
legend: {
|
|
3372
3488
|
display: false
|
|
3373
3489
|
},
|
|
3374
|
-
tooltip: createFluentTooltip(theme
|
|
3490
|
+
tooltip: createFluentTooltip(theme, {
|
|
3491
|
+
extraField: renderTooltipLabel
|
|
3492
|
+
})
|
|
3375
3493
|
},
|
|
3376
3494
|
interaction: {
|
|
3377
3495
|
mode: 'index',
|
|
@@ -3454,7 +3572,10 @@ var chartProps = function chartProps(chart) {
|
|
|
3454
3572
|
},
|
|
3455
3573
|
getSecondary: function getSecondary(d) {
|
|
3456
3574
|
return d.value;
|
|
3457
|
-
}
|
|
3575
|
+
},
|
|
3576
|
+
// forward optional renderTooltipLabel if provided on the chart config
|
|
3577
|
+
renderTooltipLabel: chart.renderTooltipLabel,
|
|
3578
|
+
paletteId: chart.paletteId
|
|
3458
3579
|
};
|
|
3459
3580
|
};
|
|
3460
3581
|
var getChartComponent = function getChartComponent(chart, theme) {
|