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