@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
|
@@ -789,7 +789,7 @@ 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'] : ['#289CEF', '#f05075ff', '#45B0A2', '#a4262c', '#F49E31', '#A366FF', '#FCCE51', '#062843ff', '#7f7f82ff', '#376102ff'];
|
|
793
793
|
};
|
|
794
794
|
/**
|
|
795
795
|
* Returns animation configuration for instant interactions.
|
|
@@ -866,11 +866,24 @@ function createFluentTooltip(theme) {
|
|
|
866
866
|
afterLabel: function afterLabel() {
|
|
867
867
|
return '';
|
|
868
868
|
},
|
|
869
|
-
|
|
870
|
-
|
|
869
|
+
// Provide sensible defaults for tooltip label colors using dataset colors when available
|
|
870
|
+
labelColor: function labelColor(item) {
|
|
871
|
+
var _item$dataIndex, _item$dataIndex2, _ref, _ref2;
|
|
872
|
+
var ds = item.dataset || {};
|
|
873
|
+
// dataset colors can be a single value or an array per data point
|
|
874
|
+
var bg = ds.backgroundColor;
|
|
875
|
+
if (Array.isArray(bg)) bg = bg[(_item$dataIndex = item.dataIndex) != null ? _item$dataIndex : 0];
|
|
876
|
+
var border = ds.borderColor;
|
|
877
|
+
if (Array.isArray(border)) border = border[(_item$dataIndex2 = item.dataIndex) != null ? _item$dataIndex2 : 0];
|
|
878
|
+
var backgroundColor = (_ref = bg != null ? bg : ds.pointBackgroundColor) != null ? _ref : tooltipBg;
|
|
879
|
+
var borderColorOut = (_ref2 = border != null ? border : ds.pointBorderColor) != null ? _ref2 : borderColor;
|
|
880
|
+
return {
|
|
881
|
+
borderColor: borderColorOut,
|
|
882
|
+
backgroundColor: backgroundColor
|
|
883
|
+
};
|
|
871
884
|
},
|
|
872
885
|
labelTextColor: function labelTextColor() {
|
|
873
|
-
return
|
|
886
|
+
return tooltipTitleColor;
|
|
874
887
|
},
|
|
875
888
|
footer: function footer() {
|
|
876
889
|
return '';
|
|
@@ -919,13 +932,13 @@ function createFluentTooltip(theme) {
|
|
|
919
932
|
/**
|
|
920
933
|
* Returns a Chart.js ticks callback to truncate long labels and add optional prefix/suffix.
|
|
921
934
|
*/
|
|
922
|
-
var createAxisLabelFormatter = function createAxisLabelFormatter(
|
|
923
|
-
var
|
|
924
|
-
maxLength =
|
|
925
|
-
|
|
926
|
-
suffix =
|
|
927
|
-
|
|
928
|
-
prefix =
|
|
935
|
+
var createAxisLabelFormatter = function createAxisLabelFormatter(_ref3) {
|
|
936
|
+
var _ref3$maxLength = _ref3.maxLength,
|
|
937
|
+
maxLength = _ref3$maxLength === void 0 ? 12 : _ref3$maxLength,
|
|
938
|
+
_ref3$suffix = _ref3.suffix,
|
|
939
|
+
suffix = _ref3$suffix === void 0 ? '' : _ref3$suffix,
|
|
940
|
+
_ref3$prefix = _ref3.prefix,
|
|
941
|
+
prefix = _ref3$prefix === void 0 ? '' : _ref3$prefix;
|
|
929
942
|
return function (value) {
|
|
930
943
|
var label = typeof value === 'number' ? this.getLabelForValue(value) : String(value);
|
|
931
944
|
var trimmed = label.length > maxLength ? label.slice(0, maxLength) + '…' : label;
|
|
@@ -3435,7 +3448,8 @@ var chartProps = function chartProps(chart) {
|
|
|
3435
3448
|
};
|
|
3436
3449
|
var getChartComponent = function getChartComponent(chart, theme) {
|
|
3437
3450
|
var _chart$axesMode;
|
|
3438
|
-
var type = chart.type
|
|
3451
|
+
var type = chart.type,
|
|
3452
|
+
showDataLabels = chart.showDataLabels;
|
|
3439
3453
|
var fuiTheme = theme != null ? theme : reactComponents.webLightTheme;
|
|
3440
3454
|
switch (type) {
|
|
3441
3455
|
case 'bar':
|
|
@@ -3444,7 +3458,9 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3444
3458
|
theme: fuiTheme
|
|
3445
3459
|
}));
|
|
3446
3460
|
case 'line':
|
|
3447
|
-
return React__default.createElement(LineChart, Object.assign({
|
|
3461
|
+
return React__default.createElement(LineChart, Object.assign({
|
|
3462
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3463
|
+
}, chartProps(chart), {
|
|
3448
3464
|
theme: fuiTheme
|
|
3449
3465
|
}));
|
|
3450
3466
|
case 'area':
|
|
@@ -3458,7 +3474,9 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3458
3474
|
theme: fuiTheme
|
|
3459
3475
|
}));
|
|
3460
3476
|
case 'bubble':
|
|
3461
|
-
return React__default.createElement(BubbleChart, Object.assign({
|
|
3477
|
+
return React__default.createElement(BubbleChart, Object.assign({
|
|
3478
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3479
|
+
}, chartProps(chart), {
|
|
3462
3480
|
getRadius: function getRadius(d) {
|
|
3463
3481
|
var _d$radius;
|
|
3464
3482
|
return (_d$radius = d.radius) != null ? _d$radius : 1;
|
|
@@ -3470,6 +3488,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3470
3488
|
theme: fuiTheme,
|
|
3471
3489
|
// allow the originating chart descriptor to opt into dual axes
|
|
3472
3490
|
axesMode: (_chart$axesMode = chart.axesMode) != null ? _chart$axesMode : 'dual',
|
|
3491
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false,
|
|
3473
3492
|
data: chart.data.map(function (series) {
|
|
3474
3493
|
var _series$type;
|
|
3475
3494
|
return {
|
|
@@ -3489,7 +3508,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3489
3508
|
getRange: function getRange(d) {
|
|
3490
3509
|
var _d$min, _d$max;
|
|
3491
3510
|
return [(_d$min = d.min) != null ? _d$min : 0, (_d$max = d.max) != null ? _d$max : 0];
|
|
3492
|
-
}
|
|
3511
|
+
},
|
|
3512
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3493
3513
|
}, chartProps(chart), {
|
|
3494
3514
|
theme: fuiTheme
|
|
3495
3515
|
}));
|
|
@@ -3505,7 +3525,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3505
3525
|
getValue: function getValue(datum) {
|
|
3506
3526
|
var _datum$value;
|
|
3507
3527
|
return (_datum$value = datum.value) != null ? _datum$value : 0;
|
|
3508
|
-
}
|
|
3528
|
+
},
|
|
3529
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3509
3530
|
}, chartProps(chart), {
|
|
3510
3531
|
theme: fuiTheme
|
|
3511
3532
|
}));
|
|
@@ -3518,7 +3539,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3518
3539
|
var _datum$value2;
|
|
3519
3540
|
return (_datum$value2 = datum.value) != null ? _datum$value2 : 0;
|
|
3520
3541
|
},
|
|
3521
|
-
showDataLabels:
|
|
3542
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3522
3543
|
}, chartProps(chart), {
|
|
3523
3544
|
theme: fuiTheme
|
|
3524
3545
|
}));
|
|
@@ -3535,7 +3556,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3535
3556
|
}
|
|
3536
3557
|
}, chartProps(chart), {
|
|
3537
3558
|
theme: fuiTheme,
|
|
3538
|
-
showDataLabels: false
|
|
3559
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3539
3560
|
}));
|
|
3540
3561
|
case 'polar':
|
|
3541
3562
|
return React__default.createElement(PolarChart, {
|
|
@@ -3548,7 +3569,7 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3548
3569
|
return (_d$value = d.value) != null ? _d$value : 0;
|
|
3549
3570
|
},
|
|
3550
3571
|
title: chart.title,
|
|
3551
|
-
showDataLabels:
|
|
3572
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false,
|
|
3552
3573
|
theme: fuiTheme
|
|
3553
3574
|
});
|
|
3554
3575
|
case 'radar':
|
|
@@ -3562,7 +3583,8 @@ var getChartComponent = function getChartComponent(chart, theme) {
|
|
|
3562
3583
|
return (_d$value2 = d.value) != null ? _d$value2 : 0;
|
|
3563
3584
|
},
|
|
3564
3585
|
title: chart.title,
|
|
3565
|
-
theme: fuiTheme
|
|
3586
|
+
theme: fuiTheme,
|
|
3587
|
+
showDataLabels: showDataLabels != null ? showDataLabels : false
|
|
3566
3588
|
});
|
|
3567
3589
|
default:
|
|
3568
3590
|
throw new Error("Unsupported chart type: " + type);
|
|
@@ -4178,7 +4200,8 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
4178
4200
|
}), React__default.createElement("div", {
|
|
4179
4201
|
className: styles.chartContainer,
|
|
4180
4202
|
style: {
|
|
4181
|
-
height: containerHeight
|
|
4203
|
+
height: containerHeight,
|
|
4204
|
+
paddingTop: cardContainer.chart.title ? 0 : 16
|
|
4182
4205
|
}
|
|
4183
4206
|
}, theme && theme.fontSizeBase100 && getChartComponent(cardContainer.chart, theme))));
|
|
4184
4207
|
});
|