@spteck/fluentui-react-charts 1.0.12 → 1.0.14
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 +0 -25
- package/dist/charts/ComboChart/ComboChart.d.ts +1 -1
- package/dist/fluentui-react-charts.cjs.development.js +14 -9
- 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 +14 -9
- package/dist/fluentui-react-charts.esm.js.map +1 -1
- package/dist/hooks/useChartUtils.d.ts +2 -2
- package/dist/models/IChart.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -304,31 +304,6 @@ 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
|
-
/>
|
|
332
307
|
```
|
|
333
308
|
|
|
334
309
|
#### BubbleChart
|
|
@@ -14,7 +14,7 @@ export interface ComboChartProps<T> {
|
|
|
14
14
|
theme?: Theme;
|
|
15
15
|
/**
|
|
16
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.
|
|
17
|
+
* 'dual' enables named y-axes ('y-bar' and 'y-line') and stacked x for bars.
|
|
18
18
|
*/
|
|
19
19
|
axesMode?: 'legacy' | 'dual';
|
|
20
20
|
}
|
|
@@ -786,8 +786,10 @@ var lightenColor = function lightenColor(hex, amount) {
|
|
|
786
786
|
};
|
|
787
787
|
return "#" + toHex(r) + toHex(g) + toHex(b);
|
|
788
788
|
};
|
|
789
|
-
var getFluentPalette = function getFluentPalette(
|
|
790
|
-
|
|
789
|
+
var getFluentPalette = function getFluentPalette(theme) {
|
|
790
|
+
// Check if theme is dark by looking at global color tokens
|
|
791
|
+
var isDark = theme.colorNeutralBackground1.startsWith('#1') || theme.colorNeutralBackground1 === '#000000';
|
|
792
|
+
return isDark ? ['#2899f5', '#ff8c00', '#32cd32', '#f06b71', '#c390f2', '#00b7c3', '#ffb900', '#b4a0ff', '#60cdff', '#92c353'] : ['#0078d4', '#d83b01', '#097223', '#a4262c', '#3f0c7aff', '#024339ff', '#791d2dff', '#005a9e', '#8764b8', '#376102ff'];
|
|
791
793
|
};
|
|
792
794
|
/**
|
|
793
795
|
* Returns animation configuration for instant interactions.
|
|
@@ -814,7 +816,7 @@ function createFluentTooltip(theme) {
|
|
|
814
816
|
var fontSize = parseInt(theme.fontSizeBase200.replace('px', '')) || 14;
|
|
815
817
|
var tooltipBg = theme.colorNeutralBackground1;
|
|
816
818
|
var tooltipTitleColor = theme.colorNeutralForeground1;
|
|
817
|
-
|
|
819
|
+
//const tooltipBodyColor = theme.colorNeutralForeground1;
|
|
818
820
|
var borderColor = theme.colorNeutralStroke2;
|
|
819
821
|
var callbacks = {
|
|
820
822
|
title: function title(context) {
|
|
@@ -899,7 +901,6 @@ function createFluentTooltip(theme) {
|
|
|
899
901
|
cornerRadius: 4,
|
|
900
902
|
padding: 10,
|
|
901
903
|
titleColor: tooltipTitleColor,
|
|
902
|
-
bodyColor: tooltipBodyColor,
|
|
903
904
|
titleFont: {
|
|
904
905
|
family: fontFamily,
|
|
905
906
|
size: fontSize
|
|
@@ -1776,7 +1777,7 @@ function ComboChart(_ref) {
|
|
|
1776
1777
|
return {
|
|
1777
1778
|
type: series.type,
|
|
1778
1779
|
label: series.label,
|
|
1779
|
-
//
|
|
1780
|
+
// Respect explicit series yAxisID if provided (retro-compatibility).
|
|
1780
1781
|
yAxisID: (_series$yAxisID = series.yAxisID) != null ? _series$yAxisID : axesMode === 'dual' ? series.type === 'bar' ? 'y-bar' : 'y-line' : 'y',
|
|
1781
1782
|
data: allCategories.map(function (cat) {
|
|
1782
1783
|
var found = series.data.find(function (d) {
|
|
@@ -1784,6 +1785,8 @@ function ComboChart(_ref) {
|
|
|
1784
1785
|
});
|
|
1785
1786
|
return found ? getSecondary(found) : 0;
|
|
1786
1787
|
}),
|
|
1788
|
+
// In dual mode, group bars into a common stack so they stack on x axis
|
|
1789
|
+
stack: axesMode === 'dual' && series.type === 'bar' ? 'barStack' : undefined,
|
|
1787
1790
|
backgroundColor: seriesColors[series.label],
|
|
1788
1791
|
borderColor: seriesColors[series.label],
|
|
1789
1792
|
fill: series.type === 'bar',
|
|
@@ -1861,6 +1864,7 @@ function ComboChart(_ref) {
|
|
|
1861
1864
|
type: 'linear',
|
|
1862
1865
|
position: 'left',
|
|
1863
1866
|
stacked: true,
|
|
1867
|
+
offset: true,
|
|
1864
1868
|
ticks: {
|
|
1865
1869
|
color: labelColor,
|
|
1866
1870
|
font: {
|
|
@@ -1893,7 +1897,6 @@ function ComboChart(_ref) {
|
|
|
1893
1897
|
return _extends({}, base, {
|
|
1894
1898
|
scales: {
|
|
1895
1899
|
x: {
|
|
1896
|
-
stacked: false,
|
|
1897
1900
|
ticks: {
|
|
1898
1901
|
color: labelColor,
|
|
1899
1902
|
font: {
|
|
@@ -1906,9 +1909,7 @@ function ComboChart(_ref) {
|
|
|
1906
1909
|
}
|
|
1907
1910
|
},
|
|
1908
1911
|
y: {
|
|
1909
|
-
type: 'linear',
|
|
1910
1912
|
position: 'left',
|
|
1911
|
-
stacked: false,
|
|
1912
1913
|
ticks: {
|
|
1913
1914
|
color: labelColor,
|
|
1914
1915
|
font: {
|
|
@@ -1918,7 +1919,8 @@ function ComboChart(_ref) {
|
|
|
1918
1919
|
},
|
|
1919
1920
|
grid: {
|
|
1920
1921
|
color: gridColor
|
|
1921
|
-
}
|
|
1922
|
+
},
|
|
1923
|
+
stacked: false
|
|
1922
1924
|
}
|
|
1923
1925
|
}
|
|
1924
1926
|
});
|
|
@@ -3433,6 +3435,7 @@ var chartProps = function chartProps(chart) {
|
|
|
3433
3435
|
};
|
|
3434
3436
|
};
|
|
3435
3437
|
var getChartComponent = function getChartComponent(chart, theme) {
|
|
3438
|
+
var _chart$axesMode;
|
|
3436
3439
|
var type = chart.type;
|
|
3437
3440
|
var fuiTheme = theme != null ? theme : reactComponents.webLightTheme;
|
|
3438
3441
|
switch (type) {
|
|
@@ -3466,6 +3469,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3466
3469
|
case 'multiple-axes':
|
|
3467
3470
|
return React__default.createElement(ComboChart, Object.assign({}, chartProps(chart), {
|
|
3468
3471
|
theme: fuiTheme,
|
|
3472
|
+
// allow the originating chart descriptor to opt into dual axes
|
|
3473
|
+
axesMode: (_chart$axesMode = chart.axesMode) != null ? _chart$axesMode : 'dual',
|
|
3469
3474
|
data: chart.data.map(function (series) {
|
|
3470
3475
|
var _series$type;
|
|
3471
3476
|
return {
|