@fluentui/react-charting 5.16.44 → 5.16.45
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/CHANGELOG.json +22 -1
- package/CHANGELOG.md +12 -2
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/docs/TestPlans/GaugeChart/ComponentTests.md +31 -0
- package/lib/GaugeChart.d.ts +1 -0
- package/lib/GaugeChart.js +2 -0
- package/lib/GaugeChart.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.base.d.ts +67 -0
- package/lib/components/GaugeChart/GaugeChart.base.js +376 -0
- package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.d.ts +3 -0
- package/lib/components/GaugeChart/GaugeChart.js +5 -0
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.styles.d.ts +2 -0
- package/lib/components/GaugeChart/GaugeChart.styles.js +118 -0
- package/lib/components/GaugeChart/GaugeChart.styles.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.types.d.ts +207 -0
- package/lib/components/GaugeChart/GaugeChart.types.js +6 -0
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib/components/GaugeChart/index.d.ts +2 -0
- package/lib/components/GaugeChart/index.js +3 -0
- package/lib/components/GaugeChart/index.js.map +1 -0
- package/lib/components/LineChart/LineChart.base.js +1 -1
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.d.ts +2 -2
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.d.ts +2 -0
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +6 -3
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/LabelLink.d.ts +3 -1
- package/lib/components/LineChart/eventAnnotation/LabelLink.js +6 -3
- package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utilities/SVGTooltipText.d.ts +81 -0
- package/lib/utilities/SVGTooltipText.js +173 -0
- package/lib/utilities/SVGTooltipText.js.map +1 -0
- package/lib/utilities/utilities.d.ts +1 -0
- package/lib/utilities/utilities.js +11 -0
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/lib-amd/GaugeChart.d.ts +1 -0
- package/lib-amd/GaugeChart.js +6 -0
- package/lib-amd/GaugeChart.js.map +1 -0
- package/lib-amd/components/GaugeChart/GaugeChart.base.d.ts +67 -0
- package/lib-amd/components/GaugeChart/GaugeChart.base.js +370 -0
- package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -0
- package/lib-amd/components/GaugeChart/GaugeChart.d.ts +3 -0
- package/lib-amd/components/GaugeChart/GaugeChart.js +7 -0
- package/lib-amd/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib-amd/components/GaugeChart/GaugeChart.styles.d.ts +2 -0
- package/lib-amd/components/GaugeChart/GaugeChart.styles.js +122 -0
- package/lib-amd/components/GaugeChart/GaugeChart.styles.js.map +1 -0
- package/lib-amd/components/GaugeChart/GaugeChart.types.d.ts +207 -0
- package/lib-amd/components/GaugeChart/GaugeChart.types.js +11 -0
- package/lib-amd/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib-amd/components/GaugeChart/index.d.ts +2 -0
- package/lib-amd/components/GaugeChart/index.js +7 -0
- package/lib-amd/components/GaugeChart/index.js.map +1 -0
- package/lib-amd/components/LineChart/LineChart.base.js +1 -1
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.types.d.ts +2 -2
- package/lib-amd/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-amd/components/LineChart/eventAnnotation/EventAnnotation.d.ts +2 -0
- package/lib-amd/components/LineChart/eventAnnotation/EventAnnotation.js +6 -4
- package/lib-amd/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib-amd/components/LineChart/eventAnnotation/LabelLink.d.ts +3 -1
- package/lib-amd/components/LineChart/eventAnnotation/LabelLink.js +6 -4
- package/lib-amd/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
- package/lib-amd/index.d.ts +1 -0
- package/lib-amd/index.js +2 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/utilities/SVGTooltipText.d.ts +81 -0
- package/lib-amd/utilities/SVGTooltipText.js +174 -0
- package/lib-amd/utilities/SVGTooltipText.js.map +1 -0
- package/lib-amd/utilities/utilities.d.ts +1 -0
- package/lib-amd/utilities/utilities.js +13 -2
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-amd/version.js +1 -1
- package/lib-amd/version.js.map +1 -1
- package/lib-commonjs/GaugeChart.d.ts +1 -0
- package/lib-commonjs/GaugeChart.js +5 -0
- package/lib-commonjs/GaugeChart.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.d.ts +67 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +379 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.d.ts +3 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +8 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.styles.d.ts +2 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js +122 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.d.ts +207 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +9 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/index.d.ts +2 -0
- package/lib-commonjs/components/GaugeChart/index.js +6 -0
- package/lib-commonjs/components/GaugeChart/index.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.base.js +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.d.ts +2 -2
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.d.ts +2 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +6 -3
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.d.ts +3 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +6 -3
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -0
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.d.ts +81 -0
- package/lib-commonjs/utilities/SVGTooltipText.js +176 -0
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -0
- package/lib-commonjs/utilities/utilities.d.ts +1 -0
- package/lib-commonjs/utilities/utilities.js +13 -1
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/version.js +1 -1
- package/lib-commonjs/version.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GaugeChart/GaugeChart.types.ts +258 -0
- package/src/components/LineChart/LineChart.types.ts +2 -2
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GaugeChartBase = exports.BREAKPOINTS = exports.ARC_PADDING = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var React = require("react");
|
|
6
|
+
var shape = require("d3-shape");
|
|
7
|
+
var Utilities_1 = require("@fluentui/react/lib/Utilities");
|
|
8
|
+
var GaugeChart_types_1 = require("./GaugeChart.types");
|
|
9
|
+
var index_1 = require("../../utilities/index");
|
|
10
|
+
var index_2 = require("../Legends/index");
|
|
11
|
+
var react_focus_1 = require("@fluentui/react-focus");
|
|
12
|
+
var Callout_1 = require("@fluentui/react/lib/Callout");
|
|
13
|
+
var SVGTooltipText_1 = require("../../utilities/SVGTooltipText");
|
|
14
|
+
var d3_selection_1 = require("d3-selection");
|
|
15
|
+
var GAUGE_MARGIN = 16;
|
|
16
|
+
var LABEL_WIDTH = 36;
|
|
17
|
+
var LABEL_HEIGHT = 16;
|
|
18
|
+
var LABEL_OFFSET = 4;
|
|
19
|
+
var TITLE_OFFSET = 11;
|
|
20
|
+
var EXTRA_NEEDLE_LENGTH = 4;
|
|
21
|
+
exports.ARC_PADDING = 2;
|
|
22
|
+
exports.BREAKPOINTS = [
|
|
23
|
+
{ minRadius: 52, arcWidth: 12, fontSize: 20 },
|
|
24
|
+
{ minRadius: 70, arcWidth: 16, fontSize: 24 },
|
|
25
|
+
{ minRadius: 88, arcWidth: 20, fontSize: 32 },
|
|
26
|
+
{ minRadius: 106, arcWidth: 24, fontSize: 32 },
|
|
27
|
+
{ minRadius: 124, arcWidth: 28, fontSize: 40 },
|
|
28
|
+
{ minRadius: 142, arcWidth: 32, fontSize: 40 },
|
|
29
|
+
];
|
|
30
|
+
var getClassNames = (0, Utilities_1.classNamesFunction)();
|
|
31
|
+
var GaugeChartBase = /** @class */ (function (_super) {
|
|
32
|
+
tslib_1.__extends(GaugeChartBase, _super);
|
|
33
|
+
function GaugeChartBase(props) {
|
|
34
|
+
var _this = _super.call(this, props) || this;
|
|
35
|
+
_this._getMargins = function () {
|
|
36
|
+
var _a = _this.props, hideMinMax = _a.hideMinMax, chartTitle = _a.chartTitle, sublabel = _a.sublabel;
|
|
37
|
+
return {
|
|
38
|
+
left: (!hideMinMax ? LABEL_OFFSET + LABEL_WIDTH : 0) + GAUGE_MARGIN,
|
|
39
|
+
right: (!hideMinMax ? LABEL_OFFSET + LABEL_WIDTH : 0) + GAUGE_MARGIN,
|
|
40
|
+
top: (chartTitle ? TITLE_OFFSET + LABEL_HEIGHT : EXTRA_NEEDLE_LENGTH / 2) + GAUGE_MARGIN,
|
|
41
|
+
bottom: (sublabel ? LABEL_OFFSET + LABEL_HEIGHT : 0) + GAUGE_MARGIN,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
_this._getStylesBasedOnBreakpoint = function () {
|
|
45
|
+
for (var index = exports.BREAKPOINTS.length - 1; index >= 0; index -= 1) {
|
|
46
|
+
if (_this._outerRadius >= exports.BREAKPOINTS[index].minRadius) {
|
|
47
|
+
return {
|
|
48
|
+
arcWidth: exports.BREAKPOINTS[index].arcWidth,
|
|
49
|
+
chartValueSize: exports.BREAKPOINTS[index].fontSize,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
arcWidth: exports.BREAKPOINTS[0].arcWidth,
|
|
55
|
+
chartValueSize: exports.BREAKPOINTS[0].fontSize,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
_this._initProps = function () {
|
|
59
|
+
var _a = _this.props, _b = _a.minValue, minValue = _b === void 0 ? 0 : _b, maxValue = _a.maxValue, theme = _a.theme;
|
|
60
|
+
var segments = Array.from(_this.props.segments);
|
|
61
|
+
var total = minValue;
|
|
62
|
+
segments.forEach(function (segment, index) {
|
|
63
|
+
total += segment.size;
|
|
64
|
+
segment.color =
|
|
65
|
+
typeof segment.color !== 'undefined'
|
|
66
|
+
? (0, index_1.getColorFromToken)(segment.color, theme.isInverted)
|
|
67
|
+
: (0, index_1.getNextColor)(index, 0, theme.isInverted);
|
|
68
|
+
});
|
|
69
|
+
if (typeof maxValue !== 'undefined' && total < maxValue) {
|
|
70
|
+
segments.push({
|
|
71
|
+
legend: 'Unknown',
|
|
72
|
+
size: maxValue - total,
|
|
73
|
+
color: theme.palette.neutralLight,
|
|
74
|
+
});
|
|
75
|
+
total = maxValue;
|
|
76
|
+
}
|
|
77
|
+
var arcGenerator = shape
|
|
78
|
+
.arc()
|
|
79
|
+
.padAngle(exports.ARC_PADDING / _this._outerRadius)
|
|
80
|
+
.padRadius(_this._outerRadius);
|
|
81
|
+
var rtlSafeSegments = _this._isRTL ? Array.from(segments).reverse() : segments;
|
|
82
|
+
var prevAngle = -Math.PI / 2;
|
|
83
|
+
var arcs = rtlSafeSegments.map(function (segment, index) {
|
|
84
|
+
var endAngle = prevAngle + (segment.size / (total - minValue)) * Math.PI;
|
|
85
|
+
var d = arcGenerator({
|
|
86
|
+
innerRadius: _this._innerRadius,
|
|
87
|
+
outerRadius: _this._outerRadius,
|
|
88
|
+
startAngle: prevAngle,
|
|
89
|
+
endAngle: endAngle,
|
|
90
|
+
});
|
|
91
|
+
prevAngle = endAngle;
|
|
92
|
+
return {
|
|
93
|
+
d: d,
|
|
94
|
+
segmentIndex: _this._isRTL ? segments.length - 1 - index : index,
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
minValue: minValue,
|
|
99
|
+
maxValue: total,
|
|
100
|
+
segments: segments,
|
|
101
|
+
arcs: arcs,
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
_this._renderNeedle = function () {
|
|
105
|
+
var needleRotation = (_this._sweepFraction[0] / _this._sweepFraction[1]) * 180;
|
|
106
|
+
var rtlSafeNeedleRotation = _this._isRTL ? 180 - needleRotation : needleRotation;
|
|
107
|
+
var strokeWidth = 2;
|
|
108
|
+
var halfStrokeWidth = strokeWidth / 2;
|
|
109
|
+
var needleLength = _this._outerRadius - _this._innerRadius + EXTRA_NEEDLE_LENGTH;
|
|
110
|
+
return (React.createElement("g", { transform: "rotate(".concat(rtlSafeNeedleRotation, ", 0, 0)") },
|
|
111
|
+
React.createElement("path", { d: "\n M 0,".concat(-halfStrokeWidth - 3, "\n L ").concat(-needleLength, ",").concat(-halfStrokeWidth - 1, "\n A ").concat(halfStrokeWidth + 1, ",").concat(halfStrokeWidth + 1, ",0,0,0,").concat(-needleLength, ",").concat(halfStrokeWidth + 1, "\n L 0,").concat(halfStrokeWidth + 3, "\n A ").concat(halfStrokeWidth + 3, ",").concat(halfStrokeWidth + 3, ",0,0,0,0,").concat(-halfStrokeWidth - 3, "\n "), strokeWidth: strokeWidth, className: _this._classNames.needle, transform: "translate(".concat(-_this._innerRadius + EXTRA_NEEDLE_LENGTH / 2, ")"), "data-is-focusable": true, onFocus: function (e) { return _this._handleFocus(e, 'Needle'); }, onBlur: _this._handleBlur, onMouseEnter: function (e) { return _this._handleMouseOver(e, 'Needle'); }, onMouseMove: function (e) { return _this._handleMouseOver(e, 'Needle'); } })));
|
|
112
|
+
};
|
|
113
|
+
_this._renderLegends = function () {
|
|
114
|
+
if (_this.props.hideLegend) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
var legends = _this._segments.map(function (segment) {
|
|
118
|
+
return {
|
|
119
|
+
title: segment.legend,
|
|
120
|
+
color: segment.color,
|
|
121
|
+
action: function () {
|
|
122
|
+
if (_this.state.selectedLegend === segment.legend) {
|
|
123
|
+
_this.setState({ selectedLegend: '' });
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
_this.setState({ selectedLegend: segment.legend });
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
hoverAction: function () {
|
|
130
|
+
_this.setState({ hoveredLegend: segment.legend });
|
|
131
|
+
},
|
|
132
|
+
onMouseOutAction: function () {
|
|
133
|
+
_this.setState({ hoveredLegend: '' });
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
return (React.createElement("div", { className: _this._classNames.legendsContainer },
|
|
138
|
+
React.createElement(index_2.Legends, tslib_1.__assign({ legends: legends, centerLegends: true }, _this.props.legendProps))));
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* This function checks if the given legend is highlighted or not.
|
|
142
|
+
* A legend can be highlighted in 2 ways:
|
|
143
|
+
* 1. selection: if the user clicks on it
|
|
144
|
+
* 2. hovering: if there is no selected legend and the user hovers over it
|
|
145
|
+
*/
|
|
146
|
+
_this._legendHighlighted = function (legend) {
|
|
147
|
+
return (_this.state.selectedLegend === legend || (_this.state.selectedLegend === '' && _this.state.hoveredLegend === legend));
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* This function checks if none of the legends is selected or hovered.
|
|
151
|
+
*/
|
|
152
|
+
_this._noLegendHighlighted = function () {
|
|
153
|
+
return _this.state.selectedLegend === '' && _this.state.hoveredLegend === '';
|
|
154
|
+
};
|
|
155
|
+
_this._handleFocus = function (focusEvent, focusedElement) {
|
|
156
|
+
_this._showCallout(focusEvent.target, focusedElement, true);
|
|
157
|
+
};
|
|
158
|
+
_this._handleBlur = function () {
|
|
159
|
+
_this._hideCallout(true);
|
|
160
|
+
};
|
|
161
|
+
_this._handleMouseOver = function (mouseEvent, hoveredElement) {
|
|
162
|
+
_this._showCallout(mouseEvent.target, hoveredElement, false);
|
|
163
|
+
};
|
|
164
|
+
_this._handleMouseOut = function () {
|
|
165
|
+
_this._hideCallout(false);
|
|
166
|
+
};
|
|
167
|
+
_this._handleCalloutDismiss = function () {
|
|
168
|
+
_this._hideCallout(false);
|
|
169
|
+
};
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
171
|
+
_this._showCallout = function (target, legend, isFocusEvent) {
|
|
172
|
+
if (_this._calloutAnchor === legend) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
_this._calloutAnchor = legend;
|
|
176
|
+
var hoverXValue = 'Current value is ' +
|
|
177
|
+
(_this.props.chartValueFormat === GaugeChart_types_1.GaugeValueFormat.Fraction
|
|
178
|
+
? "".concat(((_this._sweepFraction[0] / _this._sweepFraction[1]) * 100).toFixed(), "%")
|
|
179
|
+
: "".concat(_this._sweepFraction[0], "/").concat(_this._sweepFraction[1]));
|
|
180
|
+
var total = _this._minValue;
|
|
181
|
+
var hoverYValues = _this._segments.map(function (segment, index) {
|
|
182
|
+
var yValue = {
|
|
183
|
+
legend: segment.legend,
|
|
184
|
+
y: "".concat(total + (index > 0 ? 1 : 0), " - ").concat(total + segment.size),
|
|
185
|
+
color: segment.color,
|
|
186
|
+
};
|
|
187
|
+
total += segment.size;
|
|
188
|
+
return yValue;
|
|
189
|
+
});
|
|
190
|
+
_this.setState(tslib_1.__assign({ calloutTarget: target,
|
|
191
|
+
/** Show the callout if highlighted arc is hovered/focused and Hide it if unhighlighted arc is hovered/focused */
|
|
192
|
+
isCalloutVisible: ['Needle', 'Chart value'].includes(legend) ||
|
|
193
|
+
_this.state.selectedLegend === '' ||
|
|
194
|
+
_this.state.selectedLegend === legend, hoverXValue: hoverXValue, hoverYValues: hoverYValues }, (isFocusEvent ? { focusedElement: legend } : {})));
|
|
195
|
+
};
|
|
196
|
+
_this._hideCallout = function (isBlurEvent) {
|
|
197
|
+
_this._calloutAnchor = '';
|
|
198
|
+
_this.setState(tslib_1.__assign({ calloutTarget: null, isCalloutVisible: false, hoverXValue: '', hoverYValues: [] }, (isBlurEvent ? { focusedElement: '' } : {})));
|
|
199
|
+
};
|
|
200
|
+
_this._wrapContent = function (content, id, maxWidth) {
|
|
201
|
+
var textElement = (0, d3_selection_1.select)("#".concat(id));
|
|
202
|
+
textElement.text(content);
|
|
203
|
+
if (!textElement.node()) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
var isOverflowing = false;
|
|
207
|
+
var textLength = textElement.node().getComputedTextLength();
|
|
208
|
+
while (textLength > maxWidth && content.length > 0) {
|
|
209
|
+
content = content.slice(0, -1);
|
|
210
|
+
textElement.text(content + '...');
|
|
211
|
+
isOverflowing = true;
|
|
212
|
+
textLength = textElement.node().getComputedTextLength();
|
|
213
|
+
}
|
|
214
|
+
return isOverflowing;
|
|
215
|
+
};
|
|
216
|
+
// TO DO: Write a common functional component for Multi value callout and divide sub count method
|
|
217
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
218
|
+
_this._multiValueCallout = function (calloutProps) {
|
|
219
|
+
var yValueHoverSubCountsExists = _this._yValueHoverSubCountsExists(calloutProps.YValueHover);
|
|
220
|
+
return (React.createElement("div", { className: _this._classNames.calloutContentRoot },
|
|
221
|
+
React.createElement("div", { className: _this._classNames.calloutDateTimeContainer, style: yValueHoverSubCountsExists ? { marginBottom: '11px' } : {} },
|
|
222
|
+
React.createElement("div", tslib_1.__assign({ className: _this._classNames.calloutContentX }, (0, index_1.getAccessibleDataObject)(calloutProps.xAxisCalloutAccessibilityData, 'text', false)), (0, index_1.convertToLocaleString)(calloutProps.hoverXValue, _this.props.culture))),
|
|
223
|
+
React.createElement("div", { className: _this._classNames.calloutInfoContainer, style: yValueHoverSubCountsExists ? { display: 'flex' } : {} },
|
|
224
|
+
calloutProps.YValueHover &&
|
|
225
|
+
calloutProps.YValueHover.map(function (yValue, index, yValues) {
|
|
226
|
+
var isLast = index + 1 === yValues.length;
|
|
227
|
+
var _a = yValue.shouldDrawBorderBottom, shouldDrawBorderBottom = _a === void 0 ? false : _a;
|
|
228
|
+
return (React.createElement("div", tslib_1.__assign({}, (0, index_1.getAccessibleDataObject)(yValue.callOutAccessibilityData, 'text', false), { key: "callout-content-".concat(index), style: yValueHoverSubCountsExists
|
|
229
|
+
? tslib_1.__assign({ display: 'inline-block' }, (shouldDrawBorderBottom && {
|
|
230
|
+
borderBottom: "1px solid ".concat(_this.props.theme.semanticColors.menuDivider),
|
|
231
|
+
paddingBottom: '10px',
|
|
232
|
+
})) : tslib_1.__assign({}, (shouldDrawBorderBottom && {
|
|
233
|
+
borderBottom: "1px solid ".concat(_this.props.theme.semanticColors.menuDivider),
|
|
234
|
+
paddingBottom: '10px',
|
|
235
|
+
})) }), _this._getCalloutContent(yValue, index, yValueHoverSubCountsExists, isLast)));
|
|
236
|
+
}),
|
|
237
|
+
!!calloutProps.descriptionMessage && (React.createElement("div", { className: _this._classNames.descriptionMessage }, calloutProps.descriptionMessage)))));
|
|
238
|
+
};
|
|
239
|
+
_this._margins = _this._getMargins();
|
|
240
|
+
_this._legendsHeight = !_this.props.hideLegend ? 24 : 0;
|
|
241
|
+
_this.state = {
|
|
242
|
+
hoveredLegend: '',
|
|
243
|
+
selectedLegend: '',
|
|
244
|
+
focusedElement: '',
|
|
245
|
+
calloutTarget: null,
|
|
246
|
+
isCalloutVisible: false,
|
|
247
|
+
hoverXValue: '',
|
|
248
|
+
hoverYValues: [],
|
|
249
|
+
width: 140 + _this._margins.left + _this._margins.right,
|
|
250
|
+
height: 70 + _this._margins.top + _this._margins.bottom + _this._legendsHeight,
|
|
251
|
+
};
|
|
252
|
+
_this._isRTL = (0, Utilities_1.getRTL)();
|
|
253
|
+
_this._calloutAnchor = '';
|
|
254
|
+
return _this;
|
|
255
|
+
}
|
|
256
|
+
GaugeChartBase.prototype.componentDidMount = function () {
|
|
257
|
+
if (this._rootElem) {
|
|
258
|
+
this.setState({
|
|
259
|
+
width: this._rootElem.clientWidth,
|
|
260
|
+
height: this._rootElem.clientHeight,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
GaugeChartBase.prototype.render = function () {
|
|
265
|
+
var _this = this;
|
|
266
|
+
this._margins = this._getMargins();
|
|
267
|
+
this._legendsHeight = !this.props.hideLegend ? 24 : 0;
|
|
268
|
+
var width = this.props.width || this.state.width;
|
|
269
|
+
var height = this.props.height || this.state.height;
|
|
270
|
+
this._outerRadius = Math.min((width - (this._margins.left + this._margins.right)) / 2, height - (this._margins.top + this._margins.bottom + this._legendsHeight));
|
|
271
|
+
var _a = this._getStylesBasedOnBreakpoint(), arcWidth = _a.arcWidth, chartValueSize = _a.chartValueSize;
|
|
272
|
+
this._innerRadius = this._outerRadius - arcWidth;
|
|
273
|
+
var _b = this._initProps(), minValue = _b.minValue, maxValue = _b.maxValue, segments = _b.segments, arcs = _b.arcs;
|
|
274
|
+
this._minValue = minValue;
|
|
275
|
+
this._segments = segments;
|
|
276
|
+
this._sweepFraction = [this.props.chartValue - this._minValue, maxValue - this._minValue];
|
|
277
|
+
this._classNames = getClassNames(this.props.styles, {
|
|
278
|
+
theme: this.props.theme,
|
|
279
|
+
className: this.props.className,
|
|
280
|
+
chartWidth: width,
|
|
281
|
+
chartHeight: height - this._legendsHeight,
|
|
282
|
+
chartValueSize: chartValueSize,
|
|
283
|
+
});
|
|
284
|
+
return (React.createElement("div", { className: this._classNames.root, ref: function (el) { return (_this._rootElem = el); } },
|
|
285
|
+
React.createElement(react_focus_1.FocusZone, { direction: react_focus_1.FocusZoneDirection.horizontal },
|
|
286
|
+
React.createElement("svg", { className: this._classNames.chart, role: "presentation", "aria-label": "This is a gauge chart with ".concat(this._segments.length, " section represented."), onMouseLeave: this._handleMouseOut },
|
|
287
|
+
React.createElement("g", { transform: "translate(".concat(width / 2, ", ").concat(height - (this._margins.bottom + this._legendsHeight), ")") },
|
|
288
|
+
this.props.chartTitle && (React.createElement("text", { x: 0, y: -(this._outerRadius + TITLE_OFFSET), textAnchor: "middle", className: this._classNames.chartTitle }, this.props.chartTitle)),
|
|
289
|
+
!this.props.hideMinMax && (React.createElement(React.Fragment, null,
|
|
290
|
+
React.createElement("text", { x: (this._isRTL ? 1 : -1) * (this._outerRadius + LABEL_OFFSET), y: 0, textAnchor: "end", className: this._classNames.limits, role: "img", "aria-label": "Min value: ".concat(this._minValue) }, (0, index_1.formatValueWithSIPrefix)(this._minValue)),
|
|
291
|
+
React.createElement("text", { x: (this._isRTL ? -1 : 1) * (this._outerRadius + LABEL_OFFSET), y: 0, textAnchor: "start", className: this._classNames.limits, role: "img", "aria-label": "Max value: ".concat(maxValue) }, (0, index_1.formatValueWithSIPrefix)(maxValue)))),
|
|
292
|
+
arcs.map(function (arc, index) { return (React.createElement("path", tslib_1.__assign({ key: index, d: arc.d, fill: _this._segments[arc.segmentIndex].color, fillOpacity: _this._legendHighlighted(_this._segments[arc.segmentIndex].legend) || _this._noLegendHighlighted()
|
|
293
|
+
? 1
|
|
294
|
+
: 0.1, strokeWidth: _this.state.focusedElement === _this._segments[arc.segmentIndex].legend ? exports.ARC_PADDING : 0, className: _this._classNames.segment }, (0, index_1.getAccessibleDataObject)(tslib_1.__assign({ ariaLabel: "".concat(_this._segments[arc.segmentIndex].legend, ", ").concat(_this._segments[arc.segmentIndex].size, " out of ").concat(maxValue - _this._minValue, " or ").concat(((_this._segments[arc.segmentIndex].size / (maxValue - _this._minValue)) *
|
|
295
|
+
100).toFixed(), "%") }, _this._segments[arc.segmentIndex].accessibilityData), 'img', true), { onFocus: function (e) { return _this._handleFocus(e, _this._segments[arc.segmentIndex].legend); }, onBlur: _this._handleBlur, onMouseEnter: function (e) { return _this._handleMouseOver(e, _this._segments[arc.segmentIndex].legend); }, onMouseMove: function (e) { return _this._handleMouseOver(e, _this._segments[arc.segmentIndex].legend); } }))); }),
|
|
296
|
+
this._renderNeedle(),
|
|
297
|
+
React.createElement("g", { onMouseEnter: function (e) { return _this._handleMouseOver(e, 'Chart value'); }, onMouseMove: function (e) { return _this._handleMouseOver(e, 'Chart value'); } },
|
|
298
|
+
React.createElement(SVGTooltipText_1.SVGTooltipText, { content: typeof this.props.chartValueFormat === 'function'
|
|
299
|
+
? this.props.chartValueFormat(this._sweepFraction)
|
|
300
|
+
: this.props.chartValueFormat === GaugeChart_types_1.GaugeValueFormat.Fraction
|
|
301
|
+
? "".concat(this._sweepFraction[0], "/").concat(this._sweepFraction[1])
|
|
302
|
+
: "".concat(((this._sweepFraction[0] / this._sweepFraction[1]) * 100).toFixed(), "%"), textProps: {
|
|
303
|
+
x: 0,
|
|
304
|
+
y: 0,
|
|
305
|
+
textAnchor: 'middle',
|
|
306
|
+
className: this._classNames.chartValue,
|
|
307
|
+
role: 'img',
|
|
308
|
+
'aria-label': "Current value: ".concat(this._sweepFraction[0], " out of ").concat(this._sweepFraction[1], ", or ").concat(((this._sweepFraction[0] / this._sweepFraction[1]) *
|
|
309
|
+
100).toFixed(), "%"),
|
|
310
|
+
}, maxWidth: this._innerRadius * 2 - 24, wrapContent: this._wrapContent })),
|
|
311
|
+
this.props.sublabel && (React.createElement(SVGTooltipText_1.SVGTooltipText, { content: this.props.sublabel, textProps: {
|
|
312
|
+
x: 0,
|
|
313
|
+
y: 4,
|
|
314
|
+
textAnchor: 'middle',
|
|
315
|
+
dominantBaseline: 'hanging',
|
|
316
|
+
className: this._classNames.sublabel,
|
|
317
|
+
role: 'img',
|
|
318
|
+
'aria-label': this.props.sublabel,
|
|
319
|
+
}, maxWidth: this._innerRadius * 2, wrapContent: this._wrapContent }))))),
|
|
320
|
+
this._renderLegends(),
|
|
321
|
+
!this.props.hideTooltip && this.state.isCalloutVisible && (React.createElement(Callout_1.Callout, tslib_1.__assign({ target: this.state.calloutTarget, directionalHint: Callout_1.DirectionalHint.topAutoEdge, gapSpace: 15, isBeakVisible: false, onDismiss: this._handleCalloutDismiss }, this.props.calloutProps), this._multiValueCallout({
|
|
322
|
+
hoverXValue: this.state.hoverXValue,
|
|
323
|
+
YValueHover: this.state.hoverYValues,
|
|
324
|
+
})))));
|
|
325
|
+
};
|
|
326
|
+
GaugeChartBase.prototype._yValueHoverSubCountsExists = function (yValueHover) {
|
|
327
|
+
if (yValueHover) {
|
|
328
|
+
return yValueHover.some(function (yValue) { return yValue.yAxisCalloutData && typeof yValue.yAxisCalloutData !== 'string'; });
|
|
329
|
+
}
|
|
330
|
+
return false;
|
|
331
|
+
};
|
|
332
|
+
GaugeChartBase.prototype._getCalloutContent = function (xValue, index, yValueHoverSubCountsExists, isLast) {
|
|
333
|
+
var marginStyle = isLast ? {} : { marginRight: '16px' };
|
|
334
|
+
var toDrawShape = xValue.index !== undefined && xValue.index !== -1;
|
|
335
|
+
var _classNames = getClassNames(this.props.styles, {
|
|
336
|
+
theme: this.props.theme,
|
|
337
|
+
lineColor: xValue.color,
|
|
338
|
+
toDrawShape: toDrawShape,
|
|
339
|
+
});
|
|
340
|
+
var culture = this.props.culture;
|
|
341
|
+
var yValue = (0, index_1.convertToLocaleString)(xValue.y, culture);
|
|
342
|
+
if (!xValue.yAxisCalloutData || typeof xValue.yAxisCalloutData === 'string') {
|
|
343
|
+
return (React.createElement("div", { style: yValueHoverSubCountsExists ? marginStyle : {} },
|
|
344
|
+
yValueHoverSubCountsExists && (React.createElement("div", { className: "ms-fontWeight-semibold", style: { fontSize: '12pt' } },
|
|
345
|
+
xValue.legend,
|
|
346
|
+
" (",
|
|
347
|
+
yValue,
|
|
348
|
+
")")),
|
|
349
|
+
React.createElement("div", { id: "".concat(index, "_").concat(xValue.y), className: _classNames.calloutBlockContainer },
|
|
350
|
+
toDrawShape && (React.createElement(index_2.Shape, { svgProps: {
|
|
351
|
+
className: _classNames.shapeStyles,
|
|
352
|
+
}, pathProps: { fill: xValue.color }, shape: index_1.Points[xValue.index % Object.keys(index_1.pointTypes).length] })),
|
|
353
|
+
React.createElement("div", null,
|
|
354
|
+
React.createElement("div", { className: _classNames.calloutlegendText },
|
|
355
|
+
" ",
|
|
356
|
+
xValue.legend),
|
|
357
|
+
React.createElement("div", { className: _classNames.calloutContentY }, (0, index_1.convertToLocaleString)(xValue.yAxisCalloutData ? xValue.yAxisCalloutData : xValue.y || xValue.data, culture))))));
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
var subcounts_1 = xValue.yAxisCalloutData;
|
|
361
|
+
return (React.createElement("div", { style: marginStyle },
|
|
362
|
+
React.createElement("div", { className: "ms-fontWeight-semibold", style: { fontSize: '12pt' } },
|
|
363
|
+
xValue.legend,
|
|
364
|
+
" (",
|
|
365
|
+
yValue,
|
|
366
|
+
")"),
|
|
367
|
+
Object.keys(subcounts_1).map(function (subcountName) {
|
|
368
|
+
return (React.createElement("div", { key: subcountName, className: _classNames.calloutBlockContainer },
|
|
369
|
+
React.createElement("div", { className: _classNames.calloutlegendText },
|
|
370
|
+
" ",
|
|
371
|
+
(0, index_1.convertToLocaleString)(subcountName, culture)),
|
|
372
|
+
React.createElement("div", { className: _classNames.calloutContentY }, (0, index_1.convertToLocaleString)(subcounts_1[subcountName], culture))));
|
|
373
|
+
})));
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
return GaugeChartBase;
|
|
377
|
+
}(React.Component));
|
|
378
|
+
exports.GaugeChartBase = GaugeChartBase;
|
|
379
|
+
//# sourceMappingURL=GaugeChart.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GaugeChart.base.js","sourceRoot":"../src/","sources":["components/GaugeChart/GaugeChart.base.tsx"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,gCAAkC;AAClC,2DAA2E;AAC3E,uDAM4B;AAE5B,+CAQ+B;AAC/B,0CAAwE;AACxE,qDAAsE;AACtE,uDAAuE;AAEvE,iEAAgE;AAChE,6CAAkD;AAElD,IAAM,YAAY,GAAG,EAAE,CAAC;AACxB,IAAM,WAAW,GAAG,EAAE,CAAC;AACvB,IAAM,YAAY,GAAG,EAAE,CAAC;AACxB,IAAM,YAAY,GAAG,CAAC,CAAC;AACvB,IAAM,YAAY,GAAG,EAAE,CAAC;AACxB,IAAM,mBAAmB,GAAG,CAAC,CAAC;AACjB,QAAA,WAAW,GAAG,CAAC,CAAC;AAChB,QAAA,WAAW,GAAG;IACzB,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC7C,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC7C,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC7C,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9C,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9C,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EA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C,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,EAC3E,OAAO,CACR,CACG,CACF,CACF,CACF,CACP,CAAC;SACH;aAAM;YACL,IAAM,WAAS,GAA6B,MAAM,CAAC,gBAA4C,CAAC;YAChG,OAAO,CACL,6BAAK,KAAK,EAAE,WAAW;gBACrB,6BAAK,SAAS,EAAC,wBAAwB,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE;oBAChE,MAAM,CAAC,MAAO;;oBAAI,MAAM;wBACrB;gBACL,MAAM,CAAC,IAAI,CAAC,WAAS,CAAC,CAAC,GAAG,CAAC,UAAC,YAAoB;oBAC/C,OAAO,CACL,6BAAK,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC,qBAAqB;wBAClE,6BAAK,SAAS,EAAE,WAAW,CAAC,iBAAiB;;4BAAI,IAAA,6BAAqB,EAAC,YAAY,EAAE,OAAO,CAAC,CAAO;wBACpG,6BAAK,SAAS,EAAE,WAAW,CAAC,eAAe,IACxC,IAAA,6BAAqB,EAAC,WAAS,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CACpD,CACF,CACP,CAAC;gBACJ,CAAC,CAAC,CACE,CACP,CAAC;SACH;IACH,CAAC;IACH,qBAAC;AAAD,CAAC,AAllBD,CAAoC,KAAK,CAAC,SAAS,GAklBlD;AAllBY,wCAAc","sourcesContent":["import * as React from 'react';\nimport * as shape from 'd3-shape';\nimport { classNamesFunction, getRTL } from '@fluentui/react/lib/Utilities';\nimport {\n IGaugeChartProps,\n IGaugeChartSegment,\n IGaugeChartStyleProps,\n IGaugeChartStyles,\n GaugeValueFormat,\n} from './GaugeChart.types';\nimport { IProcessedStyleSet } from '@fluentui/react/lib/Styling';\nimport {\n Points,\n convertToLocaleString,\n formatValueWithSIPrefix,\n getAccessibleDataObject,\n getColorFromToken,\n getNextColor,\n pointTypes,\n} from '../../utilities/index';\nimport { ILegend, LegendShape, Legends, Shape } from '../Legends/index';\nimport { FocusZone, FocusZoneDirection } from '@fluentui/react-focus';\nimport { Callout, DirectionalHint } from '@fluentui/react/lib/Callout';\nimport { IYValueHover } from '../../index';\nimport { SVGTooltipText } from '../../utilities/SVGTooltipText';\nimport { select as d3Select } from 'd3-selection';\n\nconst GAUGE_MARGIN = 16;\nconst LABEL_WIDTH = 36;\nconst LABEL_HEIGHT = 16;\nconst LABEL_OFFSET = 4;\nconst TITLE_OFFSET = 11;\nconst EXTRA_NEEDLE_LENGTH = 4;\nexport const ARC_PADDING = 2;\nexport const BREAKPOINTS = [\n { minRadius: 52, arcWidth: 12, fontSize: 20 },\n { minRadius: 70, arcWidth: 16, fontSize: 24 },\n { minRadius: 88, arcWidth: 20, fontSize: 32 },\n { minRadius: 106, arcWidth: 24, fontSize: 32 },\n { minRadius: 124, arcWidth: 28, fontSize: 40 },\n { minRadius: 142, arcWidth: 32, fontSize: 40 },\n];\n\nconst getClassNames = classNamesFunction<IGaugeChartStyleProps, IGaugeChartStyles>();\n\ninterface IYValue extends Omit<IYValueHover, 'y'> {\n y?: string | number;\n}\nexport interface IGaugeChartState {\n hoveredLegend: string;\n selectedLegend: string;\n focusedElement?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n calloutTarget: any;\n isCalloutVisible: boolean;\n hoverXValue: string | number;\n hoverYValues: IYValue[];\n width: number;\n height: number;\n}\n\nexport class GaugeChartBase extends React.Component<IGaugeChartProps, IGaugeChartState> {\n private _classNames: IProcessedStyleSet<IGaugeChartStyles>;\n private _isRTL: boolean;\n private _innerRadius: number;\n private _outerRadius: number;\n private _minValue: number;\n private _segments: IGaugeChartSegment[];\n private _sweepFraction: number[];\n private _calloutAnchor: string;\n private _rootElem: HTMLDivElement | null;\n private _margins: { left: number; right: number; top: number; bottom: number };\n private _legendsHeight: number;\n\n constructor(props: IGaugeChartProps) {\n super(props);\n\n this._margins = this._getMargins();\n this._legendsHeight = !this.props.hideLegend ? 24 : 0;\n\n this.state = {\n hoveredLegend: '',\n selectedLegend: '',\n focusedElement: '',\n calloutTarget: null,\n isCalloutVisible: false,\n hoverXValue: '',\n hoverYValues: [],\n width: 140 + this._margins.left + this._margins.right,\n height: 70 + this._margins.top + this._margins.bottom + this._legendsHeight,\n };\n\n this._isRTL = getRTL();\n this._calloutAnchor = '';\n }\n\n public componentDidMount(): void {\n if (this._rootElem) {\n this.setState({\n width: this._rootElem.clientWidth,\n height: this._rootElem.clientHeight,\n });\n }\n }\n\n public render(): React.ReactNode {\n this._margins = this._getMargins();\n this._legendsHeight = !this.props.hideLegend ? 24 : 0;\n\n const width = this.props.width || this.state.width;\n const height = this.props.height || this.state.height;\n\n this._outerRadius = Math.min(\n (width - (this._margins.left + this._margins.right)) / 2,\n height - (this._margins.top + this._margins.bottom + this._legendsHeight),\n );\n\n const { arcWidth, chartValueSize } = this._getStylesBasedOnBreakpoint();\n this._innerRadius = this._outerRadius - arcWidth;\n\n const { minValue, maxValue, segments, arcs } = this._initProps();\n this._minValue = minValue;\n this._segments = segments;\n this._sweepFraction = [this.props.chartValue - this._minValue, maxValue - this._minValue];\n\n this._classNames = getClassNames(this.props.styles!, {\n theme: this.props.theme!,\n className: this.props.className,\n chartWidth: width,\n chartHeight: height - this._legendsHeight,\n chartValueSize,\n });\n\n return (\n <div className={this._classNames.root} ref={el => (this._rootElem = el)}>\n <FocusZone direction={FocusZoneDirection.horizontal}>\n <svg\n className={this._classNames.chart}\n role=\"presentation\"\n aria-label={`This is a gauge chart with ${this._segments.length} section represented.`}\n onMouseLeave={this._handleMouseOut}\n >\n <g transform={`translate(${width / 2}, ${height - (this._margins.bottom + this._legendsHeight)})`}>\n {this.props.chartTitle && (\n <text\n x={0}\n y={-(this._outerRadius + TITLE_OFFSET)}\n textAnchor=\"middle\"\n className={this._classNames.chartTitle}\n >\n {this.props.chartTitle}\n </text>\n )}\n {!this.props.hideMinMax && (\n <>\n <text\n x={(this._isRTL ? 1 : -1) * (this._outerRadius + LABEL_OFFSET)}\n y={0}\n textAnchor=\"end\"\n className={this._classNames.limits}\n role=\"img\"\n aria-label={`Min value: ${this._minValue}`}\n >\n {formatValueWithSIPrefix(this._minValue)}\n </text>\n <text\n x={(this._isRTL ? -1 : 1) * (this._outerRadius + LABEL_OFFSET)}\n y={0}\n textAnchor=\"start\"\n className={this._classNames.limits}\n role=\"img\"\n aria-label={`Max value: ${maxValue}`}\n >\n {formatValueWithSIPrefix(maxValue)}\n </text>\n </>\n )}\n {arcs.map((arc, index) => (\n <path\n key={index}\n d={arc.d}\n fill={this._segments[arc.segmentIndex].color}\n fillOpacity={\n this._legendHighlighted(this._segments[arc.segmentIndex].legend) || this._noLegendHighlighted()\n ? 1\n : 0.1\n }\n strokeWidth={this.state.focusedElement === this._segments[arc.segmentIndex].legend ? ARC_PADDING : 0}\n className={this._classNames.segment}\n {...getAccessibleDataObject(\n {\n ariaLabel: `${this._segments[arc.segmentIndex].legend}, ${\n this._segments[arc.segmentIndex].size\n } out of ${maxValue - this._minValue} or ${(\n (this._segments[arc.segmentIndex].size / (maxValue - this._minValue)) *\n 100\n ).toFixed()}%`,\n ...this._segments[arc.segmentIndex].accessibilityData,\n },\n 'img',\n true,\n )}\n onFocus={e => this._handleFocus(e, this._segments[arc.segmentIndex].legend)}\n onBlur={this._handleBlur}\n onMouseEnter={e => this._handleMouseOver(e, this._segments[arc.segmentIndex].legend)}\n onMouseMove={e => this._handleMouseOver(e, this._segments[arc.segmentIndex].legend)}\n />\n ))}\n {this._renderNeedle()}\n <g\n onMouseEnter={e => this._handleMouseOver(e, 'Chart value')}\n onMouseMove={e => this._handleMouseOver(e, 'Chart value')}\n >\n <SVGTooltipText\n content={\n typeof this.props.chartValueFormat === 'function'\n ? this.props.chartValueFormat(this._sweepFraction)\n : this.props.chartValueFormat === GaugeValueFormat.Fraction\n ? `${this._sweepFraction[0]}/${this._sweepFraction[1]}`\n : `${((this._sweepFraction[0] / this._sweepFraction[1]) * 100).toFixed()}%`\n }\n textProps={{\n x: 0,\n y: 0,\n textAnchor: 'middle',\n className: this._classNames.chartValue,\n role: 'img',\n 'aria-label': `Current value: ${this._sweepFraction[0]} out of ${this._sweepFraction[1]}, or ${(\n (this._sweepFraction[0] / this._sweepFraction[1]) *\n 100\n ).toFixed()}%`,\n }}\n maxWidth={this._innerRadius * 2 - 24}\n wrapContent={this._wrapContent}\n />\n </g>\n {this.props.sublabel && (\n <SVGTooltipText\n content={this.props.sublabel}\n textProps={{\n x: 0,\n y: 4,\n textAnchor: 'middle',\n dominantBaseline: 'hanging',\n className: this._classNames.sublabel,\n role: 'img',\n 'aria-label': this.props.sublabel,\n }}\n maxWidth={this._innerRadius * 2}\n wrapContent={this._wrapContent}\n />\n )}\n </g>\n </svg>\n </FocusZone>\n {this._renderLegends()}\n {!this.props.hideTooltip && this.state.isCalloutVisible && (\n <Callout\n target={this.state.calloutTarget}\n directionalHint={DirectionalHint.topAutoEdge}\n gapSpace={15}\n isBeakVisible={false}\n onDismiss={this._handleCalloutDismiss}\n {...this.props.calloutProps}\n >\n {this._multiValueCallout({\n hoverXValue: this.state.hoverXValue,\n YValueHover: this.state.hoverYValues,\n })}\n </Callout>\n )}\n </div>\n );\n }\n\n private _getMargins = () => {\n const { hideMinMax, chartTitle, sublabel } = this.props;\n\n return {\n left: (!hideMinMax ? LABEL_OFFSET + LABEL_WIDTH : 0) + GAUGE_MARGIN,\n right: (!hideMinMax ? LABEL_OFFSET + LABEL_WIDTH : 0) + GAUGE_MARGIN,\n top: (chartTitle ? TITLE_OFFSET + LABEL_HEIGHT : EXTRA_NEEDLE_LENGTH / 2) + GAUGE_MARGIN,\n bottom: (sublabel ? LABEL_OFFSET + LABEL_HEIGHT : 0) + GAUGE_MARGIN,\n };\n };\n\n private _getStylesBasedOnBreakpoint = () => {\n for (let index = BREAKPOINTS.length - 1; index >= 0; index -= 1) {\n if (this._outerRadius >= BREAKPOINTS[index].minRadius) {\n return {\n arcWidth: BREAKPOINTS[index].arcWidth,\n chartValueSize: BREAKPOINTS[index].fontSize,\n };\n }\n }\n return {\n arcWidth: BREAKPOINTS[0].arcWidth,\n chartValueSize: BREAKPOINTS[0].fontSize,\n };\n };\n\n private _initProps = () => {\n const { minValue = 0, maxValue, theme } = this.props;\n const segments = Array.from(this.props.segments);\n\n let total = minValue;\n segments.forEach((segment, index) => {\n total += segment.size;\n segment.color =\n typeof segment.color !== 'undefined'\n ? getColorFromToken(segment.color, theme!.isInverted)\n : getNextColor(index, 0, theme!.isInverted);\n });\n if (typeof maxValue !== 'undefined' && total < maxValue) {\n segments.push({\n legend: 'Unknown',\n size: maxValue - total,\n color: theme!.palette.neutralLight,\n });\n total = maxValue;\n }\n\n const arcGenerator = shape\n .arc()\n .padAngle(ARC_PADDING / this._outerRadius)\n .padRadius(this._outerRadius);\n const rtlSafeSegments = this._isRTL ? Array.from(segments).reverse() : segments;\n let prevAngle = -Math.PI / 2;\n const arcs = rtlSafeSegments.map((segment, index) => {\n const endAngle = prevAngle + (segment.size / (total - minValue)) * Math.PI;\n const d = arcGenerator({\n innerRadius: this._innerRadius,\n outerRadius: this._outerRadius,\n startAngle: prevAngle,\n endAngle,\n })!;\n prevAngle = endAngle;\n return {\n d,\n segmentIndex: this._isRTL ? segments.length - 1 - index : index,\n };\n });\n\n return {\n minValue,\n maxValue: total,\n segments,\n arcs,\n };\n };\n\n private _renderNeedle = () => {\n const needleRotation = (this._sweepFraction[0] / this._sweepFraction[1]) * 180;\n const rtlSafeNeedleRotation = this._isRTL ? 180 - needleRotation : needleRotation;\n const strokeWidth = 2;\n const halfStrokeWidth = strokeWidth / 2;\n const needleLength = this._outerRadius - this._innerRadius + EXTRA_NEEDLE_LENGTH;\n\n return (\n <g transform={`rotate(${rtlSafeNeedleRotation}, 0, 0)`}>\n <path\n d={`\n M 0,${-halfStrokeWidth - 3}\n L ${-needleLength},${-halfStrokeWidth - 1}\n A ${halfStrokeWidth + 1},${halfStrokeWidth + 1},0,0,0,${-needleLength},${halfStrokeWidth + 1}\n L 0,${halfStrokeWidth + 3}\n A ${halfStrokeWidth + 3},${halfStrokeWidth + 3},0,0,0,0,${-halfStrokeWidth - 3}\n `}\n strokeWidth={strokeWidth}\n className={this._classNames.needle}\n transform={`translate(${-this._innerRadius + EXTRA_NEEDLE_LENGTH / 2})`}\n data-is-focusable={true}\n onFocus={e => this._handleFocus(e, 'Needle')}\n onBlur={this._handleBlur}\n onMouseEnter={e => this._handleMouseOver(e, 'Needle')}\n onMouseMove={e => this._handleMouseOver(e, 'Needle')}\n />\n </g>\n );\n };\n\n private _renderLegends = () => {\n if (this.props.hideLegend) {\n return null;\n }\n\n const legends: ILegend[] = this._segments.map(segment => {\n return {\n title: segment.legend,\n color: segment.color!,\n action: () => {\n if (this.state.selectedLegend === segment.legend) {\n this.setState({ selectedLegend: '' });\n } else {\n this.setState({ selectedLegend: segment.legend });\n }\n },\n hoverAction: () => {\n this.setState({ hoveredLegend: segment.legend });\n },\n onMouseOutAction: () => {\n this.setState({ hoveredLegend: '' });\n },\n };\n });\n\n return (\n <div className={this._classNames.legendsContainer}>\n <Legends legends={legends} centerLegends {...this.props.legendProps} />\n </div>\n );\n };\n\n /**\n * This function checks if the given legend is highlighted or not.\n * A legend can be highlighted in 2 ways:\n * 1. selection: if the user clicks on it\n * 2. hovering: if there is no selected legend and the user hovers over it\n */\n private _legendHighlighted = (legend: string) => {\n return (\n this.state.selectedLegend === legend || (this.state.selectedLegend === '' && this.state.hoveredLegend === legend)\n );\n };\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n private _noLegendHighlighted = () => {\n return this.state.selectedLegend === '' && this.state.hoveredLegend === '';\n };\n\n private _handleFocus = (focusEvent: React.FocusEvent<SVGElement>, focusedElement: string) => {\n this._showCallout(focusEvent.target, focusedElement, true);\n };\n\n private _handleBlur = () => {\n this._hideCallout(true);\n };\n\n private _handleMouseOver = (mouseEvent: React.MouseEvent<SVGElement>, hoveredElement: string) => {\n this._showCallout(mouseEvent.target, hoveredElement, false);\n };\n\n private _handleMouseOut = () => {\n this._hideCallout(false);\n };\n\n private _handleCalloutDismiss = () => {\n this._hideCallout(false);\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _showCallout = (target: any, legend: string, isFocusEvent: boolean) => {\n if (this._calloutAnchor === legend) {\n return;\n }\n\n this._calloutAnchor = legend;\n const hoverXValue: string =\n 'Current value is ' +\n (this.props.chartValueFormat === GaugeValueFormat.Fraction\n ? `${((this._sweepFraction[0] / this._sweepFraction[1]) * 100).toFixed()}%`\n : `${this._sweepFraction[0]}/${this._sweepFraction[1]}`);\n let total = this._minValue;\n const hoverYValues: IYValue[] = this._segments.map((segment, index) => {\n const yValue: IYValue = {\n legend: segment.legend,\n y: `${total + (index > 0 ? 1 : 0)} - ${total + segment.size}`,\n color: segment.color,\n };\n total += segment.size;\n return yValue;\n });\n this.setState({\n calloutTarget: target,\n /** Show the callout if highlighted arc is hovered/focused and Hide it if unhighlighted arc is hovered/focused */\n isCalloutVisible:\n ['Needle', 'Chart value'].includes(legend) ||\n this.state.selectedLegend === '' ||\n this.state.selectedLegend === legend,\n hoverXValue,\n hoverYValues,\n ...(isFocusEvent ? { focusedElement: legend } : {}),\n });\n };\n\n private _hideCallout = (isBlurEvent?: boolean) => {\n this._calloutAnchor = '';\n this.setState({\n calloutTarget: null,\n isCalloutVisible: false,\n hoverXValue: '',\n hoverYValues: [],\n ...(isBlurEvent ? { focusedElement: '' } : {}),\n });\n };\n\n private _wrapContent = (content: string, id: string, maxWidth: number) => {\n const textElement = d3Select<SVGTextElement, {}>(`#${id}`);\n textElement.text(content);\n if (!textElement.node()) {\n return false;\n }\n\n let isOverflowing = false;\n let textLength = textElement.node()!.getComputedTextLength();\n while (textLength > maxWidth && content.length > 0) {\n content = content.slice(0, -1);\n textElement.text(content + '...');\n isOverflowing = true;\n textLength = textElement.node()!.getComputedTextLength();\n }\n return isOverflowing;\n };\n\n // TO DO: Write a common functional component for Multi value callout and divide sub count method\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _multiValueCallout = (calloutProps: any) => {\n const yValueHoverSubCountsExists: boolean = this._yValueHoverSubCountsExists(calloutProps.YValueHover);\n return (\n <div className={this._classNames.calloutContentRoot}>\n <div\n className={this._classNames.calloutDateTimeContainer}\n style={yValueHoverSubCountsExists ? { marginBottom: '11px' } : {}}\n >\n <div\n className={this._classNames.calloutContentX}\n {...getAccessibleDataObject(calloutProps!.xAxisCalloutAccessibilityData, 'text', false)}\n >\n {convertToLocaleString(calloutProps!.hoverXValue, this.props.culture)}\n </div>\n </div>\n <div\n className={this._classNames.calloutInfoContainer}\n style={yValueHoverSubCountsExists ? { display: 'flex' } : {}}\n >\n {calloutProps!.YValueHover &&\n calloutProps!.YValueHover.map((yValue: IYValueHover, index: number, yValues: IYValueHover[]) => {\n const isLast: boolean = index + 1 === yValues.length;\n const { shouldDrawBorderBottom = false } = yValue;\n return (\n <div\n {...getAccessibleDataObject(yValue.callOutAccessibilityData, 'text', false)}\n key={`callout-content-${index}`}\n style={\n yValueHoverSubCountsExists\n ? {\n display: 'inline-block',\n ...(shouldDrawBorderBottom && {\n borderBottom: `1px solid ${this.props.theme!.semanticColors.menuDivider}`,\n paddingBottom: '10px',\n }),\n }\n : {\n ...(shouldDrawBorderBottom && {\n borderBottom: `1px solid ${this.props.theme!.semanticColors.menuDivider}`,\n paddingBottom: '10px',\n }),\n }\n }\n >\n {this._getCalloutContent(yValue, index, yValueHoverSubCountsExists, isLast)}\n </div>\n );\n })}\n {!!calloutProps.descriptionMessage && (\n <div className={this._classNames.descriptionMessage}>{calloutProps.descriptionMessage}</div>\n )}\n </div>\n </div>\n );\n };\n\n private _yValueHoverSubCountsExists(yValueHover?: IYValueHover[]) {\n if (yValueHover) {\n return yValueHover.some(\n (yValue: {\n legend?: string;\n y?: number;\n color?: string;\n yAxisCalloutData?: string | { [id: string]: number };\n }) => yValue.yAxisCalloutData && typeof yValue.yAxisCalloutData !== 'string',\n );\n }\n return false;\n }\n\n private _getCalloutContent(\n xValue: IYValueHover,\n index: number,\n yValueHoverSubCountsExists: boolean,\n isLast: boolean,\n ): React.ReactNode {\n const marginStyle: React.CSSProperties = isLast ? {} : { marginRight: '16px' };\n const toDrawShape = xValue.index !== undefined && xValue.index !== -1;\n const _classNames = getClassNames(this.props.styles!, {\n theme: this.props.theme!,\n lineColor: xValue.color,\n toDrawShape,\n });\n\n const { culture } = this.props;\n const yValue = convertToLocaleString(xValue.y, culture);\n if (!xValue.yAxisCalloutData || typeof xValue.yAxisCalloutData === 'string') {\n return (\n <div style={yValueHoverSubCountsExists ? marginStyle : {}}>\n {yValueHoverSubCountsExists && (\n <div className=\"ms-fontWeight-semibold\" style={{ fontSize: '12pt' }}>\n {xValue.legend!} ({yValue})\n </div>\n )}\n <div id={`${index}_${xValue.y}`} className={_classNames.calloutBlockContainer}>\n {toDrawShape && (\n <Shape\n svgProps={{\n className: _classNames.shapeStyles,\n }}\n pathProps={{ fill: xValue.color }}\n shape={Points[xValue.index! % Object.keys(pointTypes).length] as LegendShape}\n />\n )}\n <div>\n <div className={_classNames.calloutlegendText}> {xValue.legend}</div>\n <div className={_classNames.calloutContentY}>\n {convertToLocaleString(\n xValue.yAxisCalloutData ? xValue.yAxisCalloutData : xValue.y || xValue.data,\n culture,\n )}\n </div>\n </div>\n </div>\n </div>\n );\n } else {\n const subcounts: { [id: string]: number } = xValue.yAxisCalloutData as { [id: string]: number };\n return (\n <div style={marginStyle}>\n <div className=\"ms-fontWeight-semibold\" style={{ fontSize: '12pt' }}>\n {xValue.legend!} ({yValue})\n </div>\n {Object.keys(subcounts).map((subcountName: string) => {\n return (\n <div key={subcountName} className={_classNames.calloutBlockContainer}>\n <div className={_classNames.calloutlegendText}> {convertToLocaleString(subcountName, culture)}</div>\n <div className={_classNames.calloutContentY}>\n {convertToLocaleString(subcounts[subcountName], culture)}\n </div>\n </div>\n );\n })}\n </div>\n );\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GaugeChart = void 0;
|
|
4
|
+
var react_1 = require("@fluentui/react");
|
|
5
|
+
var GaugeChart_base_1 = require("./GaugeChart.base");
|
|
6
|
+
var GaugeChart_styles_1 = require("./GaugeChart.styles");
|
|
7
|
+
exports.GaugeChart = (0, react_1.styled)(GaugeChart_base_1.GaugeChartBase, GaugeChart_styles_1.getStyles);
|
|
8
|
+
//# sourceMappingURL=GaugeChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GaugeChart.js","sourceRoot":"../src/","sources":["components/GaugeChart/GaugeChart.tsx"],"names":[],"mappings":";;;AAAA,yCAAyC;AAEzC,qDAAmD;AACnD,yDAAgD;AAGnC,QAAA,UAAU,GAA8C,IAAA,cAAM,EAIzE,gCAAc,EAAE,6BAAS,CAAC,CAAC","sourcesContent":["import { styled } from '@fluentui/react';\nimport * as React from 'react';\nimport { GaugeChartBase } from './GaugeChart.base';\nimport { getStyles } from './GaugeChart.styles';\nimport { IGaugeChartProps, IGaugeChartStyleProps, IGaugeChartStyles } from './GaugeChart.types';\n\nexport const GaugeChart: React.FunctionComponent<IGaugeChartProps> = styled<\n IGaugeChartProps,\n IGaugeChartStyleProps,\n IGaugeChartStyles\n>(GaugeChartBase, getStyles);\n"]}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStyles = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = require("@fluentui/react");
|
|
6
|
+
var getStyles = function (props) {
|
|
7
|
+
var _a, _b, _c, _d;
|
|
8
|
+
var theme = props.theme, chartValueSize = props.chartValueSize, chartWidth = props.chartWidth, chartHeight = props.chartHeight, className = props.className, lineColor = props.lineColor, toDrawShape = props.toDrawShape;
|
|
9
|
+
return {
|
|
10
|
+
root: [
|
|
11
|
+
theme.fonts.medium,
|
|
12
|
+
'ms-GaugeChart',
|
|
13
|
+
{
|
|
14
|
+
width: '100%',
|
|
15
|
+
height: '100%',
|
|
16
|
+
},
|
|
17
|
+
className,
|
|
18
|
+
],
|
|
19
|
+
chart: {
|
|
20
|
+
display: 'block',
|
|
21
|
+
width: chartWidth,
|
|
22
|
+
height: chartHeight,
|
|
23
|
+
},
|
|
24
|
+
limits: {
|
|
25
|
+
fontSize: react_1.FontSizes.small,
|
|
26
|
+
fontWeight: react_1.FontWeights.semibold,
|
|
27
|
+
fill: theme.palette.neutralPrimary,
|
|
28
|
+
},
|
|
29
|
+
chartValue: {
|
|
30
|
+
fontSize: chartValueSize,
|
|
31
|
+
fontWeight: react_1.FontWeights.semibold,
|
|
32
|
+
fill: theme.palette.neutralPrimary,
|
|
33
|
+
},
|
|
34
|
+
sublabel: {
|
|
35
|
+
fontSize: react_1.FontSizes.small,
|
|
36
|
+
fontWeight: react_1.FontWeights.semibold,
|
|
37
|
+
fill: theme.palette.neutralPrimary,
|
|
38
|
+
},
|
|
39
|
+
needle: {
|
|
40
|
+
fill: theme.palette.black,
|
|
41
|
+
stroke: theme.palette.white,
|
|
42
|
+
},
|
|
43
|
+
chartTitle: {
|
|
44
|
+
fontSize: react_1.FontSizes.small,
|
|
45
|
+
fill: theme.palette.neutralPrimary,
|
|
46
|
+
},
|
|
47
|
+
segment: {
|
|
48
|
+
outline: 'none',
|
|
49
|
+
stroke: theme.semanticColors.focusBorder,
|
|
50
|
+
},
|
|
51
|
+
legendsContainer: {
|
|
52
|
+
width: chartWidth,
|
|
53
|
+
},
|
|
54
|
+
calloutContentRoot: [
|
|
55
|
+
{
|
|
56
|
+
display: 'grid',
|
|
57
|
+
overflow: 'hidden',
|
|
58
|
+
padding: '11px 16px 10px 16px',
|
|
59
|
+
backgroundColor: theme.semanticColors.bodyBackground,
|
|
60
|
+
backgroundBlendMode: 'normal, luminosity',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
calloutDateTimeContainer: {
|
|
64
|
+
display: 'flex',
|
|
65
|
+
flexDirection: 'row',
|
|
66
|
+
justifyContent: 'space-between',
|
|
67
|
+
},
|
|
68
|
+
calloutContentX: [
|
|
69
|
+
tslib_1.__assign(tslib_1.__assign({}, theme.fonts.small), { lineHeight: '16px', opacity: '0.8', color: theme.semanticColors.bodySubtext }),
|
|
70
|
+
],
|
|
71
|
+
calloutBlockContainer: [
|
|
72
|
+
theme.fonts.mediumPlus,
|
|
73
|
+
{
|
|
74
|
+
marginTop: '13px',
|
|
75
|
+
color: theme.semanticColors.bodyText,
|
|
76
|
+
},
|
|
77
|
+
!toDrawShape && {
|
|
78
|
+
selectors: (_a = {},
|
|
79
|
+
_a[react_1.HighContrastSelector] = {
|
|
80
|
+
forcedColorAdjust: 'none',
|
|
81
|
+
},
|
|
82
|
+
_a),
|
|
83
|
+
borderLeft: "4px solid ".concat(lineColor),
|
|
84
|
+
paddingLeft: '8px',
|
|
85
|
+
},
|
|
86
|
+
toDrawShape && {
|
|
87
|
+
display: 'flex',
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
shapeStyles: {
|
|
91
|
+
marginRight: '8px',
|
|
92
|
+
},
|
|
93
|
+
calloutlegendText: tslib_1.__assign(tslib_1.__assign({}, theme.fonts.small), { lineHeight: '16px', selectors: (_b = {},
|
|
94
|
+
_b[react_1.HighContrastSelectorBlack] = {
|
|
95
|
+
color: 'rgb(255, 255, 255)',
|
|
96
|
+
},
|
|
97
|
+
_b), color: theme.semanticColors.bodySubtext }),
|
|
98
|
+
calloutContentY: [
|
|
99
|
+
tslib_1.__assign(tslib_1.__assign({}, theme.fonts.mediumPlus), { fontWeight: 'bold', lineHeight: '22px', selectors: (_c = {},
|
|
100
|
+
_c[react_1.HighContrastSelectorBlack] = {
|
|
101
|
+
color: 'rgb(255, 255, 255)',
|
|
102
|
+
},
|
|
103
|
+
_c) }),
|
|
104
|
+
],
|
|
105
|
+
descriptionMessage: [
|
|
106
|
+
theme.fonts.small,
|
|
107
|
+
{
|
|
108
|
+
selectors: (_d = {},
|
|
109
|
+
_d[react_1.HighContrastSelectorBlack] = {
|
|
110
|
+
color: 'rgb(255, 255, 255)',
|
|
111
|
+
},
|
|
112
|
+
_d),
|
|
113
|
+
color: theme.semanticColors.bodyText,
|
|
114
|
+
marginTop: '10px',
|
|
115
|
+
paddingTop: '10px',
|
|
116
|
+
borderTop: "1px solid ".concat(theme.semanticColors.menuDivider),
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
exports.getStyles = getStyles;
|
|
122
|
+
//# sourceMappingURL=GaugeChart.styles.js.map
|