@spteck/fluentui-react-charts 1.0.10 → 1.0.12
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/README.md +25 -0
- package/dist/charts/ComboChart/ComboChart.d.ts +6 -1
- package/dist/fluentui-react-charts.cjs.development.js +163 -66
- 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 +163 -67
- package/dist/fluentui-react-charts.esm.js.map +1 -1
- package/dist/hooks/useChartUtils.d.ts +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -304,6 +304,31 @@ const targetData = [
|
|
|
304
304
|
title="Sales vs Target"
|
|
305
305
|
theme={webLightTheme}
|
|
306
306
|
/>
|
|
307
|
+
|
|
308
|
+
> Note: ComboChart supports a backward-compatible dual-axis layout via the `axesMode` prop.
|
|
309
|
+
> - Default: `axesMode="legacy"` — preserves previous behavior: a single y-axis named `y` and a non-stacked x-axis.
|
|
310
|
+
> - Dual mode: `axesMode="dual"` — enables a stacked x-axis and two named y-axes: `y-bar` (left) and `y-line` (right).
|
|
311
|
+
|
|
312
|
+
Usage examples:
|
|
313
|
+
|
|
314
|
+
```tsx
|
|
315
|
+
// legacy (default) — unchanged behavior for existing consumers
|
|
316
|
+
<ComboChart
|
|
317
|
+
data={[{ label: 'Sales', data: salesData, type: 'bar' }]}
|
|
318
|
+
getPrimary={(d) => d.month}
|
|
319
|
+
getSecondary={(d) => d.value}
|
|
320
|
+
/>
|
|
321
|
+
|
|
322
|
+
// dual mode — bars default to 'y-bar' (stacked on x), lines default to 'y-line'
|
|
323
|
+
<ComboChart
|
|
324
|
+
data={[
|
|
325
|
+
{ label: 'Sales', data: salesData, type: 'bar' },
|
|
326
|
+
{ label: 'Target', data: targetData, type: 'line' }
|
|
327
|
+
]}
|
|
328
|
+
getPrimary={(d) => d.month}
|
|
329
|
+
getSecondary={(d) => d.value}
|
|
330
|
+
axesMode="dual"
|
|
331
|
+
/>
|
|
307
332
|
```
|
|
308
333
|
|
|
309
334
|
#### BubbleChart
|
|
@@ -12,6 +12,11 @@ export interface ComboChartProps<T> {
|
|
|
12
12
|
title?: string;
|
|
13
13
|
showDataLabels?: boolean;
|
|
14
14
|
theme?: Theme;
|
|
15
|
+
/**
|
|
16
|
+
* 'legacy' keeps previous behaviour (single 'y' axis, non-stacked x).
|
|
17
|
+
* 'dual' enables named y-axes ('y-bar' and 'y-line') and stacked x.
|
|
18
|
+
*/
|
|
19
|
+
axesMode?: 'legacy' | 'dual';
|
|
15
20
|
}
|
|
16
|
-
export declare function ComboChart<T extends object>({ data, getPrimary, getSecondary, title, showDataLabels, theme, }: ComboChartProps<T>): React.JSX.Element;
|
|
21
|
+
export declare function ComboChart<T extends object>({ data, getPrimary, getSecondary, title, showDataLabels, theme, axesMode, }: ComboChartProps<T>): React.JSX.Element;
|
|
17
22
|
export default ComboChart;
|
|
@@ -789,6 +789,22 @@ var lightenColor = function lightenColor(hex, amount) {
|
|
|
789
789
|
var getFluentPalette = function getFluentPalette(_theme) {
|
|
790
790
|
return ['#4e79a7', '#f28e2c', '#e15759', '#76b7b2', '#59a14f', '#edc949', '#af7aa1', '#ff9da7', '#9c755f', '#bab0ab', '#8cd17d', '#b6992d', '#d37295', '#fabfd2', '#79706e'];
|
|
791
791
|
};
|
|
792
|
+
/**
|
|
793
|
+
* Returns animation configuration for instant interactions.
|
|
794
|
+
* Disables hover/tooltip animations for immediate response.
|
|
795
|
+
*/
|
|
796
|
+
var getInstantInteractionAnimations = function getInstantInteractionAnimations() {
|
|
797
|
+
return {
|
|
798
|
+
animation: false,
|
|
799
|
+
transitions: {
|
|
800
|
+
active: {
|
|
801
|
+
animation: {
|
|
802
|
+
duration: 0
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
};
|
|
792
808
|
/**
|
|
793
809
|
* Smart Fluent tooltip generator with chart-type awareness.
|
|
794
810
|
* Optimized for fast performance with reduced animation delays.
|
|
@@ -938,7 +954,8 @@ function useChartUtils(theme) {
|
|
|
938
954
|
getFluentPalette: getFluentPalette,
|
|
939
955
|
createFluentTooltip: createFluentTooltip,
|
|
940
956
|
createAxisLabelFormatter: createAxisLabelFormatter,
|
|
941
|
-
debounce: debounce
|
|
957
|
+
debounce: debounce,
|
|
958
|
+
getInstantInteractionAnimations: getInstantInteractionAnimations
|
|
942
959
|
};
|
|
943
960
|
}, [theme]);
|
|
944
961
|
}
|
|
@@ -1041,7 +1058,8 @@ function AreaChart(_ref) {
|
|
|
1041
1058
|
var _useChartUtils = useChartUtils(theme),
|
|
1042
1059
|
lightenColor = _useChartUtils.lightenColor,
|
|
1043
1060
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
1044
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip
|
|
1061
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1062
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1045
1063
|
var seriesColors = React.useMemo(function () {
|
|
1046
1064
|
return data.reduce(function (acc, series, idx) {
|
|
1047
1065
|
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
@@ -1104,9 +1122,10 @@ function AreaChart(_ref) {
|
|
|
1104
1122
|
labelColor = _useMemo.labelColor,
|
|
1105
1123
|
gridColor = _useMemo.gridColor;
|
|
1106
1124
|
var options = React.useMemo(function () {
|
|
1107
|
-
return {
|
|
1125
|
+
return _extends({
|
|
1108
1126
|
responsive: true,
|
|
1109
|
-
maintainAspectRatio: false
|
|
1127
|
+
maintainAspectRatio: false
|
|
1128
|
+
}, getInstantInteractionAnimations(), {
|
|
1110
1129
|
plugins: {
|
|
1111
1130
|
title: {
|
|
1112
1131
|
display: !!title,
|
|
@@ -1163,7 +1182,7 @@ function AreaChart(_ref) {
|
|
|
1163
1182
|
}
|
|
1164
1183
|
}
|
|
1165
1184
|
}
|
|
1166
|
-
};
|
|
1185
|
+
});
|
|
1167
1186
|
}, [title, showDatalabels, theme, fontFamily, fontSize, labelColor, gridColor, stacked, createFluentTooltip]);
|
|
1168
1187
|
return React__default.createElement("div", {
|
|
1169
1188
|
className: styles.chartWithLegend
|
|
@@ -1202,7 +1221,8 @@ function BarChart(_ref) {
|
|
|
1202
1221
|
var _useChartUtils = useChartUtils(theme),
|
|
1203
1222
|
lightenColor = _useChartUtils.lightenColor,
|
|
1204
1223
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
1205
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip
|
|
1224
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1225
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1206
1226
|
var styles = useGraphGlobalStyles();
|
|
1207
1227
|
var seriesColors = React.useMemo(function () {
|
|
1208
1228
|
return data.reduce(function (acc, series, idx) {
|
|
@@ -1266,9 +1286,10 @@ function BarChart(_ref) {
|
|
|
1266
1286
|
labelColor = _useMemo.labelColor,
|
|
1267
1287
|
gridColor = _useMemo.gridColor;
|
|
1268
1288
|
var options = React.useMemo(function () {
|
|
1269
|
-
return {
|
|
1289
|
+
return _extends({
|
|
1270
1290
|
responsive: true,
|
|
1271
|
-
maintainAspectRatio: false
|
|
1291
|
+
maintainAspectRatio: false
|
|
1292
|
+
}, getInstantInteractionAnimations(), {
|
|
1272
1293
|
plugins: {
|
|
1273
1294
|
title: {
|
|
1274
1295
|
display: !!title,
|
|
@@ -1351,7 +1372,7 @@ function BarChart(_ref) {
|
|
|
1351
1372
|
}
|
|
1352
1373
|
}
|
|
1353
1374
|
})
|
|
1354
|
-
};
|
|
1375
|
+
});
|
|
1355
1376
|
}, [title, showDatalabels, theme, fontFamily, fontSize, labelColor, gridColor, stacked, createFluentTooltip]);
|
|
1356
1377
|
return React__default.createElement("div", {
|
|
1357
1378
|
className: styles.chartWithLegend
|
|
@@ -1393,7 +1414,8 @@ function BarHorizontalChart(_ref) {
|
|
|
1393
1414
|
var _useChartUtils = useChartUtils(theme),
|
|
1394
1415
|
lightenColor = _useChartUtils.lightenColor,
|
|
1395
1416
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
1396
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip
|
|
1417
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1418
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1397
1419
|
var seriesColors = React.useMemo(function () {
|
|
1398
1420
|
return data.reduce(function (acc, series, idx) {
|
|
1399
1421
|
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
@@ -1452,10 +1474,11 @@ function BarHorizontalChart(_ref) {
|
|
|
1452
1474
|
labelColor = _useMemo.labelColor,
|
|
1453
1475
|
gridColor = _useMemo.gridColor;
|
|
1454
1476
|
var options = React.useMemo(function () {
|
|
1455
|
-
return {
|
|
1477
|
+
return _extends({
|
|
1456
1478
|
indexAxis: 'y',
|
|
1457
1479
|
responsive: true,
|
|
1458
|
-
maintainAspectRatio: false
|
|
1480
|
+
maintainAspectRatio: false
|
|
1481
|
+
}, getInstantInteractionAnimations(), {
|
|
1459
1482
|
plugins: {
|
|
1460
1483
|
title: {
|
|
1461
1484
|
display: !!title,
|
|
@@ -1512,7 +1535,7 @@ function BarHorizontalChart(_ref) {
|
|
|
1512
1535
|
}
|
|
1513
1536
|
}
|
|
1514
1537
|
}
|
|
1515
|
-
};
|
|
1538
|
+
});
|
|
1516
1539
|
}, [title, showDatalabels, theme, fontFamily, fontSize, labelColor, gridColor, stacked, createFluentTooltip]);
|
|
1517
1540
|
return React__default.createElement("div", {
|
|
1518
1541
|
className: styles.chartWithLegend
|
|
@@ -1552,7 +1575,8 @@ function BubbleChart(_ref) {
|
|
|
1552
1575
|
var _useChartUtils = useChartUtils(theme),
|
|
1553
1576
|
lightenColor = _useChartUtils.lightenColor,
|
|
1554
1577
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
1555
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip
|
|
1578
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1579
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1556
1580
|
var styles = useGraphGlobalStyles();
|
|
1557
1581
|
var seriesColors = React.useMemo(function () {
|
|
1558
1582
|
return data.reduce(function (acc, series, idx) {
|
|
@@ -1607,9 +1631,10 @@ function BubbleChart(_ref) {
|
|
|
1607
1631
|
gridColor = _useMemo.gridColor;
|
|
1608
1632
|
var options = React.useMemo(function () {
|
|
1609
1633
|
var _data$2;
|
|
1610
|
-
return {
|
|
1634
|
+
return _extends({
|
|
1611
1635
|
responsive: true,
|
|
1612
|
-
maintainAspectRatio: false
|
|
1636
|
+
maintainAspectRatio: false
|
|
1637
|
+
}, getInstantInteractionAnimations(), {
|
|
1613
1638
|
plugins: {
|
|
1614
1639
|
title: {
|
|
1615
1640
|
display: !!title,
|
|
@@ -1665,7 +1690,7 @@ function BubbleChart(_ref) {
|
|
|
1665
1690
|
}
|
|
1666
1691
|
}
|
|
1667
1692
|
}
|
|
1668
|
-
};
|
|
1693
|
+
});
|
|
1669
1694
|
}, [title, showDataLabels, theme, getPrimary, getSecondary, data, fontFamily, fontSize, labelColor, gridColor, createFluentTooltip]);
|
|
1670
1695
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
1671
1696
|
className: styles.chartWithLegend
|
|
@@ -1694,7 +1719,9 @@ function ComboChart(_ref) {
|
|
|
1694
1719
|
_ref$showDataLabels = _ref.showDataLabels,
|
|
1695
1720
|
showDataLabels = _ref$showDataLabels === void 0 ? false : _ref$showDataLabels,
|
|
1696
1721
|
_ref$theme = _ref.theme,
|
|
1697
|
-
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme
|
|
1722
|
+
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme,
|
|
1723
|
+
_ref$axesMode = _ref.axesMode,
|
|
1724
|
+
axesMode = _ref$axesMode === void 0 ? 'legacy' : _ref$axesMode;
|
|
1698
1725
|
var _useState = React.useState(function () {
|
|
1699
1726
|
return data.map(function (s) {
|
|
1700
1727
|
return s.label;
|
|
@@ -1706,7 +1733,8 @@ function ComboChart(_ref) {
|
|
|
1706
1733
|
var _useChartUtils = useChartUtils(theme),
|
|
1707
1734
|
lightenColor = _useChartUtils.lightenColor,
|
|
1708
1735
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
1709
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip
|
|
1736
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1737
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1710
1738
|
var seriesColors = React.useMemo(function () {
|
|
1711
1739
|
return data.reduce(function (acc, series, idx) {
|
|
1712
1740
|
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
@@ -1748,7 +1776,8 @@ function ComboChart(_ref) {
|
|
|
1748
1776
|
return {
|
|
1749
1777
|
type: series.type,
|
|
1750
1778
|
label: series.label,
|
|
1751
|
-
|
|
1779
|
+
// default yAxis assignment: legacy uses single 'y', dual uses 'y-bar'/'y-line'
|
|
1780
|
+
yAxisID: (_series$yAxisID = series.yAxisID) != null ? _series$yAxisID : axesMode === 'dual' ? series.type === 'bar' ? 'y-bar' : 'y-line' : 'y',
|
|
1752
1781
|
data: allCategories.map(function (cat) {
|
|
1753
1782
|
var found = series.data.find(function (d) {
|
|
1754
1783
|
return getPrimary(d) === cat;
|
|
@@ -1779,9 +1808,10 @@ function ComboChart(_ref) {
|
|
|
1779
1808
|
labelColor = _useMemo.labelColor,
|
|
1780
1809
|
gridColor = _useMemo.gridColor;
|
|
1781
1810
|
var options = React.useMemo(function () {
|
|
1782
|
-
|
|
1811
|
+
var base = _extends({
|
|
1783
1812
|
responsive: true,
|
|
1784
|
-
maintainAspectRatio: false
|
|
1813
|
+
maintainAspectRatio: false
|
|
1814
|
+
}, getInstantInteractionAnimations(), {
|
|
1785
1815
|
plugins: {
|
|
1786
1816
|
title: {
|
|
1787
1817
|
display: !!title,
|
|
@@ -1809,9 +1839,61 @@ function ComboChart(_ref) {
|
|
|
1809
1839
|
display: false
|
|
1810
1840
|
},
|
|
1811
1841
|
tooltip: createFluentTooltip(theme)
|
|
1812
|
-
}
|
|
1842
|
+
}
|
|
1843
|
+
});
|
|
1844
|
+
if (axesMode === 'dual') {
|
|
1845
|
+
return _extends({}, base, {
|
|
1846
|
+
scales: {
|
|
1847
|
+
x: {
|
|
1848
|
+
stacked: true,
|
|
1849
|
+
ticks: {
|
|
1850
|
+
color: labelColor,
|
|
1851
|
+
font: {
|
|
1852
|
+
family: fontFamily,
|
|
1853
|
+
size: fontSize
|
|
1854
|
+
}
|
|
1855
|
+
},
|
|
1856
|
+
grid: {
|
|
1857
|
+
color: gridColor
|
|
1858
|
+
}
|
|
1859
|
+
},
|
|
1860
|
+
'y-bar': {
|
|
1861
|
+
type: 'linear',
|
|
1862
|
+
position: 'left',
|
|
1863
|
+
stacked: true,
|
|
1864
|
+
ticks: {
|
|
1865
|
+
color: labelColor,
|
|
1866
|
+
font: {
|
|
1867
|
+
family: fontFamily,
|
|
1868
|
+
size: fontSize
|
|
1869
|
+
}
|
|
1870
|
+
},
|
|
1871
|
+
grid: {
|
|
1872
|
+
color: gridColor
|
|
1873
|
+
}
|
|
1874
|
+
},
|
|
1875
|
+
'y-line': {
|
|
1876
|
+
type: 'linear',
|
|
1877
|
+
position: 'right',
|
|
1878
|
+
stacked: false,
|
|
1879
|
+
ticks: {
|
|
1880
|
+
color: labelColor,
|
|
1881
|
+
font: {
|
|
1882
|
+
family: fontFamily,
|
|
1883
|
+
size: fontSize
|
|
1884
|
+
}
|
|
1885
|
+
},
|
|
1886
|
+
grid: {
|
|
1887
|
+
color: gridColor
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
return _extends({}, base, {
|
|
1813
1894
|
scales: {
|
|
1814
1895
|
x: {
|
|
1896
|
+
stacked: false,
|
|
1815
1897
|
ticks: {
|
|
1816
1898
|
color: labelColor,
|
|
1817
1899
|
font: {
|
|
@@ -1824,7 +1906,9 @@ function ComboChart(_ref) {
|
|
|
1824
1906
|
}
|
|
1825
1907
|
},
|
|
1826
1908
|
y: {
|
|
1909
|
+
type: 'linear',
|
|
1827
1910
|
position: 'left',
|
|
1911
|
+
stacked: false,
|
|
1828
1912
|
ticks: {
|
|
1829
1913
|
color: labelColor,
|
|
1830
1914
|
font: {
|
|
@@ -1834,12 +1918,11 @@ function ComboChart(_ref) {
|
|
|
1834
1918
|
},
|
|
1835
1919
|
grid: {
|
|
1836
1920
|
color: gridColor
|
|
1837
|
-
}
|
|
1838
|
-
stacked: false
|
|
1921
|
+
}
|
|
1839
1922
|
}
|
|
1840
1923
|
}
|
|
1841
|
-
};
|
|
1842
|
-
}, [title, showDataLabels, theme, fontFamily, fontSize, labelColor, gridColor, createFluentTooltip]);
|
|
1924
|
+
});
|
|
1925
|
+
}, [title, showDataLabels, theme, fontFamily, fontSize, labelColor, gridColor, createFluentTooltip, getInstantInteractionAnimations, axesMode]);
|
|
1843
1926
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
1844
1927
|
className: styles.chartWithLegend
|
|
1845
1928
|
}, React__default.createElement("div", {
|
|
@@ -1897,7 +1980,8 @@ function DoughnutChart(_ref) {
|
|
|
1897
1980
|
var _useChartUtils = useChartUtils(theme),
|
|
1898
1981
|
lightenColor = _useChartUtils.lightenColor,
|
|
1899
1982
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
1900
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip
|
|
1983
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
1984
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
1901
1985
|
var _useState = React.useState([]),
|
|
1902
1986
|
hiddenLabels = _useState[0],
|
|
1903
1987
|
setHiddenLabels = _useState[1];
|
|
@@ -1972,9 +2056,10 @@ function DoughnutChart(_ref) {
|
|
|
1972
2056
|
});
|
|
1973
2057
|
}, [allLabels, valueMap, colors]);
|
|
1974
2058
|
var options = React.useMemo(function () {
|
|
1975
|
-
return {
|
|
2059
|
+
return _extends({
|
|
1976
2060
|
responsive: true,
|
|
1977
|
-
maintainAspectRatio: false
|
|
2061
|
+
maintainAspectRatio: false
|
|
2062
|
+
}, getInstantInteractionAnimations(), {
|
|
1978
2063
|
plugins: {
|
|
1979
2064
|
legend: {
|
|
1980
2065
|
display: false
|
|
@@ -2006,7 +2091,7 @@ function DoughnutChart(_ref) {
|
|
|
2006
2091
|
}
|
|
2007
2092
|
}
|
|
2008
2093
|
}
|
|
2009
|
-
};
|
|
2094
|
+
});
|
|
2010
2095
|
}, [title, theme, showDataLabels, createFluentTooltip]);
|
|
2011
2096
|
return React__default.createElement("div", {
|
|
2012
2097
|
className: styles.chartWithLegend
|
|
@@ -2047,7 +2132,8 @@ function FloatingBarChart(_ref) {
|
|
|
2047
2132
|
var _useChartUtils = useChartUtils(theme),
|
|
2048
2133
|
lightenColor = _useChartUtils.lightenColor,
|
|
2049
2134
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2050
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip
|
|
2135
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
2136
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2051
2137
|
var seriesColors = React.useMemo(function () {
|
|
2052
2138
|
return data.reduce(function (acc, series, idx) {
|
|
2053
2139
|
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
@@ -2107,9 +2193,10 @@ function FloatingBarChart(_ref) {
|
|
|
2107
2193
|
labelColor = _useMemo.labelColor,
|
|
2108
2194
|
gridColor = _useMemo.gridColor;
|
|
2109
2195
|
var options = React.useMemo(function () {
|
|
2110
|
-
return {
|
|
2196
|
+
return _extends({
|
|
2111
2197
|
responsive: true,
|
|
2112
|
-
maintainAspectRatio: false
|
|
2198
|
+
maintainAspectRatio: false
|
|
2199
|
+
}, getInstantInteractionAnimations(), {
|
|
2113
2200
|
plugins: {
|
|
2114
2201
|
title: {
|
|
2115
2202
|
display: !!title,
|
|
@@ -2164,7 +2251,7 @@ function FloatingBarChart(_ref) {
|
|
|
2164
2251
|
}
|
|
2165
2252
|
}
|
|
2166
2253
|
}
|
|
2167
|
-
};
|
|
2254
|
+
});
|
|
2168
2255
|
}, [title, theme, showDataLabels, labelColor, fontFamily, fontSize, gridColor, createFluentTooltip]);
|
|
2169
2256
|
return React__default.createElement("div", {
|
|
2170
2257
|
className: styles.chartWithLegend
|
|
@@ -2206,7 +2293,8 @@ function LineChart(_ref) {
|
|
|
2206
2293
|
var _useChartUtils = useChartUtils(theme),
|
|
2207
2294
|
lightenColor = _useChartUtils.lightenColor,
|
|
2208
2295
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2209
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip
|
|
2296
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
2297
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2210
2298
|
var seriesColors = React.useMemo(function () {
|
|
2211
2299
|
return data.reduce(function (acc, series, idx) {
|
|
2212
2300
|
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
@@ -2269,9 +2357,10 @@ function LineChart(_ref) {
|
|
|
2269
2357
|
labelColor = _useMemo.labelColor,
|
|
2270
2358
|
gridColor = _useMemo.gridColor;
|
|
2271
2359
|
var options = React.useMemo(function () {
|
|
2272
|
-
return {
|
|
2360
|
+
return _extends({
|
|
2273
2361
|
responsive: true,
|
|
2274
|
-
maintainAspectRatio: false
|
|
2362
|
+
maintainAspectRatio: false
|
|
2363
|
+
}, getInstantInteractionAnimations(), {
|
|
2275
2364
|
plugins: {
|
|
2276
2365
|
title: {
|
|
2277
2366
|
display: !!title,
|
|
@@ -2326,7 +2415,7 @@ function LineChart(_ref) {
|
|
|
2326
2415
|
}
|
|
2327
2416
|
}
|
|
2328
2417
|
}
|
|
2329
|
-
};
|
|
2418
|
+
});
|
|
2330
2419
|
}, [title, theme, showDataLabels, labelColor, fontFamily, fontSize, gridColor, createFluentTooltip]);
|
|
2331
2420
|
return React__default.createElement("div", {
|
|
2332
2421
|
className: styles.chartWithLegend
|
|
@@ -2434,9 +2523,10 @@ function PieChart(_ref) {
|
|
|
2434
2523
|
chartData = _useMemo2.chartData,
|
|
2435
2524
|
legendEntries = _useMemo2.legendEntries;
|
|
2436
2525
|
var options = React.useMemo(function () {
|
|
2437
|
-
return {
|
|
2526
|
+
return _extends({
|
|
2438
2527
|
responsive: true,
|
|
2439
|
-
maintainAspectRatio: false
|
|
2528
|
+
maintainAspectRatio: false
|
|
2529
|
+
}, getInstantInteractionAnimations(), {
|
|
2440
2530
|
plugins: {
|
|
2441
2531
|
tooltip: createFluentTooltip(theme),
|
|
2442
2532
|
legend: {
|
|
@@ -2465,7 +2555,7 @@ function PieChart(_ref) {
|
|
|
2465
2555
|
}
|
|
2466
2556
|
}
|
|
2467
2557
|
}
|
|
2468
|
-
};
|
|
2558
|
+
});
|
|
2469
2559
|
}, [theme, title, showDataLabels]);
|
|
2470
2560
|
return React__default.createElement("div", {
|
|
2471
2561
|
className: styles.chartWithLegend
|
|
@@ -2526,7 +2616,8 @@ function PolarChart(_ref) {
|
|
|
2526
2616
|
theme = _ref$theme === void 0 ? reactComponents.webLightTheme : _ref$theme;
|
|
2527
2617
|
var _useChartUtils = useChartUtils(theme),
|
|
2528
2618
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2529
|
-
lightenColor = _useChartUtils.lightenColor
|
|
2619
|
+
lightenColor = _useChartUtils.lightenColor,
|
|
2620
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2530
2621
|
var _useState = React.useState([]),
|
|
2531
2622
|
hiddenLabels = _useState[0],
|
|
2532
2623
|
setHiddenLabels = _useState[1];
|
|
@@ -2589,9 +2680,10 @@ function PolarChart(_ref) {
|
|
|
2589
2680
|
};
|
|
2590
2681
|
}, [filteredLabels, values, visibleColors]);
|
|
2591
2682
|
var options = React.useMemo(function () {
|
|
2592
|
-
return {
|
|
2683
|
+
return _extends({
|
|
2593
2684
|
responsive: true,
|
|
2594
|
-
maintainAspectRatio: false
|
|
2685
|
+
maintainAspectRatio: false
|
|
2686
|
+
}, getInstantInteractionAnimations(), {
|
|
2595
2687
|
plugins: {
|
|
2596
2688
|
title: {
|
|
2597
2689
|
display: !!title,
|
|
@@ -2638,7 +2730,7 @@ function PolarChart(_ref) {
|
|
|
2638
2730
|
}
|
|
2639
2731
|
}
|
|
2640
2732
|
}
|
|
2641
|
-
};
|
|
2733
|
+
});
|
|
2642
2734
|
}, [theme, title, showDataLabels, createFluentTooltip]);
|
|
2643
2735
|
return React__default.createElement("div", {
|
|
2644
2736
|
className: styles.chartWithLegend
|
|
@@ -2678,7 +2770,8 @@ function RadarChart(_ref) {
|
|
|
2678
2770
|
var styles = useGraphGlobalStyles();
|
|
2679
2771
|
var _useChartUtils = useChartUtils(theme),
|
|
2680
2772
|
lightenColor = _useChartUtils.lightenColor,
|
|
2681
|
-
getFluentPalette = _useChartUtils.getFluentPalette
|
|
2773
|
+
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2774
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2682
2775
|
var seriesColors = React.useMemo(function () {
|
|
2683
2776
|
return data.reduce(function (acc, series, idx) {
|
|
2684
2777
|
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
@@ -2737,9 +2830,10 @@ function RadarChart(_ref) {
|
|
|
2737
2830
|
labelColor = _useMemo.labelColor,
|
|
2738
2831
|
gridColor = _useMemo.gridColor;
|
|
2739
2832
|
var options = React.useMemo(function () {
|
|
2740
|
-
return {
|
|
2833
|
+
return _extends({
|
|
2741
2834
|
responsive: true,
|
|
2742
|
-
maintainAspectRatio: false
|
|
2835
|
+
maintainAspectRatio: false
|
|
2836
|
+
}, getInstantInteractionAnimations(), {
|
|
2743
2837
|
plugins: {
|
|
2744
2838
|
title: {
|
|
2745
2839
|
display: !!title,
|
|
@@ -2792,7 +2886,7 @@ function RadarChart(_ref) {
|
|
|
2792
2886
|
}
|
|
2793
2887
|
}
|
|
2794
2888
|
}
|
|
2795
|
-
};
|
|
2889
|
+
});
|
|
2796
2890
|
}, [theme, title, showDataLabels, createFluentTooltip, gridColor, labelColor, fontFamily, fontSize]);
|
|
2797
2891
|
return React__default.createElement("div", {
|
|
2798
2892
|
className: styles.chartWithLegend
|
|
@@ -2831,7 +2925,8 @@ function ScatterChart(_ref) {
|
|
|
2831
2925
|
var _useChartUtils = useChartUtils(theme),
|
|
2832
2926
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2833
2927
|
lightenColor = _useChartUtils.lightenColor,
|
|
2834
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip
|
|
2928
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
2929
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2835
2930
|
var seriesColors = React.useMemo(function () {
|
|
2836
2931
|
return data.reduce(function (acc, series, idx) {
|
|
2837
2932
|
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
@@ -2879,9 +2974,10 @@ function ScatterChart(_ref) {
|
|
|
2879
2974
|
labelColor = _useMemo.labelColor,
|
|
2880
2975
|
gridColor = _useMemo.gridColor;
|
|
2881
2976
|
var options = React.useMemo(function () {
|
|
2882
|
-
return {
|
|
2977
|
+
return _extends({
|
|
2883
2978
|
responsive: true,
|
|
2884
|
-
maintainAspectRatio: false
|
|
2979
|
+
maintainAspectRatio: false
|
|
2980
|
+
}, getInstantInteractionAnimations(), {
|
|
2885
2981
|
plugins: {
|
|
2886
2982
|
title: {
|
|
2887
2983
|
display: !!title,
|
|
@@ -2939,7 +3035,7 @@ function ScatterChart(_ref) {
|
|
|
2939
3035
|
}
|
|
2940
3036
|
}
|
|
2941
3037
|
}
|
|
2942
|
-
};
|
|
3038
|
+
});
|
|
2943
3039
|
}, [theme, title, showDataLabels, createFluentTooltip, labelColor, fontFamily, fontSize, gridColor]);
|
|
2944
3040
|
return React__default.createElement("div", {
|
|
2945
3041
|
className: styles.chartWithLegend
|
|
@@ -2979,7 +3075,8 @@ function StackedLineChart(_ref) {
|
|
|
2979
3075
|
var _useChartUtils = useChartUtils(theme),
|
|
2980
3076
|
lightenColor = _useChartUtils.lightenColor,
|
|
2981
3077
|
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
2982
|
-
createFluentTooltip = _useChartUtils.createFluentTooltip
|
|
3078
|
+
createFluentTooltip = _useChartUtils.createFluentTooltip,
|
|
3079
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
2983
3080
|
var seriesColors = React.useMemo(function () {
|
|
2984
3081
|
return data.reduce(function (acc, series, idx) {
|
|
2985
3082
|
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
@@ -3042,9 +3139,10 @@ function StackedLineChart(_ref) {
|
|
|
3042
3139
|
labelColor = _useMemo.labelColor,
|
|
3043
3140
|
gridColor = _useMemo.gridColor;
|
|
3044
3141
|
var options = React.useMemo(function () {
|
|
3045
|
-
return {
|
|
3142
|
+
return _extends({
|
|
3046
3143
|
responsive: true,
|
|
3047
|
-
maintainAspectRatio: false
|
|
3144
|
+
maintainAspectRatio: false
|
|
3145
|
+
}, getInstantInteractionAnimations(), {
|
|
3048
3146
|
plugins: {
|
|
3049
3147
|
title: {
|
|
3050
3148
|
display: !!title,
|
|
@@ -3101,7 +3199,7 @@ function StackedLineChart(_ref) {
|
|
|
3101
3199
|
}
|
|
3102
3200
|
}
|
|
3103
3201
|
}
|
|
3104
|
-
};
|
|
3202
|
+
});
|
|
3105
3203
|
}, [theme, title, showDataLabels, createFluentTooltip, labelColor, fontFamily, fontSize, gridColor]);
|
|
3106
3204
|
return React__default.createElement("div", {
|
|
3107
3205
|
className: styles.chartWithLegend
|
|
@@ -3143,7 +3241,8 @@ function SteamChart(_ref) {
|
|
|
3143
3241
|
var styles = useGraphGlobalStyles();
|
|
3144
3242
|
var _useChartUtils = useChartUtils(theme),
|
|
3145
3243
|
lightenColor = _useChartUtils.lightenColor,
|
|
3146
|
-
getFluentPalette = _useChartUtils.getFluentPalette
|
|
3244
|
+
getFluentPalette = _useChartUtils.getFluentPalette,
|
|
3245
|
+
getInstantInteractionAnimations = _useChartUtils.getInstantInteractionAnimations;
|
|
3147
3246
|
var seriesColors = React.useMemo(function () {
|
|
3148
3247
|
return data.reduce(function (acc, series, idx) {
|
|
3149
3248
|
var base = getFluentPalette(theme)[idx % getFluentPalette(theme).length];
|
|
@@ -3217,13 +3316,10 @@ function SteamChart(_ref) {
|
|
|
3217
3316
|
labelColor = _useMemo.labelColor,
|
|
3218
3317
|
gridColor = _useMemo.gridColor;
|
|
3219
3318
|
var options = React.useMemo(function () {
|
|
3220
|
-
return {
|
|
3319
|
+
return _extends({
|
|
3221
3320
|
responsive: true,
|
|
3222
|
-
maintainAspectRatio: false
|
|
3223
|
-
|
|
3224
|
-
duration: 800,
|
|
3225
|
-
easing: 'easeOutQuart'
|
|
3226
|
-
},
|
|
3321
|
+
maintainAspectRatio: false
|
|
3322
|
+
}, getInstantInteractionAnimations(), {
|
|
3227
3323
|
plugins: {
|
|
3228
3324
|
title: {
|
|
3229
3325
|
display: !!title,
|
|
@@ -3289,7 +3385,7 @@ function SteamChart(_ref) {
|
|
|
3289
3385
|
max: showPercent ? 100 : undefined
|
|
3290
3386
|
}
|
|
3291
3387
|
}
|
|
3292
|
-
};
|
|
3388
|
+
});
|
|
3293
3389
|
}, [theme, title, showDataLabels, createFluentTooltip, labelColor, fontFamily, fontSize, gridColor, showPercent]);
|
|
3294
3390
|
return React__default.createElement("div", {
|
|
3295
3391
|
className: styles.chartWithLegend
|
|
@@ -4113,6 +4209,7 @@ exports.SteamChart = SteamChart;
|
|
|
4113
4209
|
exports.createAxisLabelFormatter = createAxisLabelFormatter;
|
|
4114
4210
|
exports.createFluentTooltip = createFluentTooltip;
|
|
4115
4211
|
exports.getFluentPalette = getFluentPalette;
|
|
4212
|
+
exports.getInstantInteractionAnimations = getInstantInteractionAnimations;
|
|
4116
4213
|
exports.lightenColor = lightenColor;
|
|
4117
4214
|
exports.useChartUtils = useChartUtils;
|
|
4118
4215
|
exports.useGraphUtils = useChartUtils;
|