@fluentui/react-charting 5.16.30 → 5.16.32

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 (106) 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/lib/HorizontalBarChartWithAxis.d.ts +1 -0
  6. package/lib/HorizontalBarChartWithAxis.js +2 -0
  7. package/lib/HorizontalBarChartWithAxis.js.map +1 -0
  8. package/lib/components/CommonComponents/CartesianChart.base.d.ts +2 -0
  9. package/lib/components/CommonComponents/CartesianChart.base.js +72 -12
  10. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  11. package/lib/components/CommonComponents/CartesianChart.types.d.ts +13 -0
  12. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  13. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +57 -0
  14. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +487 -0
  15. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -0
  16. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.d.ts +3 -0
  17. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +6 -0
  18. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  19. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.d.ts +2 -0
  20. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -0
  21. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -0
  22. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +100 -0
  23. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +2 -0
  24. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  25. package/lib/components/HorizontalBarChartWithAxis/index.d.ts +2 -0
  26. package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
  27. package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  28. package/lib/index.d.ts +1 -0
  29. package/lib/index.js +1 -0
  30. package/lib/index.js.map +1 -1
  31. package/lib/types/IDataPoint.d.ts +38 -0
  32. package/lib/types/IDataPoint.js.map +1 -1
  33. package/lib/utilities/utilities.d.ts +53 -8
  34. package/lib/utilities/utilities.js +170 -7
  35. package/lib/utilities/utilities.js.map +1 -1
  36. package/lib/version.js +1 -1
  37. package/lib/version.js.map +1 -1
  38. package/lib-amd/HorizontalBarChartWithAxis.d.ts +1 -0
  39. package/lib-amd/HorizontalBarChartWithAxis.js +6 -0
  40. package/lib-amd/HorizontalBarChartWithAxis.js.map +1 -0
  41. package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +2 -0
  42. package/lib-amd/components/CommonComponents/CartesianChart.base.js +71 -11
  43. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  44. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +13 -0
  45. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  46. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +57 -0
  47. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +482 -0
  48. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -0
  49. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.d.ts +3 -0
  50. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +8 -0
  51. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  52. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.d.ts +2 -0
  53. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +17 -0
  54. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -0
  55. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +100 -0
  56. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +5 -0
  57. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  58. package/lib-amd/components/HorizontalBarChartWithAxis/index.d.ts +2 -0
  59. package/lib-amd/components/HorizontalBarChartWithAxis/index.js +7 -0
  60. package/lib-amd/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  61. package/lib-amd/index.d.ts +1 -0
  62. package/lib-amd/index.js +2 -1
  63. package/lib-amd/index.js.map +1 -1
  64. package/lib-amd/types/IDataPoint.d.ts +38 -0
  65. package/lib-amd/types/IDataPoint.js.map +1 -1
  66. package/lib-amd/utilities/utilities.d.ts +53 -8
  67. package/lib-amd/utilities/utilities.js +181 -10
  68. package/lib-amd/utilities/utilities.js.map +1 -1
  69. package/lib-amd/version.js +1 -1
  70. package/lib-amd/version.js.map +1 -1
  71. package/lib-commonjs/HorizontalBarChartWithAxis.d.ts +1 -0
  72. package/lib-commonjs/HorizontalBarChartWithAxis.js +5 -0
  73. package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -0
  74. package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +2 -0
  75. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +71 -11
  76. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  77. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +13 -0
  78. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  79. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +57 -0
  80. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +490 -0
  81. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -0
  82. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.d.ts +3 -0
  83. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +9 -0
  84. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  85. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.d.ts +2 -0
  86. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +16 -0
  87. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -0
  88. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +100 -0
  89. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +3 -0
  90. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  91. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.d.ts +2 -0
  92. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +6 -0
  93. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  94. package/lib-commonjs/index.d.ts +1 -0
  95. package/lib-commonjs/index.js +1 -0
  96. package/lib-commonjs/index.js.map +1 -1
  97. package/lib-commonjs/types/IDataPoint.d.ts +38 -0
  98. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  99. package/lib-commonjs/utilities/utilities.d.ts +53 -8
  100. package/lib-commonjs/utilities/utilities.js +181 -10
  101. package/lib-commonjs/utilities/utilities.js.map +1 -1
  102. package/lib-commonjs/version.js +1 -1
  103. package/lib-commonjs/version.js.map +1 -1
  104. package/package.json +6 -5
  105. package/src/components/CommonComponents/CartesianChart.types.ts +16 -0
  106. package/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.ts +125 -0
@@ -0,0 +1,482 @@
1
+ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-scale", "@fluentui/react/lib/Utilities", "@fluentui/react/lib/Callout", "../../index", "@fluentui/react-focus", "../../utilities/index"], function (require, exports, tslib_1, React, d3_array_1, d3_selection_1, d3_scale_1, Utilities_1, Callout_1, index_1, react_focus_1, index_2) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.HorizontalBarChartWithAxisBase = void 0;
5
+ var getClassNames = Utilities_1.classNamesFunction();
6
+ var HorizontalBarChartWithAxisBase = /** @class */ (function (_super) {
7
+ tslib_1.__extends(HorizontalBarChartWithAxisBase, _super);
8
+ function HorizontalBarChartWithAxisBase(props) {
9
+ var _this = _super.call(this, props) || this;
10
+ _this._isRtl = Utilities_1.getRTL();
11
+ _this._getMargins = function (margins) {
12
+ _this.margins = margins;
13
+ };
14
+ _this._renderContentForOnlyBars = function (point) {
15
+ var _a, _b;
16
+ var _c = _this.props.useSingleColor, useSingleColor = _c === void 0 ? false : _c;
17
+ var selectedPointIndex = 0;
18
+ _this.props.data.forEach(function (yDataPoint, index) {
19
+ if (yDataPoint.y === point.y) {
20
+ selectedPointIndex = index;
21
+ }
22
+ });
23
+ var color;
24
+ if (useSingleColor) {
25
+ //if useSingle color , then check if user has given a palette or not
26
+ // and pick the first color from that or else from our paltette.
27
+ color = _this.props.colors ? _this._createColors()(1) : index_2.getNextColor(1, 0, (_a = _this.props.theme) === null || _a === void 0 ? void 0 : _a.isInverted);
28
+ }
29
+ else {
30
+ color = point.color
31
+ ? point.color
32
+ : _this.props.colors
33
+ ? _this._createColors()(point.x)
34
+ : index_2.getNextColor(selectedPointIndex, 0, (_b = _this.props.theme) === null || _b === void 0 ? void 0 : _b.isInverted);
35
+ }
36
+ return (React.createElement(React.Fragment, null,
37
+ React.createElement(index_1.ChartHoverCard, { XValue: point.xAxisCalloutData || point.x.toString(), Legend: point.legend, YValue: point.yAxisCalloutData || point.y, color: color, culture: _this.props.culture })));
38
+ };
39
+ _this._renderCallout = function (props) {
40
+ return props ? _this._renderContentForOnlyBars(props) : null;
41
+ };
42
+ _this._getCustomizedCallout = function () {
43
+ return _this.props.onRenderCalloutPerDataPoint
44
+ ? _this.props.onRenderCalloutPerDataPoint(_this.state.dataPointCalloutProps, _this._renderCallout)
45
+ : null;
46
+ };
47
+ _this._getGraphData = function (xScale, yScale, containerHeight, containerWidth, xElement, yElement) {
48
+ return (_this._bars =
49
+ _this._yAxisType === index_2.YAxisType.NumericAxis
50
+ ? _this._createNumericBars(containerHeight, containerWidth, xElement, yElement)
51
+ : _this._createStringBars(containerHeight, containerWidth, xElement, yElement));
52
+ };
53
+ _this._refCallback = function (element, legendTitle) {
54
+ _this._refArray.push({ index: legendTitle, refElement: element });
55
+ };
56
+ _this._getCalloutContentForBar = function (point) {
57
+ var _a, _b;
58
+ var YValueHover = [];
59
+ var _c = _this.props.useSingleColor, useSingleColor = _c === void 0 ? false : _c;
60
+ var data = _this.props.data;
61
+ var selectedPoint = data.filter(function (yDataPoint) { return yDataPoint.y === point.y; });
62
+ var selectedPointIndex = 0;
63
+ data.forEach(function (yDataPoint, index) {
64
+ if (yDataPoint.y === point.y) {
65
+ selectedPointIndex = index;
66
+ }
67
+ });
68
+ var color;
69
+ if (useSingleColor) {
70
+ //if useSingle color , then check if user has given a palette or not
71
+ // and pick the first color from that or else from our paltette.
72
+ color = _this.props.colors ? _this._createColors()(1) : index_2.getNextColor(1, 0, (_a = _this.props.theme) === null || _a === void 0 ? void 0 : _a.isInverted);
73
+ }
74
+ else {
75
+ color = selectedPoint[0].color
76
+ ? selectedPoint[0].color
77
+ : _this.props.colors
78
+ ? _this._createColors()(selectedPoint[0].x)
79
+ : index_2.getNextColor(selectedPointIndex, 0, (_b = _this.props.theme) === null || _b === void 0 ? void 0 : _b.isInverted);
80
+ }
81
+ // callout data for the bar
82
+ YValueHover.push({
83
+ legend: selectedPoint[0].legend,
84
+ // For HBCWA x and y Values are swapped
85
+ y: selectedPoint[0].x,
86
+ color: color,
87
+ data: selectedPoint[0].yAxisCalloutData,
88
+ yAxisCalloutData: selectedPoint[0].yAxisCalloutData,
89
+ });
90
+ return { YValueHover: YValueHover, hoverXValue: point.yAxisCalloutData || point.y.toString() };
91
+ };
92
+ _this._onBarLeave = function () {
93
+ /**/
94
+ };
95
+ _this._handleChartMouseLeave = function () {
96
+ _this._calloutAnchorPoint = null;
97
+ _this.setState({
98
+ isCalloutVisible: false,
99
+ activeXdataPoint: null,
100
+ YValueHover: [],
101
+ hoverXValue: '',
102
+ });
103
+ };
104
+ _this._onBarFocus = function (point, refArrayIndexNumber, color) {
105
+ if (_this.state.isLegendSelected === false ||
106
+ (_this.state.isLegendSelected && _this.state.selectedLegendTitle === point.legend)) {
107
+ var _a = _this._getCalloutContentForBar(point), YValueHover_1 = _a.YValueHover, hoverXValue_1 = _a.hoverXValue;
108
+ _this._refArray.forEach(function (obj, index) {
109
+ if (refArrayIndexNumber === index) {
110
+ _this.setState({
111
+ refSelected: obj.refElement,
112
+ isCalloutVisible: true,
113
+ selectedLegendTitle: point.legend,
114
+ dataForHoverCard: point.x,
115
+ color: _this.props.useSingleColor ? color : point.color,
116
+ xCalloutValue: point.yAxisCalloutData || point.y.toString(),
117
+ yCalloutValue: point.xAxisCalloutData || point.x.toString(),
118
+ dataPointCalloutProps: point,
119
+ activeXdataPoint: point.x,
120
+ YValueHover: YValueHover_1,
121
+ hoverXValue: hoverXValue_1,
122
+ callOutAccessibilityData: point.callOutAccessibilityData,
123
+ });
124
+ }
125
+ });
126
+ }
127
+ };
128
+ _this._getScales = function (containerHeight, containerWidth, isNumericScale) {
129
+ if (isNumericScale) {
130
+ var xMax = d3_array_1.max(_this._points, function (point) { return point.x; });
131
+ var yMax = d3_array_1.max(_this._points, function (point) { return point.y; });
132
+ var xBarScale = d3_scale_1.scaleLinear()
133
+ .domain(_this._isRtl ? [xMax, 0] : [0, xMax])
134
+ .nice()
135
+ .range([_this.margins.left, containerWidth - _this.margins.right]);
136
+ var yBarScale = d3_scale_1.scaleLinear()
137
+ .domain([0, yMax])
138
+ .range([containerHeight - _this.margins.bottom, _this.margins.top]);
139
+ return { xBarScale: xBarScale, yBarScale: yBarScale };
140
+ }
141
+ else {
142
+ var xMax = d3_array_1.max(_this._points, function (point) { return point.x; });
143
+ // please note these padding default values must be consistent in here
144
+ // and CatrtesianChartBase w for more details refer example
145
+ // http://using-d3js.com/04_07_ordinal_scales.html
146
+ var yBarScale = d3_scale_1.scaleBand()
147
+ .domain(_this._yAxisLabels)
148
+ .range([containerHeight - _this.margins.bottom - _this._barHeight / 2, _this.margins.top + _this._barHeight / 2])
149
+ .padding(_this.props.yAxisPadding || 0);
150
+ var xBarScale = d3_scale_1.scaleLinear()
151
+ .domain(_this._isRtl ? [xMax, 0] : [0, xMax])
152
+ .range([_this.margins.left, containerWidth - _this.margins.right]);
153
+ return { xBarScale: xBarScale, yBarScale: yBarScale };
154
+ }
155
+ };
156
+ _this._closeCallout = function () {
157
+ _this.setState({
158
+ isCalloutVisible: false,
159
+ });
160
+ };
161
+ _this._getLegendData = function (data, palette) {
162
+ var useSingleColor = _this.props.useSingleColor;
163
+ var actions = [];
164
+ data.forEach(function (point, _index) {
165
+ var _a;
166
+ var color = useSingleColor
167
+ ? _this.props.colors
168
+ ? _this._createColors()(1)
169
+ : index_2.getNextColor(1, 0, (_a = _this.props.theme) === null || _a === void 0 ? void 0 : _a.isInverted)
170
+ : point.color;
171
+ // mapping data to the format Legends component needs
172
+ var legend = {
173
+ title: point.legend,
174
+ color: color,
175
+ action: function () {
176
+ _this._onLegendClick(point.legend);
177
+ },
178
+ hoverAction: function () {
179
+ _this._onLegendHover(point.legend);
180
+ },
181
+ onMouseOutAction: function (isLegendSelected) {
182
+ _this._onLegendLeave(isLegendSelected);
183
+ },
184
+ };
185
+ actions.push(legend);
186
+ });
187
+ var legends = (React.createElement(index_1.Legends, tslib_1.__assign({ legends: actions, enabledWrapLines: _this.props.enabledLegendsWrapLines, overflowProps: _this.props.legendsOverflowProps, focusZonePropsInHoverCard: _this.props.focusZonePropsForLegendsInHoverCard, overflowText: _this.props.legendsOverflowText }, _this.props.legendProps)));
188
+ return legends;
189
+ };
190
+ _this._getAxisData = function (yAxisData) {
191
+ if (yAxisData && yAxisData.yAxisDomainValues.length) {
192
+ // For HBCWA x and y Values are swapped
193
+ var domainValue = yAxisData.yAxisDomainValues;
194
+ _this._xMax = Math.max(domainValue[domainValue.length - 1], _this.props.xMaxValue || 0);
195
+ }
196
+ };
197
+ _this._getAriaLabel = function (point) {
198
+ var _a;
199
+ var xValue = point.xAxisCalloutData || point.x;
200
+ var yValue = point.yAxisCalloutData || point.y;
201
+ return ((_a = point.callOutAccessibilityData) === null || _a === void 0 ? void 0 : _a.ariaLabel) || xValue + ". " + (yValue + ".");
202
+ };
203
+ _this.state = {
204
+ color: '',
205
+ dataForHoverCard: 0,
206
+ isCalloutVisible: false,
207
+ isLegendSelected: false,
208
+ isLegendHovered: false,
209
+ refSelected: null,
210
+ selectedLegendTitle: '',
211
+ xCalloutValue: '',
212
+ yCalloutValue: '',
213
+ activeXdataPoint: null,
214
+ YValueHover: [],
215
+ hoverXValue: '',
216
+ };
217
+ _this._calloutId = Utilities_1.getId('callout');
218
+ _this._tooltipId = Utilities_1.getId('HBCWATooltipID_');
219
+ _this._refArray = [];
220
+ _this._xAxisType =
221
+ _this.props.data && _this.props.data.length > 0
222
+ ? index_2.getTypeOfAxis(_this.props.data[0].x, true)
223
+ : index_2.XAxisTypes.NumericAxis;
224
+ _this._yAxisType =
225
+ _this.props.data && _this.props.data.length > 0
226
+ ? index_2.getTypeOfAxis(_this.props.data[0].y, false)
227
+ : index_2.YAxisType.StringAxis;
228
+ return _this;
229
+ }
230
+ HorizontalBarChartWithAxisBase.prototype.render = function () {
231
+ var _this = this;
232
+ this._adjustProps();
233
+ var reversedBars = tslib_1.__spreadArray([], this._points).reverse();
234
+ this._yAxisLabels = reversedBars.map(function (point) { return point.y; });
235
+ this._xMax = Math.max(d3_array_1.max(this._points, function (point) { return point.x; }), this.props.xMaxValue || 0);
236
+ var legendBars = this._getLegendData(this._points, this.props.theme.palette);
237
+ this._classNames = getClassNames(this.props.styles, {
238
+ theme: this.props.theme,
239
+ legendColor: this.state.color,
240
+ });
241
+ var calloutProps = tslib_1.__assign(tslib_1.__assign({ isCalloutVisible: this.state.isCalloutVisible, directionalHint: Callout_1.DirectionalHint.topAutoEdge, id: "toolTip" + this._calloutId, target: this.state.refSelected, isBeakVisible: false, gapSpace: 15, color: this.state.color, legend: this.state.selectedLegendTitle, XValue: this.state.xCalloutValue, YValue: this.state.yCalloutValue ? this.state.yCalloutValue : this.state.dataForHoverCard, onDismiss: this._closeCallout, preventDismissOnLostFocus: true }, this.props.calloutProps), index_2.getAccessibleDataObject(this.state.callOutAccessibilityData));
242
+ var tickParams = {
243
+ tickValues: this.props.tickValues,
244
+ tickFormat: this.props.tickFormat,
245
+ };
246
+ return (React.createElement(index_1.CartesianChart, tslib_1.__assign({}, this.props, { points: this._points, chartType: index_2.ChartTypes.HorizontalBarChartWithAxis, xAxisType: this._xAxisType, yAxisType: this._yAxisType, stringDatasetForYAxisDomain: this._yAxisLabels, calloutProps: calloutProps, tickParams: tickParams, legendBars: legendBars, barwidth: this._barHeight, focusZoneDirection: react_focus_1.FocusZoneDirection.vertical, customizedCallout: this._getCustomizedCallout(), getmargins: this._getMargins, getGraphData: this._getGraphData, getAxisData: this._getAxisData, onChartMouseLeave: this._handleChartMouseLeave,
247
+ /* eslint-disable react/jsx-no-bind */
248
+ // eslint-disable-next-line react/no-children-prop
249
+ children: function (props) {
250
+ return (React.createElement(React.Fragment, null,
251
+ React.createElement("g", null, _this._bars)));
252
+ } })));
253
+ };
254
+ HorizontalBarChartWithAxisBase.prototype._adjustProps = function () {
255
+ this._points = this.props.data || [];
256
+ this._barHeight = this.props.barHeight || 32;
257
+ var palette = this.props.theme.palette;
258
+ this._colors = this.props.colors || [palette.blueLight, palette.blue, palette.blueMid, palette.blueDark];
259
+ };
260
+ HorizontalBarChartWithAxisBase.prototype._createColors = function () {
261
+ var _this = this;
262
+ var increment = this._colors.length <= 1 ? 1 : 1 / (this._colors.length - 1);
263
+ var _a = this.props.useSingleColor, useSingleColor = _a === void 0 ? false : _a;
264
+ if (useSingleColor) {
265
+ return function (_p) {
266
+ var _a = _this.props, theme = _a.theme, colors = _a.colors;
267
+ return colors && colors.length > 0 ? colors[0] : theme.palette.blueLight;
268
+ };
269
+ }
270
+ var domainValues = [];
271
+ for (var i = 0; i < this._colors.length; i++) {
272
+ domainValues.push(increment * i * this._xMax);
273
+ }
274
+ var colorScale = d3_scale_1.scaleLinear().domain(domainValues).range(this._colors);
275
+ return colorScale;
276
+ };
277
+ HorizontalBarChartWithAxisBase.prototype._onBarHover = function (point, color, mouseEvent) {
278
+ mouseEvent.persist();
279
+ var _a = this._getCalloutContentForBar(point), YValueHover = _a.YValueHover, hoverXValue = _a.hoverXValue;
280
+ if ((this.state.isLegendSelected === false ||
281
+ (this.state.isLegendSelected && this.state.selectedLegendTitle === point.legend)) &&
282
+ this._calloutAnchorPoint !== point) {
283
+ this._calloutAnchorPoint = point;
284
+ this.setState({
285
+ refSelected: mouseEvent,
286
+ isCalloutVisible: true,
287
+ dataForHoverCard: point.x,
288
+ selectedLegendTitle: point.legend,
289
+ color: this.props.useSingleColor ? color : point.color,
290
+ // To display callout value, if no callout value given, taking given point.x value as a string.
291
+ xCalloutValue: point.yAxisCalloutData || point.y.toString(),
292
+ yCalloutValue: point.xAxisCalloutData || point.x.toString(),
293
+ dataPointCalloutProps: point,
294
+ activeXdataPoint: point.x,
295
+ YValueHover: YValueHover,
296
+ hoverXValue: hoverXValue,
297
+ callOutAccessibilityData: point.callOutAccessibilityData,
298
+ });
299
+ }
300
+ };
301
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
302
+ HorizontalBarChartWithAxisBase.prototype._createNumericBars = function (containerHeight, containerWidth, xElement, yElement) {
303
+ var _this = this;
304
+ var _a = this.props.useSingleColor, useSingleColor = _a === void 0 ? false : _a;
305
+ var _b = this._getScales(containerHeight, containerWidth, true), xBarScale = _b.xBarScale, yBarScale = _b.yBarScale;
306
+ var sortedBars = tslib_1.__spreadArray([], this._points);
307
+ sortedBars.sort(function (a, b) {
308
+ var aValue = typeof a.y === 'number' ? a.y : parseFloat(a.y);
309
+ var bValue = typeof b.y === 'number' ? b.y : parseFloat(b.y);
310
+ return bValue - aValue;
311
+ });
312
+ var bars = sortedBars.map(function (point, index) {
313
+ var _a, _b;
314
+ var shouldHighlight = true;
315
+ if (_this.state.isLegendHovered || _this.state.isLegendSelected) {
316
+ shouldHighlight = _this.state.selectedLegendTitle === point.legend;
317
+ }
318
+ _this._classNames = getClassNames(_this.props.styles, {
319
+ theme: _this.props.theme,
320
+ legendColor: _this.state.color,
321
+ shouldHighlight: shouldHighlight,
322
+ });
323
+ var barHeight = Math.max(yBarScale(point.y), 0);
324
+ if (barHeight < 1) {
325
+ return React.createElement(React.Fragment, { key: point.x }, " ");
326
+ }
327
+ var color;
328
+ if (useSingleColor) {
329
+ //if useSingle color , then check if user has given a palette or not
330
+ // and pick the first color from that or else from our paltette.
331
+ color = _this.props.colors ? _this._createColors()(1) : index_2.getNextColor(1, 0, (_a = _this.props.theme) === null || _a === void 0 ? void 0 : _a.isInverted);
332
+ }
333
+ else {
334
+ color = _this.props.colors
335
+ ? _this._createColors()(point.x)
336
+ : index_2.getNextColor(index, 0, (_b = _this.props.theme) === null || _b === void 0 ? void 0 : _b.isInverted);
337
+ }
338
+ return (React.createElement("rect", { key: point.y, x: _this._isRtl ? xBarScale(point.x) : _this.margins.left, className: _this._classNames.opacityChangeOnHover, y: yBarScale(point.y) - _this._barHeight / 2, "data-is-focusable": true, width: _this._isRtl
339
+ ? containerWidth - _this.margins.right - Math.max(xBarScale(point.x), 0)
340
+ : Math.max(xBarScale(point.x), 0) - _this.margins.left, height: _this._barHeight, ref: function (e) {
341
+ _this._refCallback(e, point.legend);
342
+ }, onClick: point.onClick, onMouseOver: _this._onBarHover.bind(_this, point, color), "aria-label": _this._getAriaLabel(point), role: "img", "aria-labelledby": "toolTip" + _this._calloutId, onMouseLeave: _this._onBarLeave, onFocus: _this._onBarFocus.bind(_this, point, index, color), onBlur: _this._onBarLeave, fill: point.color && !useSingleColor ? point.color : color }));
343
+ });
344
+ return bars;
345
+ };
346
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
347
+ HorizontalBarChartWithAxisBase.prototype._tooltipOfYAxislabels = function (ytooltipProps) {
348
+ var _this = this;
349
+ var tooltipCls = ytooltipProps.tooltipCls, yAxis = ytooltipProps.yAxis, id = ytooltipProps.id;
350
+ if (yAxis === null) {
351
+ return null;
352
+ }
353
+ var div = d3_selection_1.select('body').append('div').attr('id', id).attr('class', tooltipCls).style('opacity', 0);
354
+ var aa = yAxis.selectAll('#BaseSpan')._groups[0];
355
+ var baseSpanLength = aa && Object.keys(aa).length;
356
+ var originalDataArray = [];
357
+ for (var i = 0; i < baseSpanLength; i++) {
358
+ var originalData = aa[i].dataset && Object.values(aa[i].dataset)[0];
359
+ originalDataArray.push(originalData);
360
+ }
361
+ var tickObject = yAxis.selectAll('.tick')._groups[0];
362
+ var tickObjectLength = tickObject && Object.keys(tickObject).length;
363
+ var _loop_1 = function (i) {
364
+ var d1 = tickObject[i];
365
+ d3_selection_1.select(d1)
366
+ .on('mouseover', function (d) {
367
+ if (!_this.state.tooltipElement) {
368
+ div.style('opacity', 0.9);
369
+ div
370
+ .html(originalDataArray[i])
371
+ .style('left', d3_selection_1.event.pageX + 'px')
372
+ .style('top', d3_selection_1.event.pageY - 28 + 'px');
373
+ }
374
+ })
375
+ .on('mouseout', function (d) {
376
+ div.style('opacity', 0);
377
+ });
378
+ };
379
+ for (var i = 0; i < tickObjectLength; i++) {
380
+ _loop_1(i);
381
+ }
382
+ };
383
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
384
+ HorizontalBarChartWithAxisBase.prototype._createStringBars = function (containerHeight, containerWidth, xElement, yElement) {
385
+ var _this = this;
386
+ var _a = this._getScales(containerHeight, containerWidth, false), xBarScale = _a.xBarScale, yBarScale = _a.yBarScale;
387
+ var _b = this.props.useSingleColor, useSingleColor = _b === void 0 ? false : _b;
388
+ var bars = this._points.map(function (point, index) {
389
+ var _a, _b;
390
+ var barHeight = Math.max(yBarScale(point.y), 0);
391
+ if (barHeight < 1) {
392
+ return React.createElement(React.Fragment, { key: point.x }, " ");
393
+ }
394
+ var color;
395
+ if (useSingleColor) {
396
+ //if useSingle color , then check if user has given a palette or not
397
+ // and pick the first color from that or else from our paltette.
398
+ color = _this.props.colors ? _this._createColors()(1) : index_2.getNextColor(1, 0, (_a = _this.props.theme) === null || _a === void 0 ? void 0 : _a.isInverted);
399
+ }
400
+ else {
401
+ color = _this.props.colors
402
+ ? _this._createColors()(point.x)
403
+ : index_2.getNextColor(index, 0, (_b = _this.props.theme) === null || _b === void 0 ? void 0 : _b.isInverted);
404
+ }
405
+ return (React.createElement("rect", { key: point.x, x: _this._isRtl ? xBarScale(point.x) : _this.margins.left, y: yBarScale(point.y) + _this._barHeight / 2, width: _this._isRtl
406
+ ? containerWidth - _this.margins.right - Math.max(xBarScale(point.x), 0)
407
+ : Math.max(xBarScale(point.x), 0) - _this.margins.left, height: _this._barHeight, "aria-labelledby": "toolTip" + _this._calloutId, "aria-label": _this._getAriaLabel(point), role: "img", ref: function (e) {
408
+ _this._refCallback(e, point.legend);
409
+ }, onClick: point.onClick, onMouseOver: _this._onBarHover.bind(_this, point, color), onMouseLeave: _this._onBarLeave, onBlur: _this._onBarLeave, "data-is-focusable": true, onFocus: _this._onBarFocus.bind(_this, point, index, color), fill: point.color && !useSingleColor ? point.color : color }));
410
+ });
411
+ // Removing un wanted tooltip div from DOM, when prop not provided, for proper cleanup
412
+ // of unwanted DOM elements, to prevent flacky behaviour in tooltips , that might occur
413
+ // in creating tooltips when tooltips are enabled( as we try to recreate a tspan with this._tooltipId)
414
+ if (!this.props.showYAxisLablesTooltip) {
415
+ try {
416
+ document.getElementById(this._tooltipId) && document.getElementById(this._tooltipId).remove();
417
+ //eslint-disable-next-line no-empty
418
+ }
419
+ catch (e) { }
420
+ }
421
+ // Used to display tooltip at y axis labels.
422
+ if (this.props.showYAxisLablesTooltip) {
423
+ var yAxisElement = d3_selection_1.select(yElement).call(yBarScale);
424
+ if (!this.state.tooltipElement) {
425
+ try {
426
+ document.getElementById(this._tooltipId) && document.getElementById(this._tooltipId).remove();
427
+ //eslint-disable-next-line no-empty
428
+ }
429
+ catch (e) { }
430
+ }
431
+ var ytooltipProps = {
432
+ tooltipCls: this._classNames.tooltip,
433
+ id: this._tooltipId,
434
+ yAxis: yAxisElement,
435
+ };
436
+ yAxisElement && this._tooltipOfYAxislabels(ytooltipProps);
437
+ }
438
+ return bars;
439
+ };
440
+ HorizontalBarChartWithAxisBase.prototype._onLegendClick = function (customMessage) {
441
+ if (this.state.isLegendSelected) {
442
+ if (this.state.selectedLegendTitle === customMessage) {
443
+ this.setState({
444
+ isLegendSelected: false,
445
+ selectedLegendTitle: customMessage,
446
+ });
447
+ }
448
+ else {
449
+ this.setState({
450
+ selectedLegendTitle: customMessage,
451
+ });
452
+ }
453
+ }
454
+ else {
455
+ this.setState({
456
+ isLegendSelected: true,
457
+ selectedLegendTitle: customMessage,
458
+ });
459
+ }
460
+ };
461
+ HorizontalBarChartWithAxisBase.prototype._onLegendHover = function (customMessage) {
462
+ if (this.state.isLegendSelected === false) {
463
+ this.setState({
464
+ isLegendHovered: true,
465
+ selectedLegendTitle: customMessage,
466
+ });
467
+ }
468
+ };
469
+ HorizontalBarChartWithAxisBase.prototype._onLegendLeave = function (isLegendFocused) {
470
+ if (!!isLegendFocused || this.state.isLegendSelected === false) {
471
+ this.setState({
472
+ isLegendHovered: false,
473
+ selectedLegendTitle: '',
474
+ isLegendSelected: isLegendFocused ? false : this.state.isLegendSelected,
475
+ });
476
+ }
477
+ };
478
+ return HorizontalBarChartWithAxisBase;
479
+ }(React.Component));
480
+ exports.HorizontalBarChartWithAxisBase = HorizontalBarChartWithAxisBase;
481
+ });
482
+ //# sourceMappingURL=HorizontalBarChartWithAxis.base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HorizontalBarChartWithAxis.base.js","sourceRoot":"../src/","sources":["components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.tsx"],"names":[],"mappings":";;;;IAoCA,IAAM,aAAa,GAAG,8BAAkB,EAA4E,CAAC;IAiBrH;QAAoD,0DAGnD;QAiBC,wCAAmB,KAAuC;YAA1D,YACE,kBAAM,KAAK,CAAC,SA0Bb;YApCO,YAAM,GAAY,kBAAM,EAAE,CAAC;YA6G3B,iBAAW,GAAG,UAAC,OAAiB;gBACtC,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACzB,CAAC,CAAC;YAEM,+BAAyB,GAAG,UAAC,KAA2C;;gBACtE,IAAA,KAA2B,KAAI,CAAC,KAAK,eAAf,EAAtB,cAAc,mBAAG,KAAK,KAAA,CAAgB;gBAC9C,IAAI,kBAAkB,GAAG,CAAC,CAAC;gBAC3B,KAAI,CAAC,KAAK,CAAC,IAAK,CAAC,OAAO,CAAC,UAAC,UAAgD,EAAE,KAAa;oBACvF,IAAI,UAAU,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,EAAE;wBAC5B,kBAAkB,GAAG,KAAK,CAAC;qBAC5B;gBACH,CAAC,CAAC,CAAC;gBACH,IAAI,KAAa,CAAC;gBAClB,IAAI,cAAc,EAAE;oBAClB,oEAAoE;oBACpE,gEAAgE;oBAChE,KAAK,GAAG,KAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAY,CAAC,CAAC,EAAE,CAAC,EAAE,MAAA,KAAI,CAAC,KAAK,CAAC,KAAK,0CAAE,UAAU,CA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IAAI,IAAI,CAAC,KAAK,CAAC,gBAAgB,KAAK,KAAK,EAAE;gBAC9D,IAAI,CAAC,QAAQ,CAAC;oBACZ,eAAe,EAAE,KAAK;oBACtB,mBAAmB,EAAE,EAAE;oBACvB,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB;iBACxE,CAAC,CAAC;aACJ;QACH,CAAC;QAoDH,qCAAC;IAAD,CAAC,AArnBD,CAAoD,KAAK,CAAC,SAAS,GAqnBlE;IArnBY,wEAA8B","sourcesContent":["import * as React from 'react';\nimport { max as d3Max } from 'd3-array';\nimport { select as d3Select, event as d3Event } from 'd3-selection';\nimport { scaleLinear as d3ScaleLinear, ScaleLinear as D3ScaleLinear, scaleBand as d3ScaleBand } from 'd3-scale';\nimport { classNamesFunction, getId, getRTL } from '@fluentui/react/lib/Utilities';\nimport { IProcessedStyleSet, IPalette } from '@fluentui/react/lib/Styling';\nimport { DirectionalHint } from '@fluentui/react/lib/Callout';\nimport {\n IAccessibilityProps,\n CartesianChart,\n ChartHoverCard,\n IBasestate,\n IMargins,\n ILegend,\n IRefArrayData,\n IHorizontalBarChartWithAxisProps,\n IHorizontalBarChartWithAxisStyleProps,\n IHorizontalBarChartWithAxisStyles,\n IHorizontalBarChartWithAxisDataPoint,\n Legends,\n IChildProps,\n IYValueHover,\n} from '../../index';\nimport { FocusZoneDirection } from '@fluentui/react-focus';\nimport {\n ChartTypes,\n IAxisData,\n getAccessibleDataObject,\n YAxisType,\n XAxisTypes,\n NumericAxis,\n StringAxis,\n getTypeOfAxis,\n getNextColor,\n} from '../../utilities/index';\n\nconst getClassNames = classNamesFunction<IHorizontalBarChartWithAxisStyleProps, IHorizontalBarChartWithAxisStyles>();\nexport interface IHorizontalBarChartWithAxisState extends IBasestate {\n selectedLegendTitle: string;\n dataPointCalloutProps?: IHorizontalBarChartWithAxisDataPoint; // define this in hover and focus\n /**\n * data point of x, where rectangle is hovered or focused\n */\n activeXdataPoint: number | null;\n YValueHover: IYValueHover[];\n hoverXValue?: string | number | null;\n callOutAccessibilityData?: IAccessibilityProps;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n tooltipElement?: any;\n}\n\ntype ColorScale = (_p?: number) => string;\n\nexport class HorizontalBarChartWithAxisBase extends React.Component<\n IHorizontalBarChartWithAxisProps,\n IHorizontalBarChartWithAxisState\n> {\n private _points: IHorizontalBarChartWithAxisDataPoint[];\n private _barHeight: number;\n private _colors: string[];\n private _classNames: IProcessedStyleSet<IHorizontalBarChartWithAxisStyles>;\n private _refArray: IRefArrayData[];\n private _calloutId: string;\n private margins: IMargins;\n private _isRtl: boolean = getRTL();\n private _bars: JSX.Element[];\n private _yAxisLabels: string[];\n private _xMax: number;\n private _tooltipId: string;\n private _xAxisType: XAxisTypes;\n private _yAxisType: YAxisType;\n private _calloutAnchorPoint: IHorizontalBarChartWithAxisDataPoint | null;\n\n public constructor(props: IHorizontalBarChartWithAxisProps) {\n super(props);\n this.state = {\n color: '',\n dataForHoverCard: 0,\n isCalloutVisible: false,\n isLegendSelected: false,\n isLegendHovered: false,\n refSelected: null,\n selectedLegendTitle: '',\n xCalloutValue: '',\n yCalloutValue: '',\n activeXdataPoint: null,\n YValueHover: [],\n hoverXValue: '',\n };\n this._calloutId = getId('callout');\n this._tooltipId = getId('HBCWATooltipID_');\n this._refArray = [];\n this._xAxisType =\n this.props.data! && this.props.data!.length > 0\n ? (getTypeOfAxis(this.props.data![0].x, true) as XAxisTypes)\n : XAxisTypes.NumericAxis;\n this._yAxisType =\n this.props.data! && this.props.data!.length > 0\n ? (getTypeOfAxis(this.props.data![0].y, false) as YAxisType)\n : YAxisType.StringAxis;\n }\n\n public render(): JSX.Element {\n this._adjustProps();\n const reversedBars = [...this._points].reverse();\n this._yAxisLabels = reversedBars.map((point: IHorizontalBarChartWithAxisDataPoint) => point.y as string);\n this._xMax = Math.max(\n d3Max(this._points, (point: IHorizontalBarChartWithAxisDataPoint) => point.x)!,\n this.props.xMaxValue || 0,\n );\n const legendBars: JSX.Element = this._getLegendData(this._points, this.props.theme!.palette);\n this._classNames = getClassNames(this.props.styles!, {\n theme: this.props.theme!,\n legendColor: this.state.color,\n });\n const calloutProps = {\n isCalloutVisible: this.state.isCalloutVisible,\n directionalHint: DirectionalHint.topAutoEdge,\n id: `toolTip${this._calloutId}`,\n target: this.state.refSelected,\n isBeakVisible: false,\n gapSpace: 15,\n color: this.state.color,\n legend: this.state.selectedLegendTitle,\n XValue: this.state.xCalloutValue,\n YValue: this.state.yCalloutValue ? this.state.yCalloutValue : this.state.dataForHoverCard,\n onDismiss: this._closeCallout,\n preventDismissOnLostFocus: true,\n ...this.props.calloutProps,\n ...getAccessibleDataObject(this.state.callOutAccessibilityData),\n };\n const tickParams = {\n tickValues: this.props.tickValues,\n tickFormat: this.props.tickFormat,\n };\n return (\n <CartesianChart\n {...this.props}\n points={this._points}\n chartType={ChartTypes.HorizontalBarChartWithAxis}\n xAxisType={this._xAxisType}\n yAxisType={this._yAxisType}\n stringDatasetForYAxisDomain={this._yAxisLabels}\n calloutProps={calloutProps}\n tickParams={tickParams}\n legendBars={legendBars}\n barwidth={this._barHeight}\n focusZoneDirection={FocusZoneDirection.vertical}\n customizedCallout={this._getCustomizedCallout()}\n getmargins={this._getMargins}\n getGraphData={this._getGraphData}\n getAxisData={this._getAxisData}\n onChartMouseLeave={this._handleChartMouseLeave}\n /* eslint-disable react/jsx-no-bind */\n // eslint-disable-next-line react/no-children-prop\n children={(props: IChildProps) => {\n return (\n <>\n <g>{this._bars}</g>\n </>\n );\n }}\n />\n );\n }\n\n private _adjustProps(): void {\n this._points = this.props.data || [];\n this._barHeight = this.props.barHeight || 32;\n const { palette } = this.props.theme!;\n this._colors = this.props.colors || [palette.blueLight, palette.blue, palette.blueMid, palette.blueDark];\n }\n\n private _getMargins = (margins: IMargins) => {\n this.margins = margins;\n };\n\n private _renderContentForOnlyBars = (point: IHorizontalBarChartWithAxisDataPoint): JSX.Element => {\n const { useSingleColor = false } = this.props;\n let selectedPointIndex = 0;\n this.props.data!.forEach((yDataPoint: IHorizontalBarChartWithAxisDataPoint, index: number) => {\n if (yDataPoint.y === point.y) {\n selectedPointIndex = index;\n }\n });\n let color: string;\n if (useSingleColor) {\n //if useSingle color , then check if user has given a palette or not\n // and pick the first color from that or else from our paltette.\n color = this.props.colors ? this._createColors()(1) : getNextColor(1, 0, this.props.theme?.isInverted);\n } else {\n color = point.color\n ? point.color\n : this.props.colors\n ? this._createColors()(point.x)\n : getNextColor(selectedPointIndex, 0, this.props.theme?.isInverted);\n }\n return (\n <>\n <ChartHoverCard\n XValue={point.xAxisCalloutData || point.x.toString()}\n Legend={point.legend}\n YValue={point.yAxisCalloutData || point.y}\n color={color}\n culture={this.props.culture}\n />\n </>\n );\n };\n\n private _renderCallout = (props?: IHorizontalBarChartWithAxisDataPoint): JSX.Element | null => {\n return props ? this._renderContentForOnlyBars(props) : null;\n };\n\n private _getCustomizedCallout = () => {\n return this.props.onRenderCalloutPerDataPoint\n ? this.props.onRenderCalloutPerDataPoint(this.state.dataPointCalloutProps, this._renderCallout)\n : null;\n };\n\n private _getGraphData = (\n xScale: NumericAxis,\n yScale: NumericAxis | StringAxis,\n containerHeight: number,\n containerWidth: number,\n xElement?: SVGElement | null,\n yElement?: SVGElement | null,\n ) => {\n return (this._bars =\n this._yAxisType === YAxisType.NumericAxis\n ? this._createNumericBars(containerHeight, containerWidth, xElement!, yElement!)\n : this._createStringBars(containerHeight, containerWidth, xElement!, yElement!));\n };\n\n private _createColors(): D3ScaleLinear<string, string> | ColorScale {\n const increment = this._colors.length <= 1 ? 1 : 1 / (this._colors.length - 1);\n const { useSingleColor = false } = this.props;\n if (useSingleColor) {\n return (_p?: number) => {\n const { theme, colors } = this.props;\n return colors && colors.length > 0 ? colors[0] : theme!.palette.blueLight;\n };\n }\n const domainValues = [];\n for (let i = 0; i < this._colors.length; i++) {\n domainValues.push(increment * i * this._xMax);\n }\n const colorScale = d3ScaleLinear<string>().domain(domainValues).range(this._colors);\n return colorScale;\n }\n\n private _refCallback = (element: SVGRectElement, legendTitle: string): void => {\n this._refArray.push({ index: legendTitle, refElement: element });\n };\n\n private _getCalloutContentForBar = (\n point: IHorizontalBarChartWithAxisDataPoint,\n ): { YValueHover: IYValueHover[]; hoverXValue: string | number | null } => {\n const YValueHover: IYValueHover[] = [];\n const { useSingleColor = false } = this.props;\n const { data } = this.props;\n const selectedPoint = data!.filter((yDataPoint: IHorizontalBarChartWithAxisDataPoint) => yDataPoint.y === point.y);\n let selectedPointIndex = 0;\n data!.forEach((yDataPoint: IHorizontalBarChartWithAxisDataPoint, index: number) => {\n if (yDataPoint.y === point.y) {\n selectedPointIndex = index;\n }\n });\n let color: string;\n if (useSingleColor) {\n //if useSingle color , then check if user has given a palette or not\n // and pick the first color from that or else from our paltette.\n color = this.props.colors ? this._createColors()(1) : getNextColor(1, 0, this.props.theme?.isInverted);\n } else {\n color = selectedPoint[0].color\n ? selectedPoint[0].color\n : this.props.colors\n ? this._createColors()(selectedPoint[0].x)\n : getNextColor(selectedPointIndex, 0, this.props.theme?.isInverted);\n }\n // callout data for the bar\n YValueHover.push({\n legend: selectedPoint[0].legend,\n // For HBCWA x and y Values are swapped\n y: selectedPoint[0].x,\n color,\n data: selectedPoint[0].yAxisCalloutData,\n yAxisCalloutData: selectedPoint[0].yAxisCalloutData,\n });\n return { YValueHover, hoverXValue: point.yAxisCalloutData || point.y.toString() };\n };\n\n private _onBarHover(\n point: IHorizontalBarChartWithAxisDataPoint,\n color: string,\n mouseEvent: React.MouseEvent<SVGElement>,\n ): void {\n mouseEvent.persist();\n\n const { YValueHover, hoverXValue } = this._getCalloutContentForBar(point);\n if (\n (this.state.isLegendSelected === false ||\n (this.state.isLegendSelected && this.state.selectedLegendTitle === point.legend)) &&\n this._calloutAnchorPoint !== point\n ) {\n this._calloutAnchorPoint = point;\n this.setState({\n refSelected: mouseEvent,\n isCalloutVisible: true,\n dataForHoverCard: point.x,\n selectedLegendTitle: point.legend!,\n color: this.props.useSingleColor ? color : point.color,\n // To display callout value, if no callout value given, taking given point.x value as a string.\n xCalloutValue: point.yAxisCalloutData! || point.y.toString(),\n yCalloutValue: point.xAxisCalloutData || point.x.toString(),\n dataPointCalloutProps: point,\n activeXdataPoint: point.x,\n YValueHover,\n hoverXValue,\n callOutAccessibilityData: point.callOutAccessibilityData,\n });\n }\n }\n\n private _onBarLeave = (): void => {\n /**/\n };\n\n private _handleChartMouseLeave = (): void => {\n this._calloutAnchorPoint = null;\n this.setState({\n isCalloutVisible: false,\n activeXdataPoint: null,\n YValueHover: [],\n hoverXValue: '',\n });\n };\n\n private _onBarFocus = (\n point: IHorizontalBarChartWithAxisDataPoint,\n refArrayIndexNumber: number,\n color: string,\n ): void => {\n if (\n this.state.isLegendSelected === false ||\n (this.state.isLegendSelected && this.state.selectedLegendTitle === point.legend)\n ) {\n const { YValueHover, hoverXValue } = this._getCalloutContentForBar(point);\n this._refArray.forEach((obj: IRefArrayData, index: number) => {\n if (refArrayIndexNumber === index) {\n this.setState({\n refSelected: obj.refElement,\n isCalloutVisible: true,\n selectedLegendTitle: point.legend!,\n dataForHoverCard: point.x,\n color: this.props.useSingleColor ? color : point.color,\n xCalloutValue: point.yAxisCalloutData || point.y.toString(),\n yCalloutValue: point.xAxisCalloutData! || point.x.toString(),\n dataPointCalloutProps: point,\n activeXdataPoint: point.x,\n YValueHover,\n hoverXValue,\n callOutAccessibilityData: point.callOutAccessibilityData,\n });\n }\n });\n }\n };\n\n private _getScales = (\n containerHeight: number,\n containerWidth: number,\n isNumericScale: boolean,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): { xBarScale: any; yBarScale: any } => {\n if (isNumericScale) {\n const xMax = d3Max(this._points, (point: IHorizontalBarChartWithAxisDataPoint) => point.x as number)!;\n const yMax = d3Max(this._points, (point: IHorizontalBarChartWithAxisDataPoint) => point.y as number)!;\n const xBarScale = d3ScaleLinear()\n .domain(this._isRtl ? [xMax, 0] : [0, xMax])\n .nice()\n .range([this.margins.left!, containerWidth - this.margins.right!]);\n const yBarScale = d3ScaleLinear()\n .domain([0, yMax])\n .range([containerHeight - this.margins.bottom!, this.margins.top!]);\n return { xBarScale, yBarScale };\n } else {\n const xMax = d3Max(this._points, (point: IHorizontalBarChartWithAxisDataPoint) => point.x as number)!;\n // please note these padding default values must be consistent in here\n // and CatrtesianChartBase w for more details refer example\n // http://using-d3js.com/04_07_ordinal_scales.html\n const yBarScale = d3ScaleBand()\n .domain(this._yAxisLabels)\n .range([containerHeight - this.margins.bottom! - this._barHeight / 2, this.margins.top! + this._barHeight / 2])\n .padding(this.props.yAxisPadding || 0);\n\n const xBarScale = d3ScaleLinear()\n .domain(this._isRtl ? [xMax, 0] : [0, xMax])\n .range([this.margins.left!, containerWidth - this.margins.right!]);\n return { xBarScale, yBarScale };\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _createNumericBars(\n containerHeight: number,\n containerWidth: number,\n xElement: SVGElement,\n yElement: SVGElement,\n ): JSX.Element[] {\n const { useSingleColor = false } = this.props;\n const { xBarScale, yBarScale } = this._getScales(containerHeight, containerWidth, true);\n const sortedBars: IHorizontalBarChartWithAxisDataPoint[] = [...this._points];\n sortedBars.sort((a, b) => {\n const aValue = typeof a.y === 'number' ? a.y : parseFloat(a.y);\n const bValue = typeof b.y === 'number' ? b.y : parseFloat(b.y);\n return bValue - aValue;\n });\n const bars = sortedBars.map((point: IHorizontalBarChartWithAxisDataPoint, index: number) => {\n let shouldHighlight = true;\n if (this.state.isLegendHovered || this.state.isLegendSelected) {\n shouldHighlight = this.state.selectedLegendTitle === point.legend;\n }\n this._classNames = getClassNames(this.props.styles!, {\n theme: this.props.theme!,\n legendColor: this.state.color,\n shouldHighlight: shouldHighlight,\n });\n const barHeight: number = Math.max(yBarScale(point.y), 0);\n if (barHeight < 1) {\n return <React.Fragment key={point.x}> </React.Fragment>;\n }\n let color: string;\n if (useSingleColor) {\n //if useSingle color , then check if user has given a palette or not\n // and pick the first color from that or else from our paltette.\n color = this.props.colors ? this._createColors()(1) : getNextColor(1, 0, this.props.theme?.isInverted);\n } else {\n color = this.props.colors\n ? this._createColors()(point.x)\n : getNextColor(index, 0, this.props.theme?.isInverted);\n }\n return (\n <rect\n key={point.y}\n x={this._isRtl ? xBarScale(point.x) : this.margins.left!}\n className={this._classNames.opacityChangeOnHover}\n y={yBarScale(point.y) - this._barHeight / 2}\n data-is-focusable={true}\n width={\n this._isRtl\n ? containerWidth - this.margins.right! - Math.max(xBarScale(point.x), 0)\n : Math.max(xBarScale(point.x), 0) - this.margins.left!\n }\n height={this._barHeight}\n ref={(e: SVGRectElement) => {\n this._refCallback(e, point.legend!);\n }}\n onClick={point.onClick}\n onMouseOver={this._onBarHover.bind(this, point, color)}\n aria-label={this._getAriaLabel(point)}\n role=\"img\"\n aria-labelledby={`toolTip${this._calloutId}`}\n onMouseLeave={this._onBarLeave}\n onFocus={this._onBarFocus.bind(this, point, index, color)}\n onBlur={this._onBarLeave}\n fill={point.color && !useSingleColor ? point.color : color}\n />\n );\n });\n return bars;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _tooltipOfYAxislabels(ytooltipProps: any) {\n const { tooltipCls, yAxis, id } = ytooltipProps;\n if (yAxis === null) {\n return null;\n }\n const div = d3Select('body').append('div').attr('id', id).attr('class', tooltipCls).style('opacity', 0);\n const aa = yAxis!.selectAll('#BaseSpan')._groups[0];\n const baseSpanLength = aa && Object.keys(aa)!.length;\n const originalDataArray: string[] = [];\n for (let i = 0; i < baseSpanLength; i++) {\n const originalData = aa[i].dataset && (Object.values(aa[i].dataset)[0] as string);\n originalDataArray.push(originalData);\n }\n const tickObject = yAxis!.selectAll('.tick')._groups[0];\n const tickObjectLength = tickObject && Object.keys(tickObject)!.length;\n for (let i = 0; i < tickObjectLength; i++) {\n const d1 = tickObject[i];\n d3Select(d1)\n .on('mouseover', d => {\n if (!this.state.tooltipElement) {\n div.style('opacity', 0.9);\n div\n .html(originalDataArray[i])\n .style('left', d3Event.pageX + 'px')\n .style('top', d3Event.pageY - 28 + 'px');\n }\n })\n .on('mouseout', d => {\n div.style('opacity', 0);\n });\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _createStringBars(\n containerHeight: number,\n containerWidth: number,\n xElement: SVGElement,\n yElement: SVGElement,\n ): JSX.Element[] {\n const { xBarScale, yBarScale } = this._getScales(containerHeight, containerWidth, false);\n const { useSingleColor = false } = this.props;\n const bars = this._points.map((point: IHorizontalBarChartWithAxisDataPoint, index: number) => {\n const barHeight: number = Math.max(yBarScale(point.y), 0);\n if (barHeight < 1) {\n return <React.Fragment key={point.x}> </React.Fragment>;\n }\n let color: string;\n if (useSingleColor) {\n //if useSingle color , then check if user has given a palette or not\n // and pick the first color from that or else from our paltette.\n color = this.props.colors ? this._createColors()(1) : getNextColor(1, 0, this.props.theme?.isInverted);\n } else {\n color = this.props.colors\n ? this._createColors()(point.x)\n : getNextColor(index, 0, this.props.theme?.isInverted);\n }\n\n return (\n <rect\n key={point.x}\n x={this._isRtl ? xBarScale(point.x) : this.margins.left!}\n y={yBarScale(point.y) + this._barHeight / 2}\n width={\n this._isRtl\n ? containerWidth - this.margins.right! - Math.max(xBarScale(point.x), 0)\n : Math.max(xBarScale(point.x), 0) - this.margins.left!\n }\n height={this._barHeight}\n aria-labelledby={`toolTip${this._calloutId}`}\n aria-label={this._getAriaLabel(point)}\n role=\"img\"\n ref={(e: SVGRectElement) => {\n this._refCallback(e, point.legend!);\n }}\n onClick={point.onClick}\n onMouseOver={this._onBarHover.bind(this, point, color)}\n onMouseLeave={this._onBarLeave}\n onBlur={this._onBarLeave}\n data-is-focusable={true}\n onFocus={this._onBarFocus.bind(this, point, index, color)}\n fill={point.color && !useSingleColor ? point.color : color}\n />\n );\n });\n\n // Removing un wanted tooltip div from DOM, when prop not provided, for proper cleanup\n // of unwanted DOM elements, to prevent flacky behaviour in tooltips , that might occur\n // in creating tooltips when tooltips are enabled( as we try to recreate a tspan with this._tooltipId)\n if (!this.props.showYAxisLablesTooltip) {\n try {\n document.getElementById(this._tooltipId) && document.getElementById(this._tooltipId)!.remove();\n //eslint-disable-next-line no-empty\n } catch (e) {}\n }\n // Used to display tooltip at y axis labels.\n if (this.props.showYAxisLablesTooltip) {\n const yAxisElement = d3Select(yElement).call(yBarScale);\n if (!this.state.tooltipElement) {\n try {\n document.getElementById(this._tooltipId) && document.getElementById(this._tooltipId)!.remove();\n //eslint-disable-next-line no-empty\n } catch (e) {}\n }\n const ytooltipProps = {\n tooltipCls: this._classNames.tooltip!,\n id: this._tooltipId,\n yAxis: yAxisElement,\n };\n yAxisElement && this._tooltipOfYAxislabels(ytooltipProps);\n }\n return bars;\n }\n\n private _closeCallout = () => {\n this.setState({\n isCalloutVisible: false,\n });\n };\n\n private _onLegendClick(customMessage: string): void {\n if (this.state.isLegendSelected) {\n if (this.state.selectedLegendTitle === customMessage) {\n this.setState({\n isLegendSelected: false,\n selectedLegendTitle: customMessage,\n });\n } else {\n this.setState({\n selectedLegendTitle: customMessage,\n });\n }\n } else {\n this.setState({\n isLegendSelected: true,\n selectedLegendTitle: customMessage,\n });\n }\n }\n\n private _onLegendHover(customMessage: string): void {\n if (this.state.isLegendSelected === false) {\n this.setState({\n isLegendHovered: true,\n selectedLegendTitle: customMessage,\n });\n }\n }\n\n private _onLegendLeave(isLegendFocused?: boolean): void {\n if (!!isLegendFocused || this.state.isLegendSelected === false) {\n this.setState({\n isLegendHovered: false,\n selectedLegendTitle: '',\n isLegendSelected: isLegendFocused ? false : this.state.isLegendSelected,\n });\n }\n }\n\n private _getLegendData = (data: IHorizontalBarChartWithAxisDataPoint[], palette: IPalette): JSX.Element => {\n const { useSingleColor } = this.props;\n const actions: ILegend[] = [];\n data.forEach((point: IHorizontalBarChartWithAxisDataPoint, _index: number) => {\n const color: string = useSingleColor\n ? this.props.colors\n ? this._createColors()(1)\n : getNextColor(1, 0, this.props.theme?.isInverted)\n : point.color!;\n // mapping data to the format Legends component needs\n const legend: ILegend = {\n title: point.legend!,\n color: color,\n action: () => {\n this._onLegendClick(point.legend!);\n },\n hoverAction: () => {\n this._onLegendHover(point.legend!);\n },\n onMouseOutAction: (isLegendSelected?: boolean) => {\n this._onLegendLeave(isLegendSelected);\n },\n };\n actions.push(legend);\n });\n const legends = (\n <Legends\n legends={actions}\n enabledWrapLines={this.props.enabledLegendsWrapLines}\n overflowProps={this.props.legendsOverflowProps}\n focusZonePropsInHoverCard={this.props.focusZonePropsForLegendsInHoverCard}\n overflowText={this.props.legendsOverflowText}\n {...this.props.legendProps}\n />\n );\n return legends;\n };\n\n private _getAxisData = (yAxisData: IAxisData) => {\n if (yAxisData && yAxisData.yAxisDomainValues.length) {\n // For HBCWA x and y Values are swapped\n const { yAxisDomainValues: domainValue } = yAxisData;\n this._xMax = Math.max(domainValue[domainValue.length - 1], this.props.xMaxValue || 0);\n }\n };\n private _getAriaLabel = (point: IHorizontalBarChartWithAxisDataPoint): string => {\n const xValue = point.xAxisCalloutData || point.x;\n const yValue = point.yAxisCalloutData || point.y;\n return point.callOutAccessibilityData?.ariaLabel || `${xValue}. ` + `${yValue}.`;\n };\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { IHorizontalBarChartWithAxisProps } from '../../index';
3
+ export declare const HorizontalBarChartWithAxis: React.FunctionComponent<IHorizontalBarChartWithAxisProps>;
@@ -0,0 +1,8 @@
1
+ define(["require", "exports", "../../Utilities", "./HorizontalBarChartWithAxis.base", "./HorizontalBarChartWithAxis.styles"], function (require, exports, Utilities_1, HorizontalBarChartWithAxis_base_1, HorizontalBarChartWithAxis_styles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.HorizontalBarChartWithAxis = void 0;
5
+ // Create a HorizontalBarChartWithAxis variant which uses these default styles and this styled subcomponent.
6
+ exports.HorizontalBarChartWithAxis = Utilities_1.styled(HorizontalBarChartWithAxis_base_1.HorizontalBarChartWithAxisBase, HorizontalBarChartWithAxis_styles_1.getStyles);
7
+ });
8
+ //# sourceMappingURL=HorizontalBarChartWithAxis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HorizontalBarChartWithAxis.js","sourceRoot":"../src/","sources":["components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.tsx"],"names":[],"mappings":";;;;IAUA,4GAA4G;IAC/F,QAAA,0BAA0B,GAA8D,kBAAM,CAIzG,gEAA8B,EAAE,6CAAS,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { styled } from '../../Utilities';\nimport {\n IHorizontalBarChartWithAxisProps,\n IHorizontalBarChartWithAxisStyleProps,\n IHorizontalBarChartWithAxisStyles,\n} from '../../index';\nimport { HorizontalBarChartWithAxisBase } from './HorizontalBarChartWithAxis.base';\nimport { getStyles } from './HorizontalBarChartWithAxis.styles';\n\n// Create a HorizontalBarChartWithAxis variant which uses these default styles and this styled subcomponent.\nexport const HorizontalBarChartWithAxis: React.FunctionComponent<IHorizontalBarChartWithAxisProps> = styled<\n IHorizontalBarChartWithAxisProps,\n IHorizontalBarChartWithAxisStyleProps,\n IHorizontalBarChartWithAxisStyles\n>(HorizontalBarChartWithAxisBase, getStyles);\n"]}
@@ -0,0 +1,2 @@
1
+ import { IHorizontalBarChartWithAxisStyleProps, IHorizontalBarChartWithAxisStyles } from '../../index';
2
+ export declare const getStyles: (props: IHorizontalBarChartWithAxisStyleProps) => IHorizontalBarChartWithAxisStyles;
@@ -0,0 +1,17 @@
1
+ define(["require", "exports", "tslib"], function (require, exports, tslib_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getStyles = void 0;
5
+ var getStyles = function (props) {
6
+ var shouldHighlight = props.shouldHighlight, theme = props.theme;
7
+ return {
8
+ opacityChangeOnHover: {
9
+ opacity: shouldHighlight ? '' : '0.1',
10
+ },
11
+ xAxisTicks: [],
12
+ tooltip: tslib_1.__assign(tslib_1.__assign({}, theme.fonts.medium), { display: 'flex', flexDirection: 'column', padding: '8px', position: 'absolute', textAlign: 'center', top: '0px', background: theme.semanticColors.bodyBackground, borderRadius: '2px', pointerEvents: 'none' }),
13
+ };
14
+ };
15
+ exports.getStyles = getStyles;
16
+ });
17
+ //# sourceMappingURL=HorizontalBarChartWithAxis.styles.js.map