@spteck/fluentui-react-charts 1.1.0 → 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 -21
- 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 -21
- 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;
|
|
@@ -3428,7 +3441,8 @@ var chartProps = function chartProps(chart) {
|
|
|
3428
3441
|
};
|
|
3429
3442
|
var getChartComponent = function getChartComponent(chart, theme) {
|
|
3430
3443
|
var _chart$axesMode;
|
|
3431
|
-
var type = chart.type
|
|
3444
|
+
var type = chart.type,
|
|
3445
|
+
showDataLabels = chart.showDataLabels;
|
|
3432
3446
|
var fuiTheme = theme != null ? theme : webLightTheme;
|
|
3433
3447
|
switch (type) {
|
|
3434
3448
|
case 'bar':
|
|
@@ -3437,7 +3451,9 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3437
3451
|
theme: fuiTheme
|
|
3438
3452
|
}));
|
|
3439
3453
|
case 'line':
|
|
3440
|
-
return React__default.createElement(LineChart, Object.assign({
|
|
3454
|
+
return React__default.createElement(LineChart, Object.assign({
|
|
3455
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3456
|
+
}, chartProps(chart), {
|
|
3441
3457
|
theme: fuiTheme
|
|
3442
3458
|
}));
|
|
3443
3459
|
case 'area':
|
|
@@ -3451,7 +3467,9 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3451
3467
|
theme: fuiTheme
|
|
3452
3468
|
}));
|
|
3453
3469
|
case 'bubble':
|
|
3454
|
-
return React__default.createElement(BubbleChart, Object.assign({
|
|
3470
|
+
return React__default.createElement(BubbleChart, Object.assign({
|
|
3471
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3472
|
+
}, chartProps(chart), {
|
|
3455
3473
|
getRadius: function getRadius(d) {
|
|
3456
3474
|
var _d$radius;
|
|
3457
3475
|
return (_d$radius = d.radius) != null ? _d$radius : 1;
|
|
@@ -3463,6 +3481,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3463
3481
|
theme: fuiTheme,
|
|
3464
3482
|
// allow the originating chart descriptor to opt into dual axes
|
|
3465
3483
|
axesMode: (_chart$axesMode = chart.axesMode) != null ? _chart$axesMode : 'dual',
|
|
3484
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false,
|
|
3466
3485
|
data: chart.data.map(function (series) {
|
|
3467
3486
|
var _series$type;
|
|
3468
3487
|
return {
|
|
@@ -3482,7 +3501,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3482
3501
|
getRange: function getRange(d) {
|
|
3483
3502
|
var _d$min, _d$max;
|
|
3484
3503
|
return [(_d$min = d.min) != null ? _d$min : 0, (_d$max = d.max) != null ? _d$max : 0];
|
|
3485
|
-
}
|
|
3504
|
+
},
|
|
3505
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3486
3506
|
}, chartProps(chart), {
|
|
3487
3507
|
theme: fuiTheme
|
|
3488
3508
|
}));
|
|
@@ -3498,7 +3518,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3498
3518
|
getValue: function getValue(datum) {
|
|
3499
3519
|
var _datum$value;
|
|
3500
3520
|
return (_datum$value = datum.value) != null ? _datum$value : 0;
|
|
3501
|
-
}
|
|
3521
|
+
},
|
|
3522
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3502
3523
|
}, chartProps(chart), {
|
|
3503
3524
|
theme: fuiTheme
|
|
3504
3525
|
}));
|
|
@@ -3511,7 +3532,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3511
3532
|
var _datum$value2;
|
|
3512
3533
|
return (_datum$value2 = datum.value) != null ? _datum$value2 : 0;
|
|
3513
3534
|
},
|
|
3514
|
-
showDataLabels:
|
|
3535
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3515
3536
|
}, chartProps(chart), {
|
|
3516
3537
|
theme: fuiTheme
|
|
3517
3538
|
}));
|
|
@@ -3528,7 +3549,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3528
3549
|
}
|
|
3529
3550
|
}, chartProps(chart), {
|
|
3530
3551
|
theme: fuiTheme,
|
|
3531
|
-
showDataLabels: false
|
|
3552
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3532
3553
|
}));
|
|
3533
3554
|
case 'polar':
|
|
3534
3555
|
return React__default.createElement(PolarChart, {
|
|
@@ -3541,7 +3562,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3541
3562
|
return (_d$value = d.value) != null ? _d$value : 0;
|
|
3542
3563
|
},
|
|
3543
3564
|
title: chart.title,
|
|
3544
|
-
showDataLabels:
|
|
3565
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false,
|
|
3545
3566
|
theme: fuiTheme
|
|
3546
3567
|
});
|
|
3547
3568
|
case 'radar':
|
|
@@ -3555,7 +3576,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3555
3576
|
return (_d$value2 = d.value) != null ? _d$value2 : 0;
|
|
3556
3577
|
},
|
|
3557
3578
|
title: chart.title,
|
|
3558
|
-
theme: fuiTheme
|
|
3579
|
+
theme: fuiTheme,
|
|
3580
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3559
3581
|
});
|
|
3560
3582
|
default:
|
|
3561
3583
|
throw new Error("Unsupported chart type: " + type);
|
|
@@ -4171,7 +4193,8 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
4171
4193
|
}), React__default.createElement("div", {
|
|
4172
4194
|
className: styles.chartContainer,
|
|
4173
4195
|
style: {
|
|
4174
|
-
height: containerHeight
|
|
4196
|
+
height: containerHeight,
|
|
4197
|
+
paddingTop: cardContainer.chart.title ? 0 : 16
|
|
4175
4198
|
}
|
|
4176
4199
|
}, theme && theme.fontSizeBase100 && getChartComponent(cardContainer.chart, theme))));
|
|
4177
4200
|
});
|