@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
|
@@ -782,7 +782,18 @@ var lightenColor = function lightenColor(hex, amount) {
|
|
|
782
782
|
var getFluentPalette = function getFluentPalette(theme) {
|
|
783
783
|
// Check if theme is dark by looking at global color tokens
|
|
784
784
|
var isDark = theme.colorNeutralBackground1.startsWith('#1') || theme.colorNeutralBackground1 === '#000000';
|
|
785
|
-
return isDark ? ['#2899f5', '#ff8c00', '#32cd32', '#f06b71', '#c390f2', '#00b7c3', '#ffb900', '#b4a0ff', '#60cdff', '#92c353'] : [
|
|
785
|
+
return isDark ? ['#2899f5', '#ff8c00', '#32cd32', '#f06b71', '#c390f2', '#00b7c3', '#ffb900', '#b4a0ff', '#60cdff', '#92c353'] : [
|
|
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'];
|
|
786
797
|
};
|
|
787
798
|
/**
|
|
788
799
|
* Returns animation configuration for instant interactions.
|
|
@@ -859,11 +870,24 @@ function createFluentTooltip(theme) {
|
|
|
859
870
|
afterLabel: function afterLabel() {
|
|
860
871
|
return '';
|
|
861
872
|
},
|
|
862
|
-
|
|
863
|
-
|
|
873
|
+
// Provide sensible defaults for tooltip label colors using dataset colors when available
|
|
874
|
+
labelColor: function labelColor(item) {
|
|
875
|
+
var _item$dataIndex, _item$dataIndex2, _ref, _ref2;
|
|
876
|
+
var ds = item.dataset || {};
|
|
877
|
+
// dataset colors can be a single value or an array per data point
|
|
878
|
+
var bg = ds.backgroundColor;
|
|
879
|
+
if (Array.isArray(bg)) bg = bg[(_item$dataIndex = item.dataIndex) != null ? _item$dataIndex : 0];
|
|
880
|
+
var border = ds.borderColor;
|
|
881
|
+
if (Array.isArray(border)) border = border[(_item$dataIndex2 = item.dataIndex) != null ? _item$dataIndex2 : 0];
|
|
882
|
+
var backgroundColor = (_ref = bg != null ? bg : ds.pointBackgroundColor) != null ? _ref : tooltipBg;
|
|
883
|
+
var borderColorOut = (_ref2 = border != null ? border : ds.pointBorderColor) != null ? _ref2 : borderColor;
|
|
884
|
+
return {
|
|
885
|
+
borderColor: borderColorOut,
|
|
886
|
+
backgroundColor: backgroundColor
|
|
887
|
+
};
|
|
864
888
|
},
|
|
865
889
|
labelTextColor: function labelTextColor() {
|
|
866
|
-
return
|
|
890
|
+
return tooltipTitleColor;
|
|
867
891
|
},
|
|
868
892
|
footer: function footer() {
|
|
869
893
|
return '';
|
|
@@ -912,13 +936,13 @@ function createFluentTooltip(theme) {
|
|
|
912
936
|
/**
|
|
913
937
|
* Returns a Chart.js ticks callback to truncate long labels and add optional prefix/suffix.
|
|
914
938
|
*/
|
|
915
|
-
var createAxisLabelFormatter = function createAxisLabelFormatter(
|
|
916
|
-
var
|
|
917
|
-
maxLength =
|
|
918
|
-
|
|
919
|
-
suffix =
|
|
920
|
-
|
|
921
|
-
prefix =
|
|
939
|
+
var createAxisLabelFormatter = function createAxisLabelFormatter(_ref3) {
|
|
940
|
+
var _ref3$maxLength = _ref3.maxLength,
|
|
941
|
+
maxLength = _ref3$maxLength === void 0 ? 12 : _ref3$maxLength,
|
|
942
|
+
_ref3$suffix = _ref3.suffix,
|
|
943
|
+
suffix = _ref3$suffix === void 0 ? '' : _ref3$suffix,
|
|
944
|
+
_ref3$prefix = _ref3.prefix,
|
|
945
|
+
prefix = _ref3$prefix === void 0 ? '' : _ref3$prefix;
|
|
922
946
|
return function (value) {
|
|
923
947
|
var label = typeof value === 'number' ? this.getLabelForValue(value) : String(value);
|
|
924
948
|
var trimmed = label.length > maxLength ? label.slice(0, maxLength) + '…' : label;
|
|
@@ -3428,30 +3452,40 @@ var chartProps = function chartProps(chart) {
|
|
|
3428
3452
|
};
|
|
3429
3453
|
var getChartComponent = function getChartComponent(chart, theme) {
|
|
3430
3454
|
var _chart$axesMode;
|
|
3431
|
-
var type = chart.type
|
|
3455
|
+
var type = chart.type,
|
|
3456
|
+
showDataLabels = chart.showDataLabels;
|
|
3432
3457
|
var fuiTheme = theme != null ? theme : webLightTheme;
|
|
3433
3458
|
switch (type) {
|
|
3434
3459
|
case 'bar':
|
|
3435
3460
|
return React__default.createElement(BarChart, Object.assign({}, chartProps(chart), {
|
|
3461
|
+
showDatalabels: showDataLabels != null ? showDataLabels : false,
|
|
3436
3462
|
stacked: false,
|
|
3437
3463
|
theme: fuiTheme
|
|
3438
3464
|
}));
|
|
3439
3465
|
case 'line':
|
|
3440
|
-
return React__default.createElement(LineChart, Object.assign({
|
|
3466
|
+
return React__default.createElement(LineChart, Object.assign({
|
|
3467
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3468
|
+
}, chartProps(chart), {
|
|
3441
3469
|
theme: fuiTheme
|
|
3442
3470
|
}));
|
|
3443
3471
|
case 'area':
|
|
3444
|
-
return React__default.createElement(AreaChart, Object.assign({
|
|
3472
|
+
return React__default.createElement(AreaChart, Object.assign({
|
|
3473
|
+
showDatalabels: showDataLabels != null ? showDataLabels : false
|
|
3474
|
+
}, chartProps(chart), {
|
|
3445
3475
|
stacked: false,
|
|
3446
3476
|
theme: fuiTheme
|
|
3447
3477
|
}));
|
|
3448
3478
|
case 'bar-horizontal':
|
|
3449
|
-
return React__default.createElement(BarHorizontalChart, Object.assign({
|
|
3479
|
+
return React__default.createElement(BarHorizontalChart, Object.assign({
|
|
3480
|
+
showDatalabels: showDataLabels != null ? showDataLabels : false
|
|
3481
|
+
}, chartProps(chart), {
|
|
3450
3482
|
stacked: true,
|
|
3451
3483
|
theme: fuiTheme
|
|
3452
3484
|
}));
|
|
3453
3485
|
case 'bubble':
|
|
3454
|
-
return React__default.createElement(BubbleChart, Object.assign({
|
|
3486
|
+
return React__default.createElement(BubbleChart, Object.assign({
|
|
3487
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3488
|
+
}, chartProps(chart), {
|
|
3455
3489
|
getRadius: function getRadius(d) {
|
|
3456
3490
|
var _d$radius;
|
|
3457
3491
|
return (_d$radius = d.radius) != null ? _d$radius : 1;
|
|
@@ -3463,6 +3497,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3463
3497
|
theme: fuiTheme,
|
|
3464
3498
|
// allow the originating chart descriptor to opt into dual axes
|
|
3465
3499
|
axesMode: (_chart$axesMode = chart.axesMode) != null ? _chart$axesMode : 'dual',
|
|
3500
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false,
|
|
3466
3501
|
data: chart.data.map(function (series) {
|
|
3467
3502
|
var _series$type;
|
|
3468
3503
|
return {
|
|
@@ -3474,7 +3509,9 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3474
3509
|
})
|
|
3475
3510
|
}));
|
|
3476
3511
|
case 'steam':
|
|
3477
|
-
return React__default.createElement(SteamChart, Object.assign({
|
|
3512
|
+
return React__default.createElement(SteamChart, Object.assign({
|
|
3513
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3514
|
+
}, chartProps(chart), {
|
|
3478
3515
|
theme: fuiTheme
|
|
3479
3516
|
}));
|
|
3480
3517
|
case 'floating-bar':
|
|
@@ -3482,12 +3519,15 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3482
3519
|
getRange: function getRange(d) {
|
|
3483
3520
|
var _d$min, _d$max;
|
|
3484
3521
|
return [(_d$min = d.min) != null ? _d$min : 0, (_d$max = d.max) != null ? _d$max : 0];
|
|
3485
|
-
}
|
|
3522
|
+
},
|
|
3523
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3486
3524
|
}, chartProps(chart), {
|
|
3487
3525
|
theme: fuiTheme
|
|
3488
3526
|
}));
|
|
3489
3527
|
case 'stacked-line':
|
|
3490
|
-
return React__default.createElement(StackedLineChart, Object.assign({
|
|
3528
|
+
return React__default.createElement(StackedLineChart, Object.assign({
|
|
3529
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3530
|
+
}, chartProps(chart), {
|
|
3491
3531
|
theme: fuiTheme
|
|
3492
3532
|
}));
|
|
3493
3533
|
case 'doughnut':
|
|
@@ -3498,7 +3538,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3498
3538
|
getValue: function getValue(datum) {
|
|
3499
3539
|
var _datum$value;
|
|
3500
3540
|
return (_datum$value = datum.value) != null ? _datum$value : 0;
|
|
3501
|
-
}
|
|
3541
|
+
},
|
|
3542
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3502
3543
|
}, chartProps(chart), {
|
|
3503
3544
|
theme: fuiTheme
|
|
3504
3545
|
}));
|
|
@@ -3511,7 +3552,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3511
3552
|
var _datum$value2;
|
|
3512
3553
|
return (_datum$value2 = datum.value) != null ? _datum$value2 : 0;
|
|
3513
3554
|
},
|
|
3514
|
-
showDataLabels:
|
|
3555
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3515
3556
|
}, chartProps(chart), {
|
|
3516
3557
|
theme: fuiTheme
|
|
3517
3558
|
}));
|
|
@@ -3528,7 +3569,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3528
3569
|
}
|
|
3529
3570
|
}, chartProps(chart), {
|
|
3530
3571
|
theme: fuiTheme,
|
|
3531
|
-
showDataLabels: false
|
|
3572
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3532
3573
|
}));
|
|
3533
3574
|
case 'polar':
|
|
3534
3575
|
return React__default.createElement(PolarChart, {
|
|
@@ -3541,7 +3582,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3541
3582
|
return (_d$value = d.value) != null ? _d$value : 0;
|
|
3542
3583
|
},
|
|
3543
3584
|
title: chart.title,
|
|
3544
|
-
showDataLabels:
|
|
3585
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false,
|
|
3545
3586
|
theme: fuiTheme
|
|
3546
3587
|
});
|
|
3547
3588
|
case 'radar':
|
|
@@ -3555,7 +3596,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3555
3596
|
return (_d$value2 = d.value) != null ? _d$value2 : 0;
|
|
3556
3597
|
},
|
|
3557
3598
|
title: chart.title,
|
|
3558
|
-
theme: fuiTheme
|
|
3599
|
+
theme: fuiTheme,
|
|
3600
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3559
3601
|
});
|
|
3560
3602
|
default:
|
|
3561
3603
|
throw new Error("Unsupported chart type: " + type);
|
|
@@ -4171,7 +4213,8 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
4171
4213
|
}), React__default.createElement("div", {
|
|
4172
4214
|
className: styles.chartContainer,
|
|
4173
4215
|
style: {
|
|
4174
|
-
height: containerHeight
|
|
4216
|
+
height: containerHeight,
|
|
4217
|
+
paddingTop: cardContainer.chart.title ? 0 : 16
|
|
4175
4218
|
}
|
|
4176
4219
|
}, theme && theme.fontSizeBase100 && getChartComponent(cardContainer.chart, theme))));
|
|
4177
4220
|
});
|