@spteck/fluentui-react-charts 1.0.14 → 1.1.1
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 +44 -22
- 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 +44 -22
- package/dist/fluentui-react-charts.esm.js.map +1 -1
- package/dist/models/IChart.d.ts +1 -0
- package/package.json +1 -1
|
@@ -782,7 +782,7 @@ 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'] : ['#289CEF', '#f05075ff', '#45B0A2', '#a4262c', '#F49E31', '#A366FF', '#FCCE51', '#062843ff', '#7f7f82ff', '#376102ff'];
|
|
786
786
|
};
|
|
787
787
|
/**
|
|
788
788
|
* Returns animation configuration for instant interactions.
|
|
@@ -859,11 +859,24 @@ function createFluentTooltip(theme) {
|
|
|
859
859
|
afterLabel: function afterLabel() {
|
|
860
860
|
return '';
|
|
861
861
|
},
|
|
862
|
-
|
|
863
|
-
|
|
862
|
+
// Provide sensible defaults for tooltip label colors using dataset colors when available
|
|
863
|
+
labelColor: function labelColor(item) {
|
|
864
|
+
var _item$dataIndex, _item$dataIndex2, _ref, _ref2;
|
|
865
|
+
var ds = item.dataset || {};
|
|
866
|
+
// dataset colors can be a single value or an array per data point
|
|
867
|
+
var bg = ds.backgroundColor;
|
|
868
|
+
if (Array.isArray(bg)) bg = bg[(_item$dataIndex = item.dataIndex) != null ? _item$dataIndex : 0];
|
|
869
|
+
var border = ds.borderColor;
|
|
870
|
+
if (Array.isArray(border)) border = border[(_item$dataIndex2 = item.dataIndex) != null ? _item$dataIndex2 : 0];
|
|
871
|
+
var backgroundColor = (_ref = bg != null ? bg : ds.pointBackgroundColor) != null ? _ref : tooltipBg;
|
|
872
|
+
var borderColorOut = (_ref2 = border != null ? border : ds.pointBorderColor) != null ? _ref2 : borderColor;
|
|
873
|
+
return {
|
|
874
|
+
borderColor: borderColorOut,
|
|
875
|
+
backgroundColor: backgroundColor
|
|
876
|
+
};
|
|
864
877
|
},
|
|
865
878
|
labelTextColor: function labelTextColor() {
|
|
866
|
-
return
|
|
879
|
+
return tooltipTitleColor;
|
|
867
880
|
},
|
|
868
881
|
footer: function footer() {
|
|
869
882
|
return '';
|
|
@@ -912,13 +925,13 @@ function createFluentTooltip(theme) {
|
|
|
912
925
|
/**
|
|
913
926
|
* Returns a Chart.js ticks callback to truncate long labels and add optional prefix/suffix.
|
|
914
927
|
*/
|
|
915
|
-
var createAxisLabelFormatter = function createAxisLabelFormatter(
|
|
916
|
-
var
|
|
917
|
-
maxLength =
|
|
918
|
-
|
|
919
|
-
suffix =
|
|
920
|
-
|
|
921
|
-
prefix =
|
|
928
|
+
var createAxisLabelFormatter = function createAxisLabelFormatter(_ref3) {
|
|
929
|
+
var _ref3$maxLength = _ref3.maxLength,
|
|
930
|
+
maxLength = _ref3$maxLength === void 0 ? 12 : _ref3$maxLength,
|
|
931
|
+
_ref3$suffix = _ref3.suffix,
|
|
932
|
+
suffix = _ref3$suffix === void 0 ? '' : _ref3$suffix,
|
|
933
|
+
_ref3$prefix = _ref3.prefix,
|
|
934
|
+
prefix = _ref3$prefix === void 0 ? '' : _ref3$prefix;
|
|
922
935
|
return function (value) {
|
|
923
936
|
var label = typeof value === 'number' ? this.getLabelForValue(value) : String(value);
|
|
924
937
|
var trimmed = label.length > maxLength ? label.slice(0, maxLength) + '…' : label;
|
|
@@ -1857,7 +1870,6 @@ function ComboChart(_ref) {
|
|
|
1857
1870
|
type: 'linear',
|
|
1858
1871
|
position: 'left',
|
|
1859
1872
|
stacked: true,
|
|
1860
|
-
offset: true,
|
|
1861
1873
|
ticks: {
|
|
1862
1874
|
color: labelColor,
|
|
1863
1875
|
font: {
|
|
@@ -3429,7 +3441,8 @@ var chartProps = function chartProps(chart) {
|
|
|
3429
3441
|
};
|
|
3430
3442
|
var getChartComponent = function getChartComponent(chart, theme) {
|
|
3431
3443
|
var _chart$axesMode;
|
|
3432
|
-
var type = chart.type
|
|
3444
|
+
var type = chart.type,
|
|
3445
|
+
showDataLabels = chart.showDataLabels;
|
|
3433
3446
|
var fuiTheme = theme != null ? theme : webLightTheme;
|
|
3434
3447
|
switch (type) {
|
|
3435
3448
|
case 'bar':
|
|
@@ -3438,7 +3451,9 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3438
3451
|
theme: fuiTheme
|
|
3439
3452
|
}));
|
|
3440
3453
|
case 'line':
|
|
3441
|
-
return React__default.createElement(LineChart, Object.assign({
|
|
3454
|
+
return React__default.createElement(LineChart, Object.assign({
|
|
3455
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3456
|
+
}, chartProps(chart), {
|
|
3442
3457
|
theme: fuiTheme
|
|
3443
3458
|
}));
|
|
3444
3459
|
case 'area':
|
|
@@ -3452,7 +3467,9 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3452
3467
|
theme: fuiTheme
|
|
3453
3468
|
}));
|
|
3454
3469
|
case 'bubble':
|
|
3455
|
-
return React__default.createElement(BubbleChart, Object.assign({
|
|
3470
|
+
return React__default.createElement(BubbleChart, Object.assign({
|
|
3471
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3472
|
+
}, chartProps(chart), {
|
|
3456
3473
|
getRadius: function getRadius(d) {
|
|
3457
3474
|
var _d$radius;
|
|
3458
3475
|
return (_d$radius = d.radius) != null ? _d$radius : 1;
|
|
@@ -3464,6 +3481,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3464
3481
|
theme: fuiTheme,
|
|
3465
3482
|
// allow the originating chart descriptor to opt into dual axes
|
|
3466
3483
|
axesMode: (_chart$axesMode = chart.axesMode) != null ? _chart$axesMode : 'dual',
|
|
3484
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false,
|
|
3467
3485
|
data: chart.data.map(function (series) {
|
|
3468
3486
|
var _series$type;
|
|
3469
3487
|
return {
|
|
@@ -3483,7 +3501,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3483
3501
|
getRange: function getRange(d) {
|
|
3484
3502
|
var _d$min, _d$max;
|
|
3485
3503
|
return [(_d$min = d.min) != null ? _d$min : 0, (_d$max = d.max) != null ? _d$max : 0];
|
|
3486
|
-
}
|
|
3504
|
+
},
|
|
3505
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3487
3506
|
}, chartProps(chart), {
|
|
3488
3507
|
theme: fuiTheme
|
|
3489
3508
|
}));
|
|
@@ -3499,7 +3518,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3499
3518
|
getValue: function getValue(datum) {
|
|
3500
3519
|
var _datum$value;
|
|
3501
3520
|
return (_datum$value = datum.value) != null ? _datum$value : 0;
|
|
3502
|
-
}
|
|
3521
|
+
},
|
|
3522
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3503
3523
|
}, chartProps(chart), {
|
|
3504
3524
|
theme: fuiTheme
|
|
3505
3525
|
}));
|
|
@@ -3512,7 +3532,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3512
3532
|
var _datum$value2;
|
|
3513
3533
|
return (_datum$value2 = datum.value) != null ? _datum$value2 : 0;
|
|
3514
3534
|
},
|
|
3515
|
-
showDataLabels:
|
|
3535
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3516
3536
|
}, chartProps(chart), {
|
|
3517
3537
|
theme: fuiTheme
|
|
3518
3538
|
}));
|
|
@@ -3529,7 +3549,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3529
3549
|
}
|
|
3530
3550
|
}, chartProps(chart), {
|
|
3531
3551
|
theme: fuiTheme,
|
|
3532
|
-
showDataLabels: false
|
|
3552
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3533
3553
|
}));
|
|
3534
3554
|
case 'polar':
|
|
3535
3555
|
return React__default.createElement(PolarChart, {
|
|
@@ -3542,7 +3562,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3542
3562
|
return (_d$value = d.value) != null ? _d$value : 0;
|
|
3543
3563
|
},
|
|
3544
3564
|
title: chart.title,
|
|
3545
|
-
showDataLabels:
|
|
3565
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false,
|
|
3546
3566
|
theme: fuiTheme
|
|
3547
3567
|
});
|
|
3548
3568
|
case 'radar':
|
|
@@ -3556,7 +3576,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3556
3576
|
return (_d$value2 = d.value) != null ? _d$value2 : 0;
|
|
3557
3577
|
},
|
|
3558
3578
|
title: chart.title,
|
|
3559
|
-
theme: fuiTheme
|
|
3579
|
+
theme: fuiTheme,
|
|
3580
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3560
3581
|
});
|
|
3561
3582
|
default:
|
|
3562
3583
|
throw new Error("Unsupported chart type: " + type);
|
|
@@ -4172,7 +4193,8 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
4172
4193
|
}), React__default.createElement("div", {
|
|
4173
4194
|
className: styles.chartContainer,
|
|
4174
4195
|
style: {
|
|
4175
|
-
height: containerHeight
|
|
4196
|
+
height: containerHeight,
|
|
4197
|
+
paddingTop: cardContainer.chart.title ? 0 : 16
|
|
4176
4198
|
}
|
|
4177
4199
|
}, theme && theme.fontSizeBase100 && getChartComponent(cardContainer.chart, theme))));
|
|
4178
4200
|
});
|