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