@spteck/fluentui-react-charts 1.1.0 → 1.1.2
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/fluentui-react-charts.cjs.development.js +68 -25
- 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 +68 -25
- package/dist/fluentui-react-charts.esm.js.map +1 -1
- package/dist/models/IChart.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/RenderTooltip/RenderTooltip.d.ts +0 -14
|
@@ -789,7 +789,18 @@ var lightenColor = function lightenColor(hex, amount) {
|
|
|
789
789
|
var getFluentPalette = function getFluentPalette(theme) {
|
|
790
790
|
// Check if theme is dark by looking at global color tokens
|
|
791
791
|
var isDark = theme.colorNeutralBackground1.startsWith('#1') || theme.colorNeutralBackground1 === '#000000';
|
|
792
|
-
return isDark ? ['#2899f5', '#ff8c00', '#32cd32', '#f06b71', '#c390f2', '#00b7c3', '#ffb900', '#b4a0ff', '#60cdff', '#92c353'] : [
|
|
792
|
+
return isDark ? ['#2899f5', '#ff8c00', '#32cd32', '#f06b71', '#c390f2', '#00b7c3', '#ffb900', '#b4a0ff', '#60cdff', '#92c353'] : [
|
|
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'];
|
|
793
804
|
};
|
|
794
805
|
/**
|
|
795
806
|
* Returns animation configuration for instant interactions.
|
|
@@ -866,11 +877,24 @@ function createFluentTooltip(theme) {
|
|
|
866
877
|
afterLabel: function afterLabel() {
|
|
867
878
|
return '';
|
|
868
879
|
},
|
|
869
|
-
|
|
870
|
-
|
|
880
|
+
// Provide sensible defaults for tooltip label colors using dataset colors when available
|
|
881
|
+
labelColor: function labelColor(item) {
|
|
882
|
+
var _item$dataIndex, _item$dataIndex2, _ref, _ref2;
|
|
883
|
+
var ds = item.dataset || {};
|
|
884
|
+
// dataset colors can be a single value or an array per data point
|
|
885
|
+
var bg = ds.backgroundColor;
|
|
886
|
+
if (Array.isArray(bg)) bg = bg[(_item$dataIndex = item.dataIndex) != null ? _item$dataIndex : 0];
|
|
887
|
+
var border = ds.borderColor;
|
|
888
|
+
if (Array.isArray(border)) border = border[(_item$dataIndex2 = item.dataIndex) != null ? _item$dataIndex2 : 0];
|
|
889
|
+
var backgroundColor = (_ref = bg != null ? bg : ds.pointBackgroundColor) != null ? _ref : tooltipBg;
|
|
890
|
+
var borderColorOut = (_ref2 = border != null ? border : ds.pointBorderColor) != null ? _ref2 : borderColor;
|
|
891
|
+
return {
|
|
892
|
+
borderColor: borderColorOut,
|
|
893
|
+
backgroundColor: backgroundColor
|
|
894
|
+
};
|
|
871
895
|
},
|
|
872
896
|
labelTextColor: function labelTextColor() {
|
|
873
|
-
return
|
|
897
|
+
return tooltipTitleColor;
|
|
874
898
|
},
|
|
875
899
|
footer: function footer() {
|
|
876
900
|
return '';
|
|
@@ -919,13 +943,13 @@ function createFluentTooltip(theme) {
|
|
|
919
943
|
/**
|
|
920
944
|
* Returns a Chart.js ticks callback to truncate long labels and add optional prefix/suffix.
|
|
921
945
|
*/
|
|
922
|
-
var createAxisLabelFormatter = function createAxisLabelFormatter(
|
|
923
|
-
var
|
|
924
|
-
maxLength =
|
|
925
|
-
|
|
926
|
-
suffix =
|
|
927
|
-
|
|
928
|
-
prefix =
|
|
946
|
+
var createAxisLabelFormatter = function createAxisLabelFormatter(_ref3) {
|
|
947
|
+
var _ref3$maxLength = _ref3.maxLength,
|
|
948
|
+
maxLength = _ref3$maxLength === void 0 ? 12 : _ref3$maxLength,
|
|
949
|
+
_ref3$suffix = _ref3.suffix,
|
|
950
|
+
suffix = _ref3$suffix === void 0 ? '' : _ref3$suffix,
|
|
951
|
+
_ref3$prefix = _ref3.prefix,
|
|
952
|
+
prefix = _ref3$prefix === void 0 ? '' : _ref3$prefix;
|
|
929
953
|
return function (value) {
|
|
930
954
|
var label = typeof value === 'number' ? this.getLabelForValue(value) : String(value);
|
|
931
955
|
var trimmed = label.length > maxLength ? label.slice(0, maxLength) + '…' : label;
|
|
@@ -3435,30 +3459,40 @@ var chartProps = function chartProps(chart) {
|
|
|
3435
3459
|
};
|
|
3436
3460
|
var getChartComponent = function getChartComponent(chart, theme) {
|
|
3437
3461
|
var _chart$axesMode;
|
|
3438
|
-
var type = chart.type
|
|
3462
|
+
var type = chart.type,
|
|
3463
|
+
showDataLabels = chart.showDataLabels;
|
|
3439
3464
|
var fuiTheme = theme != null ? theme : reactComponents.webLightTheme;
|
|
3440
3465
|
switch (type) {
|
|
3441
3466
|
case 'bar':
|
|
3442
3467
|
return React__default.createElement(BarChart, Object.assign({}, chartProps(chart), {
|
|
3468
|
+
showDatalabels: showDataLabels != null ? showDataLabels : false,
|
|
3443
3469
|
stacked: false,
|
|
3444
3470
|
theme: fuiTheme
|
|
3445
3471
|
}));
|
|
3446
3472
|
case 'line':
|
|
3447
|
-
return React__default.createElement(LineChart, Object.assign({
|
|
3473
|
+
return React__default.createElement(LineChart, Object.assign({
|
|
3474
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3475
|
+
}, chartProps(chart), {
|
|
3448
3476
|
theme: fuiTheme
|
|
3449
3477
|
}));
|
|
3450
3478
|
case 'area':
|
|
3451
|
-
return React__default.createElement(AreaChart, Object.assign({
|
|
3479
|
+
return React__default.createElement(AreaChart, Object.assign({
|
|
3480
|
+
showDatalabels: showDataLabels != null ? showDataLabels : false
|
|
3481
|
+
}, chartProps(chart), {
|
|
3452
3482
|
stacked: false,
|
|
3453
3483
|
theme: fuiTheme
|
|
3454
3484
|
}));
|
|
3455
3485
|
case 'bar-horizontal':
|
|
3456
|
-
return React__default.createElement(BarHorizontalChart, Object.assign({
|
|
3486
|
+
return React__default.createElement(BarHorizontalChart, Object.assign({
|
|
3487
|
+
showDatalabels: showDataLabels != null ? showDataLabels : false
|
|
3488
|
+
}, chartProps(chart), {
|
|
3457
3489
|
stacked: true,
|
|
3458
3490
|
theme: fuiTheme
|
|
3459
3491
|
}));
|
|
3460
3492
|
case 'bubble':
|
|
3461
|
-
return React__default.createElement(BubbleChart, Object.assign({
|
|
3493
|
+
return React__default.createElement(BubbleChart, Object.assign({
|
|
3494
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3495
|
+
}, chartProps(chart), {
|
|
3462
3496
|
getRadius: function getRadius(d) {
|
|
3463
3497
|
var _d$radius;
|
|
3464
3498
|
return (_d$radius = d.radius) != null ? _d$radius : 1;
|
|
@@ -3470,6 +3504,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3470
3504
|
theme: fuiTheme,
|
|
3471
3505
|
// allow the originating chart descriptor to opt into dual axes
|
|
3472
3506
|
axesMode: (_chart$axesMode = chart.axesMode) != null ? _chart$axesMode : 'dual',
|
|
3507
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false,
|
|
3473
3508
|
data: chart.data.map(function (series) {
|
|
3474
3509
|
var _series$type;
|
|
3475
3510
|
return {
|
|
@@ -3481,7 +3516,9 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3481
3516
|
})
|
|
3482
3517
|
}));
|
|
3483
3518
|
case 'steam':
|
|
3484
|
-
return React__default.createElement(SteamChart, Object.assign({
|
|
3519
|
+
return React__default.createElement(SteamChart, Object.assign({
|
|
3520
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3521
|
+
}, chartProps(chart), {
|
|
3485
3522
|
theme: fuiTheme
|
|
3486
3523
|
}));
|
|
3487
3524
|
case 'floating-bar':
|
|
@@ -3489,12 +3526,15 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3489
3526
|
getRange: function getRange(d) {
|
|
3490
3527
|
var _d$min, _d$max;
|
|
3491
3528
|
return [(_d$min = d.min) != null ? _d$min : 0, (_d$max = d.max) != null ? _d$max : 0];
|
|
3492
|
-
}
|
|
3529
|
+
},
|
|
3530
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3493
3531
|
}, chartProps(chart), {
|
|
3494
3532
|
theme: fuiTheme
|
|
3495
3533
|
}));
|
|
3496
3534
|
case 'stacked-line':
|
|
3497
|
-
return React__default.createElement(StackedLineChart, Object.assign({
|
|
3535
|
+
return React__default.createElement(StackedLineChart, Object.assign({
|
|
3536
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3537
|
+
}, chartProps(chart), {
|
|
3498
3538
|
theme: fuiTheme
|
|
3499
3539
|
}));
|
|
3500
3540
|
case 'doughnut':
|
|
@@ -3505,7 +3545,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3505
3545
|
getValue: function getValue(datum) {
|
|
3506
3546
|
var _datum$value;
|
|
3507
3547
|
return (_datum$value = datum.value) != null ? _datum$value : 0;
|
|
3508
|
-
}
|
|
3548
|
+
},
|
|
3549
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3509
3550
|
}, chartProps(chart), {
|
|
3510
3551
|
theme: fuiTheme
|
|
3511
3552
|
}));
|
|
@@ -3518,7 +3559,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3518
3559
|
var _datum$value2;
|
|
3519
3560
|
return (_datum$value2 = datum.value) != null ? _datum$value2 : 0;
|
|
3520
3561
|
},
|
|
3521
|
-
showDataLabels:
|
|
3562
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3522
3563
|
}, chartProps(chart), {
|
|
3523
3564
|
theme: fuiTheme
|
|
3524
3565
|
}));
|
|
@@ -3535,7 +3576,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3535
3576
|
}
|
|
3536
3577
|
}, chartProps(chart), {
|
|
3537
3578
|
theme: fuiTheme,
|
|
3538
|
-
showDataLabels: false
|
|
3579
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3539
3580
|
}));
|
|
3540
3581
|
case 'polar':
|
|
3541
3582
|
return React__default.createElement(PolarChart, {
|
|
@@ -3548,7 +3589,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3548
3589
|
return (_d$value = d.value) != null ? _d$value : 0;
|
|
3549
3590
|
},
|
|
3550
3591
|
title: chart.title,
|
|
3551
|
-
showDataLabels:
|
|
3592
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false,
|
|
3552
3593
|
theme: fuiTheme
|
|
3553
3594
|
});
|
|
3554
3595
|
case 'radar':
|
|
@@ -3562,7 +3603,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3562
3603
|
return (_d$value2 = d.value) != null ? _d$value2 : 0;
|
|
3563
3604
|
},
|
|
3564
3605
|
title: chart.title,
|
|
3565
|
-
theme: fuiTheme
|
|
3606
|
+
theme: fuiTheme,
|
|
3607
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3566
3608
|
});
|
|
3567
3609
|
default:
|
|
3568
3610
|
throw new Error("Unsupported chart type: " + type);
|
|
@@ -4178,7 +4220,8 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
4178
4220
|
}), React__default.createElement("div", {
|
|
4179
4221
|
className: styles.chartContainer,
|
|
4180
4222
|
style: {
|
|
4181
|
-
height: containerHeight
|
|
4223
|
+
height: containerHeight,
|
|
4224
|
+
paddingTop: cardContainer.chart.title ? 0 : 16
|
|
4182
4225
|
}
|
|
4183
4226
|
}, theme && theme.fontSizeBase100 && getChartComponent(cardContainer.chart, theme))));
|
|
4184
4227
|
});
|