@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,67 @@
1
+ import * as React from 'react';
2
+ import { IGaugeChartProps } from './GaugeChart.types';
3
+ import { IYValueHover } from '../../index';
4
+ export declare const ARC_PADDING = 2;
5
+ export declare const BREAKPOINTS: {
6
+ minRadius: number;
7
+ arcWidth: number;
8
+ fontSize: number;
9
+ }[];
10
+ interface IYValue extends Omit<IYValueHover, 'y'> {
11
+ y?: string | number;
12
+ }
13
+ export interface IGaugeChartState {
14
+ hoveredLegend: string;
15
+ selectedLegend: string;
16
+ focusedElement?: string;
17
+ calloutTarget: any;
18
+ isCalloutVisible: boolean;
19
+ hoverXValue: string | number;
20
+ hoverYValues: IYValue[];
21
+ width: number;
22
+ height: number;
23
+ }
24
+ export declare class GaugeChartBase extends React.Component<IGaugeChartProps, IGaugeChartState> {
25
+ private _classNames;
26
+ private _isRTL;
27
+ private _innerRadius;
28
+ private _outerRadius;
29
+ private _minValue;
30
+ private _segments;
31
+ private _sweepFraction;
32
+ private _calloutAnchor;
33
+ private _rootElem;
34
+ private _margins;
35
+ private _legendsHeight;
36
+ constructor(props: IGaugeChartProps);
37
+ componentDidMount(): void;
38
+ render(): React.ReactNode;
39
+ private _getMargins;
40
+ private _getStylesBasedOnBreakpoint;
41
+ private _initProps;
42
+ private _renderNeedle;
43
+ private _renderLegends;
44
+ /**
45
+ * This function checks if the given legend is highlighted or not.
46
+ * A legend can be highlighted in 2 ways:
47
+ * 1. selection: if the user clicks on it
48
+ * 2. hovering: if there is no selected legend and the user hovers over it
49
+ */
50
+ private _legendHighlighted;
51
+ /**
52
+ * This function checks if none of the legends is selected or hovered.
53
+ */
54
+ private _noLegendHighlighted;
55
+ private _handleFocus;
56
+ private _handleBlur;
57
+ private _handleMouseOver;
58
+ private _handleMouseOut;
59
+ private _handleCalloutDismiss;
60
+ private _showCallout;
61
+ private _hideCallout;
62
+ private _wrapContent;
63
+ private _multiValueCallout;
64
+ private _yValueHoverSubCountsExists;
65
+ private _getCalloutContent;
66
+ }
67
+ export {};
@@ -0,0 +1,376 @@
1
+ import { __assign, __extends } from "tslib";
2
+ import * as React from 'react';
3
+ import * as shape from 'd3-shape';
4
+ import { classNamesFunction, getRTL } from '@fluentui/react/lib/Utilities';
5
+ import { GaugeValueFormat, } from './GaugeChart.types';
6
+ import { Points, convertToLocaleString, formatValueWithSIPrefix, getAccessibleDataObject, getColorFromToken, getNextColor, pointTypes, } from '../../utilities/index';
7
+ import { Legends, Shape } from '../Legends/index';
8
+ import { FocusZone, FocusZoneDirection } from '@fluentui/react-focus';
9
+ import { Callout, DirectionalHint } from '@fluentui/react/lib/Callout';
10
+ import { SVGTooltipText } from '../../utilities/SVGTooltipText';
11
+ import { select as d3Select } from 'd3-selection';
12
+ var GAUGE_MARGIN = 16;
13
+ var LABEL_WIDTH = 36;
14
+ var LABEL_HEIGHT = 16;
15
+ var LABEL_OFFSET = 4;
16
+ var TITLE_OFFSET = 11;
17
+ var EXTRA_NEEDLE_LENGTH = 4;
18
+ export var ARC_PADDING = 2;
19
+ export var BREAKPOINTS = [
20
+ { minRadius: 52, arcWidth: 12, fontSize: 20 },
21
+ { minRadius: 70, arcWidth: 16, fontSize: 24 },
22
+ { minRadius: 88, arcWidth: 20, fontSize: 32 },
23
+ { minRadius: 106, arcWidth: 24, fontSize: 32 },
24
+ { minRadius: 124, arcWidth: 28, fontSize: 40 },
25
+ { minRadius: 142, arcWidth: 32, fontSize: 40 },
26
+ ];
27
+ var getClassNames = classNamesFunction();
28
+ var GaugeChartBase = /** @class */ (function (_super) {
29
+ __extends(GaugeChartBase, _super);
30
+ function GaugeChartBase(props) {
31
+ var _this = _super.call(this, props) || this;
32
+ _this._getMargins = function () {
33
+ var _a = _this.props, hideMinMax = _a.hideMinMax, chartTitle = _a.chartTitle, sublabel = _a.sublabel;
34
+ return {
35
+ left: (!hideMinMax ? LABEL_OFFSET + LABEL_WIDTH : 0) + GAUGE_MARGIN,
36
+ right: (!hideMinMax ? LABEL_OFFSET + LABEL_WIDTH : 0) + GAUGE_MARGIN,
37
+ top: (chartTitle ? TITLE_OFFSET + LABEL_HEIGHT : EXTRA_NEEDLE_LENGTH / 2) + GAUGE_MARGIN,
38
+ bottom: (sublabel ? LABEL_OFFSET + LABEL_HEIGHT : 0) + GAUGE_MARGIN,
39
+ };
40
+ };
41
+ _this._getStylesBasedOnBreakpoint = function () {
42
+ for (var index = BREAKPOINTS.length - 1; index >= 0; index -= 1) {
43
+ if (_this._outerRadius >= BREAKPOINTS[index].minRadius) {
44
+ return {
45
+ arcWidth: BREAKPOINTS[index].arcWidth,
46
+ chartValueSize: BREAKPOINTS[index].fontSize,
47
+ };
48
+ }
49
+ }
50
+ return {
51
+ arcWidth: BREAKPOINTS[0].arcWidth,
52
+ chartValueSize: BREAKPOINTS[0].fontSize,
53
+ };
54
+ };
55
+ _this._initProps = function () {
56
+ var _a = _this.props, _b = _a.minValue, minValue = _b === void 0 ? 0 : _b, maxValue = _a.maxValue, theme = _a.theme;
57
+ var segments = Array.from(_this.props.segments);
58
+ var total = minValue;
59
+ segments.forEach(function (segment, index) {
60
+ total += segment.size;
61
+ segment.color =
62
+ typeof segment.color !== 'undefined'
63
+ ? getColorFromToken(segment.color, theme.isInverted)
64
+ : getNextColor(index, 0, theme.isInverted);
65
+ });
66
+ if (typeof maxValue !== 'undefined' && total < maxValue) {
67
+ segments.push({
68
+ legend: 'Unknown',
69
+ size: maxValue - total,
70
+ color: theme.palette.neutralLight,
71
+ });
72
+ total = maxValue;
73
+ }
74
+ var arcGenerator = shape
75
+ .arc()
76
+ .padAngle(ARC_PADDING / _this._outerRadius)
77
+ .padRadius(_this._outerRadius);
78
+ var rtlSafeSegments = _this._isRTL ? Array.from(segments).reverse() : segments;
79
+ var prevAngle = -Math.PI / 2;
80
+ var arcs = rtlSafeSegments.map(function (segment, index) {
81
+ var endAngle = prevAngle + (segment.size / (total - minValue)) * Math.PI;
82
+ var d = arcGenerator({
83
+ innerRadius: _this._innerRadius,
84
+ outerRadius: _this._outerRadius,
85
+ startAngle: prevAngle,
86
+ endAngle: endAngle,
87
+ });
88
+ prevAngle = endAngle;
89
+ return {
90
+ d: d,
91
+ segmentIndex: _this._isRTL ? segments.length - 1 - index : index,
92
+ };
93
+ });
94
+ return {
95
+ minValue: minValue,
96
+ maxValue: total,
97
+ segments: segments,
98
+ arcs: arcs,
99
+ };
100
+ };
101
+ _this._renderNeedle = function () {
102
+ var needleRotation = (_this._sweepFraction[0] / _this._sweepFraction[1]) * 180;
103
+ var rtlSafeNeedleRotation = _this._isRTL ? 180 - needleRotation : needleRotation;
104
+ var strokeWidth = 2;
105
+ var halfStrokeWidth = strokeWidth / 2;
106
+ var needleLength = _this._outerRadius - _this._innerRadius + EXTRA_NEEDLE_LENGTH;
107
+ return (React.createElement("g", { transform: "rotate(".concat(rtlSafeNeedleRotation, ", 0, 0)") },
108
+ 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'); } })));
109
+ };
110
+ _this._renderLegends = function () {
111
+ if (_this.props.hideLegend) {
112
+ return null;
113
+ }
114
+ var legends = _this._segments.map(function (segment) {
115
+ return {
116
+ title: segment.legend,
117
+ color: segment.color,
118
+ action: function () {
119
+ if (_this.state.selectedLegend === segment.legend) {
120
+ _this.setState({ selectedLegend: '' });
121
+ }
122
+ else {
123
+ _this.setState({ selectedLegend: segment.legend });
124
+ }
125
+ },
126
+ hoverAction: function () {
127
+ _this.setState({ hoveredLegend: segment.legend });
128
+ },
129
+ onMouseOutAction: function () {
130
+ _this.setState({ hoveredLegend: '' });
131
+ },
132
+ };
133
+ });
134
+ return (React.createElement("div", { className: _this._classNames.legendsContainer },
135
+ React.createElement(Legends, __assign({ legends: legends, centerLegends: true }, _this.props.legendProps))));
136
+ };
137
+ /**
138
+ * This function checks if the given legend is highlighted or not.
139
+ * A legend can be highlighted in 2 ways:
140
+ * 1. selection: if the user clicks on it
141
+ * 2. hovering: if there is no selected legend and the user hovers over it
142
+ */
143
+ _this._legendHighlighted = function (legend) {
144
+ return (_this.state.selectedLegend === legend || (_this.state.selectedLegend === '' && _this.state.hoveredLegend === legend));
145
+ };
146
+ /**
147
+ * This function checks if none of the legends is selected or hovered.
148
+ */
149
+ _this._noLegendHighlighted = function () {
150
+ return _this.state.selectedLegend === '' && _this.state.hoveredLegend === '';
151
+ };
152
+ _this._handleFocus = function (focusEvent, focusedElement) {
153
+ _this._showCallout(focusEvent.target, focusedElement, true);
154
+ };
155
+ _this._handleBlur = function () {
156
+ _this._hideCallout(true);
157
+ };
158
+ _this._handleMouseOver = function (mouseEvent, hoveredElement) {
159
+ _this._showCallout(mouseEvent.target, hoveredElement, false);
160
+ };
161
+ _this._handleMouseOut = function () {
162
+ _this._hideCallout(false);
163
+ };
164
+ _this._handleCalloutDismiss = function () {
165
+ _this._hideCallout(false);
166
+ };
167
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
168
+ _this._showCallout = function (target, legend, isFocusEvent) {
169
+ if (_this._calloutAnchor === legend) {
170
+ return;
171
+ }
172
+ _this._calloutAnchor = legend;
173
+ var hoverXValue = 'Current value is ' +
174
+ (_this.props.chartValueFormat === GaugeValueFormat.Fraction
175
+ ? "".concat(((_this._sweepFraction[0] / _this._sweepFraction[1]) * 100).toFixed(), "%")
176
+ : "".concat(_this._sweepFraction[0], "/").concat(_this._sweepFraction[1]));
177
+ var total = _this._minValue;
178
+ var hoverYValues = _this._segments.map(function (segment, index) {
179
+ var yValue = {
180
+ legend: segment.legend,
181
+ y: "".concat(total + (index > 0 ? 1 : 0), " - ").concat(total + segment.size),
182
+ color: segment.color,
183
+ };
184
+ total += segment.size;
185
+ return yValue;
186
+ });
187
+ _this.setState(__assign({ calloutTarget: target,
188
+ /** Show the callout if highlighted arc is hovered/focused and Hide it if unhighlighted arc is hovered/focused */
189
+ isCalloutVisible: ['Needle', 'Chart value'].includes(legend) ||
190
+ _this.state.selectedLegend === '' ||
191
+ _this.state.selectedLegend === legend, hoverXValue: hoverXValue, hoverYValues: hoverYValues }, (isFocusEvent ? { focusedElement: legend } : {})));
192
+ };
193
+ _this._hideCallout = function (isBlurEvent) {
194
+ _this._calloutAnchor = '';
195
+ _this.setState(__assign({ calloutTarget: null, isCalloutVisible: false, hoverXValue: '', hoverYValues: [] }, (isBlurEvent ? { focusedElement: '' } : {})));
196
+ };
197
+ _this._wrapContent = function (content, id, maxWidth) {
198
+ var textElement = d3Select("#".concat(id));
199
+ textElement.text(content);
200
+ if (!textElement.node()) {
201
+ return false;
202
+ }
203
+ var isOverflowing = false;
204
+ var textLength = textElement.node().getComputedTextLength();
205
+ while (textLength > maxWidth && content.length > 0) {
206
+ content = content.slice(0, -1);
207
+ textElement.text(content + '...');
208
+ isOverflowing = true;
209
+ textLength = textElement.node().getComputedTextLength();
210
+ }
211
+ return isOverflowing;
212
+ };
213
+ // TO DO: Write a common functional component for Multi value callout and divide sub count method
214
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
215
+ _this._multiValueCallout = function (calloutProps) {
216
+ var yValueHoverSubCountsExists = _this._yValueHoverSubCountsExists(calloutProps.YValueHover);
217
+ return (React.createElement("div", { className: _this._classNames.calloutContentRoot },
218
+ React.createElement("div", { className: _this._classNames.calloutDateTimeContainer, style: yValueHoverSubCountsExists ? { marginBottom: '11px' } : {} },
219
+ React.createElement("div", __assign({ className: _this._classNames.calloutContentX }, getAccessibleDataObject(calloutProps.xAxisCalloutAccessibilityData, 'text', false)), convertToLocaleString(calloutProps.hoverXValue, _this.props.culture))),
220
+ React.createElement("div", { className: _this._classNames.calloutInfoContainer, style: yValueHoverSubCountsExists ? { display: 'flex' } : {} },
221
+ calloutProps.YValueHover &&
222
+ calloutProps.YValueHover.map(function (yValue, index, yValues) {
223
+ var isLast = index + 1 === yValues.length;
224
+ var _a = yValue.shouldDrawBorderBottom, shouldDrawBorderBottom = _a === void 0 ? false : _a;
225
+ return (React.createElement("div", __assign({}, getAccessibleDataObject(yValue.callOutAccessibilityData, 'text', false), { key: "callout-content-".concat(index), style: yValueHoverSubCountsExists
226
+ ? __assign({ display: 'inline-block' }, (shouldDrawBorderBottom && {
227
+ borderBottom: "1px solid ".concat(_this.props.theme.semanticColors.menuDivider),
228
+ paddingBottom: '10px',
229
+ })) : __assign({}, (shouldDrawBorderBottom && {
230
+ borderBottom: "1px solid ".concat(_this.props.theme.semanticColors.menuDivider),
231
+ paddingBottom: '10px',
232
+ })) }), _this._getCalloutContent(yValue, index, yValueHoverSubCountsExists, isLast)));
233
+ }),
234
+ !!calloutProps.descriptionMessage && (React.createElement("div", { className: _this._classNames.descriptionMessage }, calloutProps.descriptionMessage)))));
235
+ };
236
+ _this._margins = _this._getMargins();
237
+ _this._legendsHeight = !_this.props.hideLegend ? 24 : 0;
238
+ _this.state = {
239
+ hoveredLegend: '',
240
+ selectedLegend: '',
241
+ focusedElement: '',
242
+ calloutTarget: null,
243
+ isCalloutVisible: false,
244
+ hoverXValue: '',
245
+ hoverYValues: [],
246
+ width: 140 + _this._margins.left + _this._margins.right,
247
+ height: 70 + _this._margins.top + _this._margins.bottom + _this._legendsHeight,
248
+ };
249
+ _this._isRTL = getRTL();
250
+ _this._calloutAnchor = '';
251
+ return _this;
252
+ }
253
+ GaugeChartBase.prototype.componentDidMount = function () {
254
+ if (this._rootElem) {
255
+ this.setState({
256
+ width: this._rootElem.clientWidth,
257
+ height: this._rootElem.clientHeight,
258
+ });
259
+ }
260
+ };
261
+ GaugeChartBase.prototype.render = function () {
262
+ var _this = this;
263
+ this._margins = this._getMargins();
264
+ this._legendsHeight = !this.props.hideLegend ? 24 : 0;
265
+ var width = this.props.width || this.state.width;
266
+ var height = this.props.height || this.state.height;
267
+ this._outerRadius = Math.min((width - (this._margins.left + this._margins.right)) / 2, height - (this._margins.top + this._margins.bottom + this._legendsHeight));
268
+ var _a = this._getStylesBasedOnBreakpoint(), arcWidth = _a.arcWidth, chartValueSize = _a.chartValueSize;
269
+ this._innerRadius = this._outerRadius - arcWidth;
270
+ var _b = this._initProps(), minValue = _b.minValue, maxValue = _b.maxValue, segments = _b.segments, arcs = _b.arcs;
271
+ this._minValue = minValue;
272
+ this._segments = segments;
273
+ this._sweepFraction = [this.props.chartValue - this._minValue, maxValue - this._minValue];
274
+ this._classNames = getClassNames(this.props.styles, {
275
+ theme: this.props.theme,
276
+ className: this.props.className,
277
+ chartWidth: width,
278
+ chartHeight: height - this._legendsHeight,
279
+ chartValueSize: chartValueSize,
280
+ });
281
+ return (React.createElement("div", { className: this._classNames.root, ref: function (el) { return (_this._rootElem = el); } },
282
+ React.createElement(FocusZone, { direction: FocusZoneDirection.horizontal },
283
+ 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 },
284
+ React.createElement("g", { transform: "translate(".concat(width / 2, ", ").concat(height - (this._margins.bottom + this._legendsHeight), ")") },
285
+ this.props.chartTitle && (React.createElement("text", { x: 0, y: -(this._outerRadius + TITLE_OFFSET), textAnchor: "middle", className: this._classNames.chartTitle }, this.props.chartTitle)),
286
+ !this.props.hideMinMax && (React.createElement(React.Fragment, null,
287
+ 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) }, formatValueWithSIPrefix(this._minValue)),
288
+ 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) }, formatValueWithSIPrefix(maxValue)))),
289
+ arcs.map(function (arc, index) { return (React.createElement("path", __assign({ key: index, d: arc.d, fill: _this._segments[arc.segmentIndex].color, fillOpacity: _this._legendHighlighted(_this._segments[arc.segmentIndex].legend) || _this._noLegendHighlighted()
290
+ ? 1
291
+ : 0.1, strokeWidth: _this.state.focusedElement === _this._segments[arc.segmentIndex].legend ? ARC_PADDING : 0, className: _this._classNames.segment }, getAccessibleDataObject(__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)) *
292
+ 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); } }))); }),
293
+ this._renderNeedle(),
294
+ React.createElement("g", { onMouseEnter: function (e) { return _this._handleMouseOver(e, 'Chart value'); }, onMouseMove: function (e) { return _this._handleMouseOver(e, 'Chart value'); } },
295
+ React.createElement(SVGTooltipText, { content: typeof this.props.chartValueFormat === 'function'
296
+ ? this.props.chartValueFormat(this._sweepFraction)
297
+ : this.props.chartValueFormat === GaugeValueFormat.Fraction
298
+ ? "".concat(this._sweepFraction[0], "/").concat(this._sweepFraction[1])
299
+ : "".concat(((this._sweepFraction[0] / this._sweepFraction[1]) * 100).toFixed(), "%"), textProps: {
300
+ x: 0,
301
+ y: 0,
302
+ textAnchor: 'middle',
303
+ className: this._classNames.chartValue,
304
+ role: 'img',
305
+ 'aria-label': "Current value: ".concat(this._sweepFraction[0], " out of ").concat(this._sweepFraction[1], ", or ").concat(((this._sweepFraction[0] / this._sweepFraction[1]) *
306
+ 100).toFixed(), "%"),
307
+ }, maxWidth: this._innerRadius * 2 - 24, wrapContent: this._wrapContent })),
308
+ this.props.sublabel && (React.createElement(SVGTooltipText, { content: this.props.sublabel, textProps: {
309
+ x: 0,
310
+ y: 4,
311
+ textAnchor: 'middle',
312
+ dominantBaseline: 'hanging',
313
+ className: this._classNames.sublabel,
314
+ role: 'img',
315
+ 'aria-label': this.props.sublabel,
316
+ }, maxWidth: this._innerRadius * 2, wrapContent: this._wrapContent }))))),
317
+ this._renderLegends(),
318
+ !this.props.hideTooltip && this.state.isCalloutVisible && (React.createElement(Callout, __assign({ target: this.state.calloutTarget, directionalHint: DirectionalHint.topAutoEdge, gapSpace: 15, isBeakVisible: false, onDismiss: this._handleCalloutDismiss }, this.props.calloutProps), this._multiValueCallout({
319
+ hoverXValue: this.state.hoverXValue,
320
+ YValueHover: this.state.hoverYValues,
321
+ })))));
322
+ };
323
+ GaugeChartBase.prototype._yValueHoverSubCountsExists = function (yValueHover) {
324
+ if (yValueHover) {
325
+ return yValueHover.some(function (yValue) { return yValue.yAxisCalloutData && typeof yValue.yAxisCalloutData !== 'string'; });
326
+ }
327
+ return false;
328
+ };
329
+ GaugeChartBase.prototype._getCalloutContent = function (xValue, index, yValueHoverSubCountsExists, isLast) {
330
+ var marginStyle = isLast ? {} : { marginRight: '16px' };
331
+ var toDrawShape = xValue.index !== undefined && xValue.index !== -1;
332
+ var _classNames = getClassNames(this.props.styles, {
333
+ theme: this.props.theme,
334
+ lineColor: xValue.color,
335
+ toDrawShape: toDrawShape,
336
+ });
337
+ var culture = this.props.culture;
338
+ var yValue = convertToLocaleString(xValue.y, culture);
339
+ if (!xValue.yAxisCalloutData || typeof xValue.yAxisCalloutData === 'string') {
340
+ return (React.createElement("div", { style: yValueHoverSubCountsExists ? marginStyle : {} },
341
+ yValueHoverSubCountsExists && (React.createElement("div", { className: "ms-fontWeight-semibold", style: { fontSize: '12pt' } },
342
+ xValue.legend,
343
+ " (",
344
+ yValue,
345
+ ")")),
346
+ React.createElement("div", { id: "".concat(index, "_").concat(xValue.y), className: _classNames.calloutBlockContainer },
347
+ toDrawShape && (React.createElement(Shape, { svgProps: {
348
+ className: _classNames.shapeStyles,
349
+ }, pathProps: { fill: xValue.color }, shape: Points[xValue.index % Object.keys(pointTypes).length] })),
350
+ React.createElement("div", null,
351
+ React.createElement("div", { className: _classNames.calloutlegendText },
352
+ " ",
353
+ xValue.legend),
354
+ React.createElement("div", { className: _classNames.calloutContentY }, convertToLocaleString(xValue.yAxisCalloutData ? xValue.yAxisCalloutData : xValue.y || xValue.data, culture))))));
355
+ }
356
+ else {
357
+ var subcounts_1 = xValue.yAxisCalloutData;
358
+ return (React.createElement("div", { style: marginStyle },
359
+ React.createElement("div", { className: "ms-fontWeight-semibold", style: { fontSize: '12pt' } },
360
+ xValue.legend,
361
+ " (",
362
+ yValue,
363
+ ")"),
364
+ Object.keys(subcounts_1).map(function (subcountName) {
365
+ return (React.createElement("div", { key: subcountName, className: _classNames.calloutBlockContainer },
366
+ React.createElement("div", { className: _classNames.calloutlegendText },
367
+ " ",
368
+ convertToLocaleString(subcountName, culture)),
369
+ React.createElement("div", { className: _classNames.calloutContentY }, convertToLocaleString(subcounts_1[subcountName], culture))));
370
+ })));
371
+ }
372
+ };
373
+ return GaugeChartBase;
374
+ }(React.Component));
375
+ export { GaugeChartBase };
376
+ //# 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,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO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ACR,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,qBAAqB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAO;wBACpG,6BAAK,SAAS,EAAE,WAAW,CAAC,eAAe,IACxC,qBAAqB,CAAC,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","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,5 @@
1
+ import { styled } from '@fluentui/react';
2
+ import { GaugeChartBase } from './GaugeChart.base';
3
+ import { getStyles } from './GaugeChart.styles';
4
+ export var GaugeChart = styled(GaugeChartBase, getStyles);
5
+ //# sourceMappingURL=GaugeChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GaugeChart.js","sourceRoot":"../src/","sources":["components/GaugeChart/GaugeChart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,MAAM,CAAC,IAAM,UAAU,GAA8C,MAAM,CAIzE,cAAc,EAAE,SAAS,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;