@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
|
@@ -762,6 +762,33 @@ function LegendContainer(props) {
|
|
|
762
762
|
}))))));
|
|
763
763
|
}
|
|
764
764
|
|
|
765
|
+
var paletteDark4 = ['#F87171', '#FB923C', '#FDE047', '#86EFAC', '#7DD3FC', '#C084FC', '#F9A8D4', '#FED7AA' // Peach
|
|
766
|
+
];
|
|
767
|
+
var paletteLight4 = ['#DC2626', '#EA580C', '#EAB308', '#16A34A', '#0284C7', '#9333EA', '#DB2777', '#C2410C' // Peach
|
|
768
|
+
];
|
|
769
|
+
var paletteDark3 = ['#60A5FA', '#34D399', '#FBBF24', '#F472B6', '#A78BFA', '#FB923C', '#2DD4BF', '#FB7185' // Rose
|
|
770
|
+
];
|
|
771
|
+
var paletteLight3 = ['#2563EB', '#059669', '#D97706', '#DB2777', '#7C3AED', '#EA580C', '#0D9488', '#E11D48' // Rose
|
|
772
|
+
];
|
|
773
|
+
var paletteLight1 = ['#289CEF', '#f05075ff', '#45B0A2', '#a4262c', '#F49E31', '#A366FF', '#FCCE51', '#062843ff', '#7f7f82ff', '#376102ff', '#4e79a7'];
|
|
774
|
+
var paletteLight2 = ['#f28e2c', '#e15759', '#76b7b2', '#59a14f', '#edc949', '#af7aa1', '#ff9da7', '#9c755f', '#bab0ab', '#8cd17d', '#b6992d', '#d37295', '#fabfd2', '#79706e'];
|
|
775
|
+
var paletteDark1 = ['#2899f5', '#ff8c00', '#32cd32', '#f06b71', '#c390f2', '#00b7c3', '#ffb900', '#b4a0ff', '#60cdff', '#92c353'];
|
|
776
|
+
var paletteDark2 = /*#__PURE__*/[].concat(paletteLight2);
|
|
777
|
+
|
|
778
|
+
var getPalleteById = function getPalleteById(id, isDark) {
|
|
779
|
+
switch (id) {
|
|
780
|
+
case 1:
|
|
781
|
+
return isDark ? paletteDark1 : paletteLight1;
|
|
782
|
+
case 2:
|
|
783
|
+
return isDark ? paletteDark2 : paletteLight2;
|
|
784
|
+
case 3:
|
|
785
|
+
return isDark ? paletteDark3 : paletteLight3;
|
|
786
|
+
case 4:
|
|
787
|
+
return isDark ? paletteDark4 : paletteLight4;
|
|
788
|
+
default:
|
|
789
|
+
return isDark ? paletteDark1 : paletteLight1;
|
|
790
|
+
}
|
|
791
|
+
};
|
|
765
792
|
/**
|
|
766
793
|
* Lightens a given hex color by a percentage amount (0 to 1).
|
|
767
794
|
*/
|
|
@@ -779,21 +806,10 @@ var lightenColor = function lightenColor(hex, amount) {
|
|
|
779
806
|
};
|
|
780
807
|
return "#" + toHex(r) + toHex(g) + toHex(b);
|
|
781
808
|
};
|
|
782
|
-
var getFluentPalette = function getFluentPalette(theme) {
|
|
809
|
+
var getFluentPalette = function getFluentPalette(theme, paletteId) {
|
|
783
810
|
// Check if theme is dark by looking at global color tokens
|
|
784
811
|
var isDark = theme.colorNeutralBackground1.startsWith('#1') || theme.colorNeutralBackground1 === '#000000';
|
|
785
|
-
return
|
|
786
|
-
/* '#289CEF', // Communication Blue
|
|
787
|
-
'#f05075ff', // Deep Orange
|
|
788
|
-
'#45B0A2', // **DARK FOREST GREEN** (New)
|
|
789
|
-
'#a4262c', // Dark Red
|
|
790
|
-
'#F49E31', // Rich Purple
|
|
791
|
-
'#A366FF', // **DARK TEAL/PINE** (New)
|
|
792
|
-
'#FCCE51', // Berry
|
|
793
|
-
'#062843ff', // Navy
|
|
794
|
-
'#7f7f82ff', // Orchid
|
|
795
|
-
'#376102ff', // Moss Green (Darker than original) */
|
|
796
|
-
'#4e79a7', '#f28e2c', '#e15759', '#76b7b2', '#59a14f', '#edc949', '#af7aa1', '#ff9da7', '#9c755f', '#bab0ab', '#8cd17d', '#b6992d', '#d37295', '#fabfd2', '#79706e'];
|
|
812
|
+
return getPalleteById(paletteId != null ? paletteId : 1, isDark);
|
|
797
813
|
};
|
|
798
814
|
/**
|
|
799
815
|
* Returns animation configuration for instant interactions.
|
|
@@ -815,7 +831,12 @@ var getInstantInteractionAnimations = function getInstantInteractionAnimations()
|
|
|
815
831
|
* Smart Fluent tooltip generator with chart-type awareness.
|
|
816
832
|
* Optimized for fast performance with reduced animation delays.
|
|
817
833
|
*/
|
|
818
|
-
function createFluentTooltip(theme
|
|
834
|
+
function createFluentTooltip(theme,
|
|
835
|
+
// optional options: allow a global extraField (string or function) that will be
|
|
836
|
+
// appended to the default label. If a dataset supplies `extraField` (string or
|
|
837
|
+
// array indexed by data point) that value will be used instead of the global
|
|
838
|
+
// option. Example: value (x%) where x% is the extraField value.
|
|
839
|
+
opts) {
|
|
819
840
|
var fontFamily = theme.fontFamilyBase;
|
|
820
841
|
var fontSize = parseInt(theme.fontSizeBase200.replace('px', '')) || 14;
|
|
821
842
|
var tooltipBg = theme.colorNeutralBackground1;
|
|
@@ -828,29 +849,45 @@ function createFluentTooltip(theme) {
|
|
|
828
849
|
return (_context$0$label = (_context$ = context[0]) == null ? void 0 : _context$.label) != null ? _context$0$label : '';
|
|
829
850
|
},
|
|
830
851
|
label: function label(item) {
|
|
831
|
-
var
|
|
852
|
+
var dataset = item.dataset;
|
|
853
|
+
var datasetLabel = 'label' in dataset && typeof dataset.label === 'string' ? dataset.label : 'Value';
|
|
832
854
|
var raw = item.raw;
|
|
855
|
+
// determine extraField value, precedence: dataset.extraField > opts.extraField
|
|
856
|
+
var extra;
|
|
857
|
+
if (dataset && dataset.extraField !== undefined) {
|
|
858
|
+
var _item$dataIndex;
|
|
859
|
+
var ef = dataset.extraField;
|
|
860
|
+
// dataset extraField can be array (per-data) or single value
|
|
861
|
+
if (Array.isArray(ef)) extra = ef[(_item$dataIndex = item.dataIndex) != null ? _item$dataIndex : 0];else extra = ef;
|
|
862
|
+
} else if (opts && opts.extraField) {
|
|
863
|
+
if (typeof opts.extraField === 'function') {
|
|
864
|
+
extra = opts.extraField(item);
|
|
865
|
+
} else {
|
|
866
|
+
extra = opts.extraField;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
var suffix = extra !== undefined && extra !== null ? " (" + String(extra) + ")" : '';
|
|
833
870
|
// Bubble format { x, y, r }
|
|
834
871
|
if (typeof raw === 'object' && raw !== null && 'x' in raw && 'y' in raw && 'r' in raw) {
|
|
835
872
|
var x = raw.x,
|
|
836
873
|
y = raw.y,
|
|
837
874
|
r = raw.r;
|
|
838
|
-
return datasetLabel + " \u2014 x: " + x + ", y: " + y + ", r: " + r;
|
|
875
|
+
return datasetLabel + " \u2014 x: " + x + ", y: " + y + ", r: " + r + suffix;
|
|
839
876
|
}
|
|
840
877
|
// Scatter format { x, y }
|
|
841
878
|
if (typeof raw === 'object' && raw !== null && 'x' in raw && 'y' in raw) {
|
|
842
879
|
var _x = raw.x,
|
|
843
880
|
_y = raw.y;
|
|
844
|
-
return datasetLabel + " \u2014 x: " + _x + ", y: " + _y;
|
|
881
|
+
return datasetLabel + " \u2014 x: " + _x + ", y: " + _y + suffix;
|
|
845
882
|
}
|
|
846
883
|
// Floating bar [min, max]
|
|
847
884
|
if (Array.isArray(raw) && raw.length === 2) {
|
|
848
885
|
var min = raw[0],
|
|
849
886
|
max = raw[1];
|
|
850
|
-
return datasetLabel + ": " + min + " \u2013 " + max;
|
|
887
|
+
return datasetLabel + ": " + min + " \u2013 " + max + suffix;
|
|
851
888
|
}
|
|
852
889
|
// Default: single number or string
|
|
853
|
-
return datasetLabel + ": " + raw;
|
|
890
|
+
return datasetLabel + ": " + raw + suffix;
|
|
854
891
|
},
|
|
855
892
|
beforeTitle: function beforeTitle() {
|
|
856
893
|
return '';
|
|
@@ -872,13 +909,13 @@ function createFluentTooltip(theme) {
|
|
|
872
909
|
},
|
|
873
910
|
// Provide sensible defaults for tooltip label colors using dataset colors when available
|
|
874
911
|
labelColor: function labelColor(item) {
|
|
875
|
-
var _item$
|
|
912
|
+
var _item$dataIndex2, _item$dataIndex3, _ref, _ref2;
|
|
876
913
|
var ds = item.dataset || {};
|
|
877
914
|
// dataset colors can be a single value or an array per data point
|
|
878
915
|
var bg = ds.backgroundColor;
|
|
879
|
-
if (Array.isArray(bg)) bg = bg[(_item$
|
|
916
|
+
if (Array.isArray(bg)) bg = bg[(_item$dataIndex2 = item.dataIndex) != null ? _item$dataIndex2 : 0];
|
|
880
917
|
var border = ds.borderColor;
|
|
881
|
-
if (Array.isArray(border)) border = border[(_item$
|
|
918
|
+
if (Array.isArray(border)) border = border[(_item$dataIndex3 = item.dataIndex) != null ? _item$dataIndex3 : 0];
|
|
882
919
|
var backgroundColor = (_ref = bg != null ? bg : ds.pointBackgroundColor) != null ? _ref : tooltipBg;
|
|
883
920
|
var borderColorOut = (_ref2 = border != null ? border : ds.pointBorderColor) != null ? _ref2 : borderColor;
|
|
884
921
|
return {
|
|
@@ -1063,7 +1100,10 @@ function AreaChart(_ref) {
|
|
|
1063
1100
|
_ref$theme = _ref.theme,
|
|
1064
1101
|
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
1065
1102
|
_ref$stacked = _ref.stacked,
|
|
1066
|
-
stacked = _ref$stacked === void 0 ? false : _ref$stacked
|
|
1103
|
+
stacked = _ref$stacked === void 0 ? false : _ref$stacked,
|
|
1104
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
1105
|
+
_ref$paletteId = _ref.paletteId,
|
|
1106
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
1067
1107
|
var _useState = useState(function () {
|
|
1068
1108
|
var _data$;
|
|
1069
1109
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -1079,13 +1119,14 @@ function AreaChart(_ref) {
|
|
|
1079
1119
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1080
1120
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1081
1121
|
var seriesColors = useMemo(function () {
|
|
1122
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
1082
1123
|
return data.reduce(function (acc, series, idx) {
|
|
1083
|
-
var base =
|
|
1124
|
+
var base = palette[idx % palette.length];
|
|
1084
1125
|
var color = lightenColor(base, 0.3);
|
|
1085
1126
|
acc[series.label] = color;
|
|
1086
1127
|
return acc;
|
|
1087
1128
|
}, {});
|
|
1088
|
-
}, [data, theme]);
|
|
1129
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
1089
1130
|
var toggleSeries = function toggleSeries(label) {
|
|
1090
1131
|
setVisibleSeries(function (prev) {
|
|
1091
1132
|
var isVisible = prev.includes(label);
|
|
@@ -1170,7 +1211,9 @@ function AreaChart(_ref) {
|
|
|
1170
1211
|
legend: {
|
|
1171
1212
|
display: false
|
|
1172
1213
|
},
|
|
1173
|
-
tooltip: createFluentTooltip(theme
|
|
1214
|
+
tooltip: createFluentTooltip(theme, {
|
|
1215
|
+
extraField: renderTooltipLabel
|
|
1216
|
+
})
|
|
1174
1217
|
},
|
|
1175
1218
|
scales: {
|
|
1176
1219
|
x: {
|
|
@@ -1227,7 +1270,10 @@ function BarChart(_ref) {
|
|
|
1227
1270
|
showDatalabels = _ref$showDatalabels === void 0 ? false : _ref$showDatalabels,
|
|
1228
1271
|
_ref$stacked = _ref.stacked,
|
|
1229
1272
|
stacked = _ref$stacked === void 0 ? false : _ref$stacked,
|
|
1230
|
-
theme = _ref.theme
|
|
1273
|
+
theme = _ref.theme,
|
|
1274
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
1275
|
+
_ref$paletteId = _ref.paletteId,
|
|
1276
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
1231
1277
|
var _useState = useState(function () {
|
|
1232
1278
|
var _data$;
|
|
1233
1279
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -1243,13 +1289,14 @@ function BarChart(_ref) {
|
|
|
1243
1289
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1244
1290
|
var styles = useGraphGlobalStyles();
|
|
1245
1291
|
var seriesColors = useMemo(function () {
|
|
1292
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
1246
1293
|
return data.reduce(function (acc, series, idx) {
|
|
1247
|
-
var base =
|
|
1294
|
+
var base = palette[idx % palette.length];
|
|
1248
1295
|
var color = lightenColor(base, 0.3);
|
|
1249
1296
|
acc[series.label] = color;
|
|
1250
1297
|
return acc;
|
|
1251
1298
|
}, {});
|
|
1252
|
-
}, [data]);
|
|
1299
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
1253
1300
|
var toggleSeries = function toggleSeries(label) {
|
|
1254
1301
|
setVisibleSeries(function (prev) {
|
|
1255
1302
|
var isVisible = prev.includes(label);
|
|
@@ -1334,7 +1381,9 @@ function BarChart(_ref) {
|
|
|
1334
1381
|
legend: {
|
|
1335
1382
|
display: false
|
|
1336
1383
|
},
|
|
1337
|
-
tooltip: createFluentTooltip(theme
|
|
1384
|
+
tooltip: createFluentTooltip(theme, {
|
|
1385
|
+
extraField: renderTooltipLabel
|
|
1386
|
+
})
|
|
1338
1387
|
},
|
|
1339
1388
|
scales: _extends({
|
|
1340
1389
|
x: {
|
|
@@ -1419,7 +1468,10 @@ function BarHorizontalChart(_ref) {
|
|
|
1419
1468
|
_ref$showDatalabels = _ref.showDatalabels,
|
|
1420
1469
|
showDatalabels = _ref$showDatalabels === void 0 ? false : _ref$showDatalabels,
|
|
1421
1470
|
title = _ref.title,
|
|
1422
|
-
theme = _ref.theme
|
|
1471
|
+
theme = _ref.theme,
|
|
1472
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
1473
|
+
_ref$paletteId = _ref.paletteId,
|
|
1474
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
1423
1475
|
var _useState = useState(function () {
|
|
1424
1476
|
var _data$;
|
|
1425
1477
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -1435,13 +1487,14 @@ function BarHorizontalChart(_ref) {
|
|
|
1435
1487
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1436
1488
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1437
1489
|
var seriesColors = useMemo(function () {
|
|
1490
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
1438
1491
|
return data.reduce(function (acc, series, idx) {
|
|
1439
|
-
var base =
|
|
1492
|
+
var base = palette[idx % palette.length];
|
|
1440
1493
|
var color = lightenColor(base, 0.3);
|
|
1441
1494
|
acc[series.label] = color;
|
|
1442
1495
|
return acc;
|
|
1443
1496
|
}, {});
|
|
1444
|
-
}, [data]);
|
|
1497
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
1445
1498
|
var toggleSeries = function toggleSeries(label) {
|
|
1446
1499
|
setVisibleSeries(function (prev) {
|
|
1447
1500
|
var isVisible = prev.includes(label);
|
|
@@ -1523,7 +1576,9 @@ function BarHorizontalChart(_ref) {
|
|
|
1523
1576
|
legend: {
|
|
1524
1577
|
display: false
|
|
1525
1578
|
},
|
|
1526
|
-
tooltip: createFluentTooltip(theme
|
|
1579
|
+
tooltip: createFluentTooltip(theme, {
|
|
1580
|
+
extraField: renderTooltipLabel
|
|
1581
|
+
})
|
|
1527
1582
|
},
|
|
1528
1583
|
scales: {
|
|
1529
1584
|
x: {
|
|
@@ -1580,8 +1635,11 @@ function BubbleChart(_ref) {
|
|
|
1580
1635
|
getRadius = _ref.getRadius,
|
|
1581
1636
|
showDataLabels = _ref.showDataLabels,
|
|
1582
1637
|
title = _ref.title,
|
|
1638
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
1583
1639
|
_ref$theme = _ref.theme,
|
|
1584
|
-
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme
|
|
1640
|
+
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
1641
|
+
_ref$paletteId = _ref.paletteId,
|
|
1642
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
1585
1643
|
var _useState = useState(function () {
|
|
1586
1644
|
var _data$;
|
|
1587
1645
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -1597,13 +1655,14 @@ function BubbleChart(_ref) {
|
|
|
1597
1655
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1598
1656
|
var styles = useGraphGlobalStyles();
|
|
1599
1657
|
var seriesColors = useMemo(function () {
|
|
1658
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
1600
1659
|
return data.reduce(function (acc, series, idx) {
|
|
1601
|
-
var base =
|
|
1660
|
+
var base = palette[idx % palette.length];
|
|
1602
1661
|
var color = lightenColor(base, 0.3);
|
|
1603
1662
|
acc[series.label] = color;
|
|
1604
1663
|
return acc;
|
|
1605
1664
|
}, {});
|
|
1606
|
-
}, [data, theme]);
|
|
1665
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
1607
1666
|
var toggleSeries = function toggleSeries(label) {
|
|
1608
1667
|
setVisibleSeries(function (prev) {
|
|
1609
1668
|
var isVisible = prev.includes(label);
|
|
@@ -1679,7 +1738,9 @@ function BubbleChart(_ref) {
|
|
|
1679
1738
|
legend: {
|
|
1680
1739
|
display: false
|
|
1681
1740
|
},
|
|
1682
|
-
tooltip: createFluentTooltip(theme
|
|
1741
|
+
tooltip: createFluentTooltip(theme, {
|
|
1742
|
+
extraField: renderTooltipLabel
|
|
1743
|
+
})
|
|
1683
1744
|
},
|
|
1684
1745
|
scales: {
|
|
1685
1746
|
x: {
|
|
@@ -1739,7 +1800,10 @@ function ComboChart(_ref) {
|
|
|
1739
1800
|
_ref$theme = _ref.theme,
|
|
1740
1801
|
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
1741
1802
|
_ref$axesMode = _ref.axesMode,
|
|
1742
|
-
axesMode = _ref$axesMode === void 0 ? 'legacy' : _ref$axesMode
|
|
1803
|
+
axesMode = _ref$axesMode === void 0 ? 'legacy' : _ref$axesMode,
|
|
1804
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
1805
|
+
_ref$paletteId = _ref.paletteId,
|
|
1806
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
1743
1807
|
var _useState = useState(function () {
|
|
1744
1808
|
return data.map(function (s) {
|
|
1745
1809
|
return s.label;
|
|
@@ -1754,12 +1818,13 @@ function ComboChart(_ref) {
|
|
|
1754
1818
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1755
1819
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1756
1820
|
var seriesColors = useMemo(function () {
|
|
1821
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
1757
1822
|
return data.reduce(function (acc, series, idx) {
|
|
1758
|
-
var base =
|
|
1823
|
+
var base = palette[idx % palette.length];
|
|
1759
1824
|
acc[series.label] = lightenColor(base, 0.3);
|
|
1760
1825
|
return acc;
|
|
1761
1826
|
}, {});
|
|
1762
|
-
}, [data, theme]);
|
|
1827
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
1763
1828
|
var toggleSeries = function toggleSeries(label) {
|
|
1764
1829
|
setVisibleSeries(function (prev) {
|
|
1765
1830
|
var isVisible = prev.includes(label);
|
|
@@ -1858,7 +1923,9 @@ function ComboChart(_ref) {
|
|
|
1858
1923
|
legend: {
|
|
1859
1924
|
display: false
|
|
1860
1925
|
},
|
|
1861
|
-
tooltip: createFluentTooltip(theme
|
|
1926
|
+
tooltip: createFluentTooltip(theme, {
|
|
1927
|
+
extraField: renderTooltipLabel
|
|
1928
|
+
})
|
|
1862
1929
|
}
|
|
1863
1930
|
});
|
|
1864
1931
|
if (axesMode === 'dual') {
|
|
@@ -1993,7 +2060,10 @@ function DoughnutChart(_ref) {
|
|
|
1993
2060
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
1994
2061
|
showDataLabels = _ref$showDataLabels === void 0 ? true : _ref$showDataLabels,
|
|
1995
2062
|
_ref$theme = _ref.theme,
|
|
1996
|
-
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme
|
|
2063
|
+
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
2064
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2065
|
+
_ref$paletteId = _ref.paletteId,
|
|
2066
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
1997
2067
|
var styles = useGraphGlobalStyles();
|
|
1998
2068
|
var _useChartUtils = useChartUtils(theme),
|
|
1999
2069
|
lightenColor = _useChartUtils.lightenColor,
|
|
@@ -2023,7 +2093,7 @@ function DoughnutChart(_ref) {
|
|
|
2023
2093
|
}, [data, getLabel, getValue]);
|
|
2024
2094
|
var _useMemo = useMemo(function () {
|
|
2025
2095
|
var allLabels = Array.from(valueMap.keys());
|
|
2026
|
-
var palette = getFluentPalette(theme);
|
|
2096
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2027
2097
|
var colors = allLabels.map(function (_, i) {
|
|
2028
2098
|
return lightenColor(palette[i % palette.length], 0.3);
|
|
2029
2099
|
});
|
|
@@ -2031,7 +2101,7 @@ function DoughnutChart(_ref) {
|
|
|
2031
2101
|
allLabels: allLabels,
|
|
2032
2102
|
colors: colors
|
|
2033
2103
|
};
|
|
2034
|
-
}, [valueMap, getFluentPalette, theme, lightenColor]),
|
|
2104
|
+
}, [valueMap, getFluentPalette, theme, lightenColor, paletteId]),
|
|
2035
2105
|
allLabels = _useMemo.allLabels,
|
|
2036
2106
|
colors = _useMemo.colors;
|
|
2037
2107
|
var _useMemo2 = useMemo(function () {
|
|
@@ -2082,7 +2152,9 @@ function DoughnutChart(_ref) {
|
|
|
2082
2152
|
legend: {
|
|
2083
2153
|
display: false
|
|
2084
2154
|
},
|
|
2085
|
-
tooltip: createFluentTooltip(theme
|
|
2155
|
+
tooltip: createFluentTooltip(theme, {
|
|
2156
|
+
extraField: renderTooltipLabel
|
|
2157
|
+
}),
|
|
2086
2158
|
title: {
|
|
2087
2159
|
display: !!title,
|
|
2088
2160
|
text: title,
|
|
@@ -2137,7 +2209,10 @@ function FloatingBarChart(_ref) {
|
|
|
2137
2209
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2138
2210
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
2139
2211
|
_ref$theme = _ref.theme,
|
|
2140
|
-
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme
|
|
2212
|
+
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
2213
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2214
|
+
_ref$paletteId = _ref.paletteId,
|
|
2215
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2141
2216
|
var _useState = useState(function () {
|
|
2142
2217
|
var _data$;
|
|
2143
2218
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -2153,13 +2228,14 @@ function FloatingBarChart(_ref) {
|
|
|
2153
2228
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
2154
2229
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2155
2230
|
var seriesColors = useMemo(function () {
|
|
2231
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2156
2232
|
return data.reduce(function (acc, series, idx) {
|
|
2157
|
-
var base =
|
|
2233
|
+
var base = palette[idx % palette.length];
|
|
2158
2234
|
var color = lightenColor(base, 0.3);
|
|
2159
2235
|
acc[series.label] = color;
|
|
2160
2236
|
return acc;
|
|
2161
2237
|
}, {});
|
|
2162
|
-
}, [data, theme]);
|
|
2238
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
2163
2239
|
var toggleSeries = function toggleSeries(label) {
|
|
2164
2240
|
setVisibleSeries(function (prev) {
|
|
2165
2241
|
var isVisible = prev.includes(label);
|
|
@@ -2241,7 +2317,9 @@ function FloatingBarChart(_ref) {
|
|
|
2241
2317
|
legend: {
|
|
2242
2318
|
display: false
|
|
2243
2319
|
},
|
|
2244
|
-
tooltip: createFluentTooltip(theme
|
|
2320
|
+
tooltip: createFluentTooltip(theme, {
|
|
2321
|
+
extraField: renderTooltipLabel
|
|
2322
|
+
})
|
|
2245
2323
|
},
|
|
2246
2324
|
scales: {
|
|
2247
2325
|
x: {
|
|
@@ -2298,7 +2376,10 @@ function LineChart(_ref) {
|
|
|
2298
2376
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2299
2377
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
2300
2378
|
_ref$theme = _ref.theme,
|
|
2301
|
-
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme
|
|
2379
|
+
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
2380
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2381
|
+
_ref$paletteId = _ref.paletteId,
|
|
2382
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2302
2383
|
var _useState = useState(function () {
|
|
2303
2384
|
var _data$;
|
|
2304
2385
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -2314,13 +2395,14 @@ function LineChart(_ref) {
|
|
|
2314
2395
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
2315
2396
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2316
2397
|
var seriesColors = useMemo(function () {
|
|
2398
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2317
2399
|
return data.reduce(function (acc, series, idx) {
|
|
2318
|
-
var base =
|
|
2400
|
+
var base = palette[idx % palette.length];
|
|
2319
2401
|
var color = lightenColor(base, 0.3);
|
|
2320
2402
|
acc[series.label] = color;
|
|
2321
2403
|
return acc;
|
|
2322
2404
|
}, {});
|
|
2323
|
-
}, [data, theme]);
|
|
2405
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
2324
2406
|
var toggleSeries = function toggleSeries(label) {
|
|
2325
2407
|
setVisibleSeries(function (prev) {
|
|
2326
2408
|
var isVisible = prev.includes(label);
|
|
@@ -2405,7 +2487,9 @@ function LineChart(_ref) {
|
|
|
2405
2487
|
legend: {
|
|
2406
2488
|
display: false
|
|
2407
2489
|
},
|
|
2408
|
-
tooltip: createFluentTooltip(theme
|
|
2490
|
+
tooltip: createFluentTooltip(theme, {
|
|
2491
|
+
extraField: renderTooltipLabel
|
|
2492
|
+
})
|
|
2409
2493
|
},
|
|
2410
2494
|
scales: {
|
|
2411
2495
|
x: {
|
|
@@ -2462,7 +2546,10 @@ function PieChart(_ref) {
|
|
|
2462
2546
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2463
2547
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
2464
2548
|
_ref$theme = _ref.theme,
|
|
2465
|
-
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme
|
|
2549
|
+
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
2550
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2551
|
+
_ref$paletteId = _ref.paletteId,
|
|
2552
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2466
2553
|
var _useChartUtils = useChartUtils(theme),
|
|
2467
2554
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2468
2555
|
lightenColor = _useChartUtils.lightenColor;
|
|
@@ -2490,7 +2577,7 @@ function PieChart(_ref) {
|
|
|
2490
2577
|
}, [data, getLabel, getValue]);
|
|
2491
2578
|
var _useMemo = useMemo(function () {
|
|
2492
2579
|
var allLabels = Array.from(valueMap.keys());
|
|
2493
|
-
var palette = getFluentPalette(theme);
|
|
2580
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2494
2581
|
var colors = allLabels.map(function (_, i) {
|
|
2495
2582
|
return lightenColor(palette[i % palette.length], 0.3);
|
|
2496
2583
|
});
|
|
@@ -2511,7 +2598,7 @@ function PieChart(_ref) {
|
|
|
2511
2598
|
values: values,
|
|
2512
2599
|
visibleColors: visibleColors
|
|
2513
2600
|
};
|
|
2514
|
-
}, [valueMap, getFluentPalette, lightenColor, theme, hiddenLabels]),
|
|
2601
|
+
}, [valueMap, getFluentPalette, lightenColor, theme, hiddenLabels, paletteId]),
|
|
2515
2602
|
allLabels = _useMemo.allLabels,
|
|
2516
2603
|
colors = _useMemo.colors,
|
|
2517
2604
|
filteredLabels = _useMemo.filteredLabels,
|
|
@@ -2546,7 +2633,9 @@ function PieChart(_ref) {
|
|
|
2546
2633
|
maintainAspectRatio: false
|
|
2547
2634
|
}, getInstantInteractionAnimations(), {
|
|
2548
2635
|
plugins: {
|
|
2549
|
-
tooltip: createFluentTooltip(theme
|
|
2636
|
+
tooltip: createFluentTooltip(theme, {
|
|
2637
|
+
extraField: renderTooltipLabel
|
|
2638
|
+
}),
|
|
2550
2639
|
legend: {
|
|
2551
2640
|
display: false
|
|
2552
2641
|
},
|
|
@@ -2631,7 +2720,10 @@ function PolarChart(_ref) {
|
|
|
2631
2720
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2632
2721
|
showDataLabels = _ref$showDataLabels === void 0 ? true : _ref$showDataLabels,
|
|
2633
2722
|
_ref$theme = _ref.theme,
|
|
2634
|
-
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme
|
|
2723
|
+
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
2724
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2725
|
+
_ref$paletteId = _ref.paletteId,
|
|
2726
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2635
2727
|
var _useChartUtils = useChartUtils(theme),
|
|
2636
2728
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2637
2729
|
lightenColor = _useChartUtils.lightenColor,
|
|
@@ -2660,7 +2752,7 @@ function PolarChart(_ref) {
|
|
|
2660
2752
|
}, [data, getLabel, getValue]);
|
|
2661
2753
|
var _useMemo = useMemo(function () {
|
|
2662
2754
|
var allLabels = Array.from(valueMap.keys());
|
|
2663
|
-
var palette = getFluentPalette(theme);
|
|
2755
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2664
2756
|
var colors = allLabels.map(function (_, i) {
|
|
2665
2757
|
return lightenColor(palette[i % palette.length], 0.3);
|
|
2666
2758
|
});
|
|
@@ -2681,7 +2773,7 @@ function PolarChart(_ref) {
|
|
|
2681
2773
|
values: values,
|
|
2682
2774
|
visibleColors: visibleColors
|
|
2683
2775
|
};
|
|
2684
|
-
}, [valueMap, getFluentPalette, lightenColor, theme, hiddenLabels]),
|
|
2776
|
+
}, [valueMap, getFluentPalette, lightenColor, theme, hiddenLabels, paletteId]),
|
|
2685
2777
|
allLabels = _useMemo.allLabels,
|
|
2686
2778
|
colors = _useMemo.colors,
|
|
2687
2779
|
filteredLabels = _useMemo.filteredLabels,
|
|
@@ -2728,7 +2820,9 @@ function PolarChart(_ref) {
|
|
|
2728
2820
|
return value;
|
|
2729
2821
|
}
|
|
2730
2822
|
},
|
|
2731
|
-
tooltip: createFluentTooltip(theme
|
|
2823
|
+
tooltip: createFluentTooltip(theme, {
|
|
2824
|
+
extraField: renderTooltipLabel
|
|
2825
|
+
}),
|
|
2732
2826
|
legend: {
|
|
2733
2827
|
display: false
|
|
2734
2828
|
}
|
|
@@ -2777,7 +2871,10 @@ function RadarChart(_ref) {
|
|
|
2777
2871
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2778
2872
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
2779
2873
|
_ref$theme = _ref.theme,
|
|
2780
|
-
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme
|
|
2874
|
+
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
2875
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
2876
|
+
_ref$paletteId = _ref.paletteId,
|
|
2877
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2781
2878
|
var _useState = useState(function () {
|
|
2782
2879
|
return data.map(function (s) {
|
|
2783
2880
|
return s.label;
|
|
@@ -2791,12 +2888,13 @@ function RadarChart(_ref) {
|
|
|
2791
2888
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2792
2889
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2793
2890
|
var seriesColors = useMemo(function () {
|
|
2891
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2794
2892
|
return data.reduce(function (acc, series, idx) {
|
|
2795
|
-
var base =
|
|
2893
|
+
var base = palette[idx % palette.length];
|
|
2796
2894
|
acc[series.label] = lightenColor(base, 0.3);
|
|
2797
2895
|
return acc;
|
|
2798
2896
|
}, {});
|
|
2799
|
-
}, [data, getFluentPalette, lightenColor, theme]);
|
|
2897
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
2800
2898
|
var toggleSeries = function toggleSeries(label) {
|
|
2801
2899
|
setVisibleSeries(function (prev) {
|
|
2802
2900
|
return prev.includes(label) ? prev.filter(function (l) {
|
|
@@ -2875,7 +2973,9 @@ function RadarChart(_ref) {
|
|
|
2875
2973
|
size: parseInt(theme.fontSizeBase200.replace('px', '')) || 14
|
|
2876
2974
|
}
|
|
2877
2975
|
},
|
|
2878
|
-
tooltip: createFluentTooltip(theme
|
|
2976
|
+
tooltip: createFluentTooltip(theme, {
|
|
2977
|
+
extraField: renderTooltipLabel
|
|
2978
|
+
}),
|
|
2879
2979
|
legend: {
|
|
2880
2980
|
display: false
|
|
2881
2981
|
}
|
|
@@ -2931,7 +3031,10 @@ function ScatterChart(_ref) {
|
|
|
2931
3031
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
2932
3032
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
2933
3033
|
_ref$theme = _ref.theme,
|
|
2934
|
-
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme
|
|
3034
|
+
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
3035
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
3036
|
+
_ref$paletteId = _ref.paletteId,
|
|
3037
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
2935
3038
|
var _useState = useState(function () {
|
|
2936
3039
|
return data.map(function (s) {
|
|
2937
3040
|
return s.label;
|
|
@@ -2946,12 +3049,13 @@ function ScatterChart(_ref) {
|
|
|
2946
3049
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
2947
3050
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2948
3051
|
var seriesColors = useMemo(function () {
|
|
3052
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
2949
3053
|
return data.reduce(function (acc, series, idx) {
|
|
2950
|
-
var base =
|
|
3054
|
+
var base = palette[idx % palette.length];
|
|
2951
3055
|
acc[series.label] = lightenColor(base, 0.3);
|
|
2952
3056
|
return acc;
|
|
2953
3057
|
}, {});
|
|
2954
|
-
}, [data, theme]);
|
|
3058
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
2955
3059
|
var toggleSeries = React__default.useCallback(function (label) {
|
|
2956
3060
|
setVisibleSeries(function (prev) {
|
|
2957
3061
|
return prev.includes(label) ? prev.filter(function (l) {
|
|
@@ -3022,7 +3126,9 @@ function ScatterChart(_ref) {
|
|
|
3022
3126
|
legend: {
|
|
3023
3127
|
display: false
|
|
3024
3128
|
},
|
|
3025
|
-
tooltip: createFluentTooltip(theme
|
|
3129
|
+
tooltip: createFluentTooltip(theme, {
|
|
3130
|
+
extraField: renderTooltipLabel
|
|
3131
|
+
})
|
|
3026
3132
|
},
|
|
3027
3133
|
scales: {
|
|
3028
3134
|
x: {
|
|
@@ -3080,7 +3186,10 @@ function StackedLineChart(_ref) {
|
|
|
3080
3186
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
3081
3187
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
3082
3188
|
_ref$theme = _ref.theme,
|
|
3083
|
-
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme
|
|
3189
|
+
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
3190
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
3191
|
+
_ref$paletteId = _ref.paletteId,
|
|
3192
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
3084
3193
|
var _useState = useState(function () {
|
|
3085
3194
|
var _data$;
|
|
3086
3195
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -3096,13 +3205,14 @@ function StackedLineChart(_ref) {
|
|
|
3096
3205
|
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
3097
3206
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
3098
3207
|
var seriesColors = useMemo(function () {
|
|
3208
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
3099
3209
|
return data.reduce(function (acc, series, idx) {
|
|
3100
|
-
var base =
|
|
3210
|
+
var base = palette[idx % palette.length];
|
|
3101
3211
|
var color = lightenColor(base, 0.3);
|
|
3102
3212
|
acc[series.label] = color;
|
|
3103
3213
|
return acc;
|
|
3104
3214
|
}, {});
|
|
3105
|
-
}, [data, theme]);
|
|
3215
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
3106
3216
|
var toggleSeries = function toggleSeries(label) {
|
|
3107
3217
|
setVisibleSeries(function (prev) {
|
|
3108
3218
|
var isVisible = prev.includes(label);
|
|
@@ -3187,7 +3297,9 @@ function StackedLineChart(_ref) {
|
|
|
3187
3297
|
legend: {
|
|
3188
3298
|
display: false
|
|
3189
3299
|
},
|
|
3190
|
-
tooltip: createFluentTooltip(theme
|
|
3300
|
+
tooltip: createFluentTooltip(theme, {
|
|
3301
|
+
extraField: renderTooltipLabel
|
|
3302
|
+
})
|
|
3191
3303
|
},
|
|
3192
3304
|
scales: {
|
|
3193
3305
|
x: {
|
|
@@ -3244,7 +3356,10 @@ function SteamChart(_ref) {
|
|
|
3244
3356
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
3245
3357
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
3246
3358
|
_ref$theme = _ref.theme,
|
|
3247
|
-
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme
|
|
3359
|
+
theme = _ref$theme === void 0 ? webLightTheme : _ref$theme,
|
|
3360
|
+
renderTooltipLabel = _ref.renderTooltipLabel,
|
|
3361
|
+
_ref$paletteId = _ref.paletteId,
|
|
3362
|
+
paletteId = _ref$paletteId === void 0 ? 1 : _ref$paletteId;
|
|
3248
3363
|
var _useState = useState(function () {
|
|
3249
3364
|
var _data$;
|
|
3250
3365
|
return data.length > 1 ? data.map(function (s) {
|
|
@@ -3262,12 +3377,13 @@ function SteamChart(_ref) {
|
|
|
3262
3377
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
3263
3378
|
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
3264
3379
|
var seriesColors = useMemo(function () {
|
|
3380
|
+
var palette = getFluentPalette(theme, paletteId);
|
|
3265
3381
|
return data.reduce(function (acc, series, idx) {
|
|
3266
|
-
var base =
|
|
3382
|
+
var base = palette[idx % palette.length];
|
|
3267
3383
|
acc[series.label] = lightenColor(base, 0.3);
|
|
3268
3384
|
return acc;
|
|
3269
3385
|
}, {});
|
|
3270
|
-
}, [data, getFluentPalette, lightenColor, theme]);
|
|
3386
|
+
}, [data, getFluentPalette, lightenColor, theme, paletteId]);
|
|
3271
3387
|
var toggleSeries = React__default.useCallback(function (label) {
|
|
3272
3388
|
setVisibleSeries(function (prev) {
|
|
3273
3389
|
var isVisible = prev.includes(label);
|
|
@@ -3364,7 +3480,9 @@ function SteamChart(_ref) {
|
|
|
3364
3480
|
legend: {
|
|
3365
3481
|
display: false
|
|
3366
3482
|
},
|
|
3367
|
-
tooltip: createFluentTooltip(theme
|
|
3483
|
+
tooltip: createFluentTooltip(theme, {
|
|
3484
|
+
extraField: renderTooltipLabel
|
|
3485
|
+
})
|
|
3368
3486
|
},
|
|
3369
3487
|
interaction: {
|
|
3370
3488
|
mode: 'index',
|
|
@@ -3447,7 +3565,10 @@ var chartProps = function chartProps(chart) {
|
|
|
3447
3565
|
},
|
|
3448
3566
|
getSecondary: function getSecondary(d) {
|
|
3449
3567
|
return d.value;
|
|
3450
|
-
}
|
|
3568
|
+
},
|
|
3569
|
+
// forward optional renderTooltipLabel if provided on the chart config
|
|
3570
|
+
renderTooltipLabel: chart.renderTooltipLabel,
|
|
3571
|
+
paletteId: chart.paletteId
|
|
3451
3572
|
};
|
|
3452
3573
|
};
|
|
3453
3574
|
var getChartComponent = function getChartComponent(chart, theme) {
|