@fluentui/react-charting 5.24.12 → 5.24.14

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 (154) hide show
  1. package/CHANGELOG.json +61 -1
  2. package/CHANGELOG.md +25 -2
  3. package/bundle-size/GanttChart.fixture.js +7 -0
  4. package/dist/react-charting.d.ts +128 -3
  5. package/dist/react-charting.js +1 -1
  6. package/dist/react-charting.min.js +1 -1
  7. package/etc/react-charting.api.md +44 -2
  8. package/lib/GanttChart.d.ts +1 -0
  9. package/lib/GanttChart.js +2 -0
  10. package/lib/GanttChart.js.map +1 -0
  11. package/lib/components/CommonComponents/CartesianChart.base.js +2 -1
  12. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  13. package/lib/components/CommonComponents/CartesianChart.types.d.ts +3 -3
  14. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  15. package/lib/components/DeclarativeChart/DeclarativeChart.js +10 -3
  16. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  17. package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  18. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +23 -0
  19. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  20. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  21. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +78 -62
  22. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  23. package/lib/components/GanttChart/GanttChart.base.d.ts +3 -0
  24. package/lib/components/GanttChart/GanttChart.base.js +329 -0
  25. package/lib/components/GanttChart/GanttChart.base.js.map +1 -0
  26. package/lib/components/GanttChart/GanttChart.d.ts +7 -0
  27. package/lib/components/GanttChart/GanttChart.js +10 -0
  28. package/lib/components/GanttChart/GanttChart.js.map +1 -0
  29. package/lib/components/GanttChart/GanttChart.styles.d.ts +2 -0
  30. package/lib/components/GanttChart/GanttChart.styles.js +4 -0
  31. package/lib/components/GanttChart/GanttChart.styles.js.map +1 -0
  32. package/lib/components/GanttChart/GanttChart.types.d.ts +67 -0
  33. package/lib/components/GanttChart/GanttChart.types.js +2 -0
  34. package/lib/components/GanttChart/GanttChart.types.js.map +1 -0
  35. package/lib/components/GanttChart/index.d.ts +2 -0
  36. package/lib/components/GanttChart/index.js +3 -0
  37. package/lib/components/GanttChart/index.js.map +1 -0
  38. package/lib/components/LineChart/LineChart.base.js +6 -11
  39. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  40. package/lib/components/ScatterChart/ScatterChart.base.js +12 -26
  41. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  42. package/lib/index.d.ts +3 -1
  43. package/lib/index.js +1 -0
  44. package/lib/index.js.map +1 -1
  45. package/lib/types/IDataPoint.d.ts +49 -0
  46. package/lib/types/IDataPoint.js.map +1 -1
  47. package/lib/utilities/scatterpolar-utils.d.ts +7 -4
  48. package/lib/utilities/scatterpolar-utils.js +19 -2
  49. package/lib/utilities/scatterpolar-utils.js.map +1 -1
  50. package/lib/utilities/test-data.d.ts +4 -1
  51. package/lib/utilities/test-data.js +213 -0
  52. package/lib/utilities/test-data.js.map +1 -1
  53. package/lib/utilities/utilities.d.ts +8 -6
  54. package/lib/utilities/utilities.js +9 -5
  55. package/lib/utilities/utilities.js.map +1 -1
  56. package/lib-amd/GanttChart.d.ts +1 -0
  57. package/lib-amd/GanttChart.js +6 -0
  58. package/lib-amd/GanttChart.js.map +1 -0
  59. package/lib-amd/components/CommonComponents/CartesianChart.base.js +2 -1
  60. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  61. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +3 -3
  62. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  63. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +10 -4
  64. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  65. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  66. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +25 -2
  67. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  68. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  69. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +79 -62
  70. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  71. package/lib-amd/components/GanttChart/GanttChart.base.d.ts +3 -0
  72. package/lib-amd/components/GanttChart/GanttChart.base.js +325 -0
  73. package/lib-amd/components/GanttChart/GanttChart.base.js.map +1 -0
  74. package/lib-amd/components/GanttChart/GanttChart.d.ts +7 -0
  75. package/lib-amd/components/GanttChart/GanttChart.js +12 -0
  76. package/lib-amd/components/GanttChart/GanttChart.js.map +1 -0
  77. package/lib-amd/components/GanttChart/GanttChart.styles.d.ts +2 -0
  78. package/lib-amd/components/GanttChart/GanttChart.styles.js +10 -0
  79. package/lib-amd/components/GanttChart/GanttChart.styles.js.map +1 -0
  80. package/lib-amd/components/GanttChart/GanttChart.types.d.ts +67 -0
  81. package/lib-amd/components/GanttChart/GanttChart.types.js +5 -0
  82. package/lib-amd/components/GanttChart/GanttChart.types.js.map +1 -0
  83. package/lib-amd/components/GanttChart/index.d.ts +2 -0
  84. package/lib-amd/components/GanttChart/index.js +7 -0
  85. package/lib-amd/components/GanttChart/index.js.map +1 -0
  86. package/lib-amd/components/LineChart/LineChart.base.js +6 -11
  87. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  88. package/lib-amd/components/ScatterChart/ScatterChart.base.js +12 -26
  89. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  90. package/lib-amd/index.d.ts +3 -1
  91. package/lib-amd/index.js +3 -2
  92. package/lib-amd/index.js.map +1 -1
  93. package/lib-amd/types/IDataPoint.d.ts +49 -0
  94. package/lib-amd/types/IDataPoint.js.map +1 -1
  95. package/lib-amd/utilities/scatterpolar-utils.d.ts +7 -4
  96. package/lib-amd/utilities/scatterpolar-utils.js +21 -3
  97. package/lib-amd/utilities/scatterpolar-utils.js.map +1 -1
  98. package/lib-amd/utilities/test-data.d.ts +4 -1
  99. package/lib-amd/utilities/test-data.js +214 -2
  100. package/lib-amd/utilities/test-data.js.map +1 -1
  101. package/lib-amd/utilities/utilities.d.ts +8 -6
  102. package/lib-amd/utilities/utilities.js +10 -5
  103. package/lib-amd/utilities/utilities.js.map +1 -1
  104. package/lib-commonjs/GanttChart.d.ts +1 -0
  105. package/lib-commonjs/GanttChart.js +5 -0
  106. package/lib-commonjs/GanttChart.js.map +1 -0
  107. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +2 -1
  108. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  109. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +3 -3
  110. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  111. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +11 -4
  112. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  113. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  114. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +25 -1
  115. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  116. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  117. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +79 -62
  118. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  119. package/lib-commonjs/components/GanttChart/GanttChart.base.d.ts +3 -0
  120. package/lib-commonjs/components/GanttChart/GanttChart.base.js +332 -0
  121. package/lib-commonjs/components/GanttChart/GanttChart.base.js.map +1 -0
  122. package/lib-commonjs/components/GanttChart/GanttChart.d.ts +7 -0
  123. package/lib-commonjs/components/GanttChart/GanttChart.js +13 -0
  124. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -0
  125. package/lib-commonjs/components/GanttChart/GanttChart.styles.d.ts +2 -0
  126. package/lib-commonjs/components/GanttChart/GanttChart.styles.js +8 -0
  127. package/lib-commonjs/components/GanttChart/GanttChart.styles.js.map +1 -0
  128. package/lib-commonjs/components/GanttChart/GanttChart.types.d.ts +67 -0
  129. package/lib-commonjs/components/GanttChart/GanttChart.types.js +3 -0
  130. package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -0
  131. package/lib-commonjs/components/GanttChart/index.d.ts +2 -0
  132. package/lib-commonjs/components/GanttChart/index.js +6 -0
  133. package/lib-commonjs/components/GanttChart/index.js.map +1 -0
  134. package/lib-commonjs/components/LineChart/LineChart.base.js +6 -11
  135. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  136. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +12 -26
  137. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  138. package/lib-commonjs/index.d.ts +3 -1
  139. package/lib-commonjs/index.js +3 -1
  140. package/lib-commonjs/index.js.map +1 -1
  141. package/lib-commonjs/types/IDataPoint.d.ts +49 -0
  142. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  143. package/lib-commonjs/utilities/scatterpolar-utils.d.ts +7 -4
  144. package/lib-commonjs/utilities/scatterpolar-utils.js +21 -3
  145. package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -1
  146. package/lib-commonjs/utilities/test-data.d.ts +4 -1
  147. package/lib-commonjs/utilities/test-data.js +214 -1
  148. package/lib-commonjs/utilities/test-data.js.map +1 -1
  149. package/lib-commonjs/utilities/utilities.d.ts +8 -6
  150. package/lib-commonjs/utilities/utilities.js +11 -6
  151. package/lib-commonjs/utilities/utilities.js.map +1 -1
  152. package/package.json +2 -2
  153. package/src/components/CommonComponents/CartesianChart.types.ts +5 -2
  154. package/src/components/GanttChart/GanttChart.types.ts +83 -0
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { IGanttChartProps } from './GanttChart.types';
3
+ export declare const GanttChartBase: React.FunctionComponent<IGanttChartProps>;
@@ -0,0 +1,329 @@
1
+ import { __assign, __rest } from "tslib";
2
+ import * as React from 'react';
3
+ import { max as d3Max, min as d3Min } from 'd3-array';
4
+ import { DirectionalHint, FocusZoneDirection, getId, getRTL } from '@fluentui/react';
5
+ import { Legends } from '../Legends/index';
6
+ import { CartesianChart } from '../CommonComponents/index';
7
+ import { ChartHoverCard, ChartTypes, YAxisType, XAxisTypes, getTypeOfAxis, getNextColor, findHBCWANumericMinMaxOfY, createYAxisForHorizontalBarChartWithAxis, createStringYAxisForHorizontalBarChartWithAxis, getNextGradient, areArraysEqual, MIN_DOMAIN_MARGIN, sortAxisCategories, calculateAppropriateBarWidth, getColorFromToken, getScalePadding, getDateFormatLevel, } from '../../utilities/index';
8
+ import { toImage } from '../../utilities/image-export-utils';
9
+ import { formatDateToLocaleString, getMultiLevelDateTimeFormatOptions } from '@fluentui/chart-utilities';
10
+ export var GanttChartBase = React.forwardRef(function (_a, forwardedRef) {
11
+ var _b, _c;
12
+ var _d = _a.useUTC, useUTC = _d === void 0 ? true : _d, _e = _a.yAxisCategoryOrder, yAxisCategoryOrder = _e === void 0 ? 'default' : _e, props = __rest(_a, ["useUTC", "yAxisCategoryOrder"]);
13
+ var _barHeight = React.useRef(0);
14
+ var _calloutId = React.useRef(getId('callout'));
15
+ var margins = React.useRef({});
16
+ var _bars = React.useRef([]);
17
+ var _xAxisType = React.useRef(XAxisTypes.DateAxis);
18
+ var _yAxisType = React.useRef(YAxisType.StringAxis);
19
+ var _calloutAnchorPoint = React.useRef(null);
20
+ var _cartesianChartRef = React.useRef(null);
21
+ var _legendsRef = React.useRef(null);
22
+ var _domainMargin = React.useRef(MIN_DOMAIN_MARGIN);
23
+ var _yAxisPadding = React.useRef(0);
24
+ var _emptyChartId = React.useRef(getId('Gantt_empty'));
25
+ var _legendColorMap = React.useRef({});
26
+ var _gradientId = React.useRef(getId('Gantt_gradient'));
27
+ var prevProps = React.useRef({});
28
+ var _f = React.useState(''), calloutColor = _f[0], setCalloutColor = _f[1];
29
+ var _g = React.useState(false), isCalloutVisible = _g[0], setCalloutVisible = _g[1];
30
+ var _h = React.useState(''), hoveredLegend = _h[0], setHoveredLegend = _h[1];
31
+ var _j = React.useState(null), calloutTarget = _j[0], setCalloutTarget = _j[1];
32
+ var _k = React.useState(''), calloutLegend = _k[0], setCalloutLegend = _k[1];
33
+ var _l = React.useState(''), xCalloutValue = _l[0], setXCalloutValue = _l[1];
34
+ var _m = React.useState(''), yCalloutValue = _m[0], setYCalloutValue = _m[1];
35
+ var _o = React.useState(((_b = props.legendProps) === null || _b === void 0 ? void 0 : _b.selectedLegends) || []), selectedLegends = _o[0], setSelectedLegends = _o[1];
36
+ var _p = React.useState(), dataPointCalloutProps = _p[0], setDataPointCalloutProps = _p[1];
37
+ React.useEffect(function () {
38
+ var _a, _b, _c;
39
+ if (!areArraysEqual((_a = prevProps.current.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegends, (_b = props.legendProps) === null || _b === void 0 ? void 0 : _b.selectedLegends)) {
40
+ setSelectedLegends(((_c = props.legendProps) === null || _c === void 0 ? void 0 : _c.selectedLegends) || []);
41
+ }
42
+ prevProps.current = props;
43
+ }, [props]);
44
+ React.useImperativeHandle(props.componentRef, function () {
45
+ var _a, _b;
46
+ return ({
47
+ chartContainer: (_b = (_a = _cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer) !== null && _b !== void 0 ? _b : null,
48
+ toImage: function (opts) {
49
+ var _a, _b;
50
+ return toImage((_a = _cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer, (_b = _legendsRef.current) === null || _b === void 0 ? void 0 : _b.toSVG, getRTL(), opts);
51
+ },
52
+ });
53
+ }, []);
54
+ var _points = React.useMemo(function () {
55
+ var _a, _b;
56
+ _legendColorMap.current = {};
57
+ var colorIndex = 0;
58
+ return ((_b = (_a = props.data) === null || _a === void 0 ? void 0 : _a.map(function (point) {
59
+ var _a, _b, _c, _d, _e;
60
+ var legend = "".concat(point.legend);
61
+ if (!_legendColorMap.current[legend]) {
62
+ var startColor = point.color
63
+ ? getColorFromToken(point.color, (_a = props.theme) === null || _a === void 0 ? void 0 : _a.isInverted)
64
+ : getNextColor(colorIndex, 0, (_b = props.theme) === null || _b === void 0 ? void 0 : _b.isInverted);
65
+ var endColor = startColor;
66
+ if (props.enableGradient) {
67
+ var nextGradient = getNextGradient(colorIndex, 0, (_c = props.theme) === null || _c === void 0 ? void 0 : _c.isInverted);
68
+ startColor = ((_d = point.gradient) === null || _d === void 0 ? void 0 : _d[0]) || nextGradient[0];
69
+ endColor = ((_e = point.gradient) === null || _e === void 0 ? void 0 : _e[1]) || nextGradient[1];
70
+ }
71
+ _legendColorMap.current[legend] = [startColor, endColor];
72
+ colorIndex += 1;
73
+ }
74
+ return __assign(__assign(__assign({}, point), { color: _legendColorMap.current[legend][0] }), (props.enableGradient ? { gradient: _legendColorMap.current[legend] } : {}));
75
+ })) !== null && _b !== void 0 ? _b : []);
76
+ }, [props.data, (_c = props.theme) === null || _c === void 0 ? void 0 : _c.isInverted, props.enableGradient]);
77
+ var _dateFormatOptions = React.useMemo(function () {
78
+ if (_xAxisType.current !== XAxisTypes.DateAxis) {
79
+ return undefined;
80
+ }
81
+ var lowestFormatLevel = 100;
82
+ var highestFormatLevel = -1;
83
+ _points.forEach(function (p) {
84
+ var startFormatLevel = getDateFormatLevel(p.x.start, useUTC);
85
+ var endFormatLevel = getDateFormatLevel(p.x.end, useUTC);
86
+ lowestFormatLevel = Math.min(lowestFormatLevel, startFormatLevel, endFormatLevel);
87
+ highestFormatLevel = Math.max(highestFormatLevel, startFormatLevel, endFormatLevel);
88
+ });
89
+ return getMultiLevelDateTimeFormatOptions(lowestFormatLevel, highestFormatLevel);
90
+ }, [useUTC, _points]);
91
+ var _getDomainNRangeValues = React.useCallback(function (points, _margins, containerWidth, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
92
+ var xValues = [];
93
+ points.forEach(function (point) {
94
+ xValues.push(point.x.start, point.x.end);
95
+ });
96
+ var xMin = d3Min(xValues) || 0;
97
+ var xMax = d3Max(xValues) || 0;
98
+ return {
99
+ dStartValue: isRTL ? xMax : xMin,
100
+ dEndValue: isRTL ? xMin : xMax,
101
+ rStartValue: _margins.left + (isRTL ? 0 : shiftX),
102
+ rEndValue: containerWidth - _margins.right - (isRTL ? shiftX : 0),
103
+ };
104
+ }, []);
105
+ var _adjustProps = function () {
106
+ _barHeight.current = Math.max(props.barHeight || 24, 1);
107
+ if (props.data && props.data.length > 0) {
108
+ _xAxisType.current = getTypeOfAxis(props.data[0].x.start, true);
109
+ _yAxisType.current = getTypeOfAxis(props.data[0].y, false);
110
+ }
111
+ _yAxisPadding.current = getScalePadding(props.yAxisPadding, undefined, 1 / 2);
112
+ };
113
+ var _getMargins = React.useCallback(function (_margins) {
114
+ margins.current = _margins;
115
+ }, []);
116
+ var _renderContentForOnlyBars = function (point) {
117
+ return (React.createElement(ChartHoverCard, { XValue: point.yAxisCalloutData || point.y.toString(), Legend: point.legend, YValue: point.xAxisCalloutData || _getFormattedXValue(point), color: point.color, culture: props.culture }));
118
+ };
119
+ var _renderCallout = function (point) {
120
+ return point ? _renderContentForOnlyBars(point) : null;
121
+ };
122
+ var _getCustomizedCallout = function () {
123
+ return props.onRenderCalloutPerDataPoint
124
+ ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps, _renderCallout)
125
+ : null;
126
+ };
127
+ var _getFormattedXValue = React.useCallback(function (point) {
128
+ var formattedStartX;
129
+ var formattedEndX;
130
+ if (_xAxisType.current === XAxisTypes.DateAxis) {
131
+ formattedStartX = formatDateToLocaleString(point.x.start, props.culture, useUTC, false, _dateFormatOptions);
132
+ formattedEndX = formatDateToLocaleString(point.x.end, props.culture, useUTC, false, _dateFormatOptions);
133
+ }
134
+ else {
135
+ formattedStartX = point.x.start.toString();
136
+ formattedEndX = point.x.end.toString();
137
+ }
138
+ return "".concat(formattedStartX, " - ").concat(formattedEndX);
139
+ }, [props.culture, useUTC, _dateFormatOptions]);
140
+ var _getAriaLabel = React.useCallback(function (point) {
141
+ var _a;
142
+ var xValue = point.xAxisCalloutData || _getFormattedXValue(point);
143
+ var yValue = point.yAxisCalloutData || point.y;
144
+ return ((_a = point.callOutAccessibilityData) === null || _a === void 0 ? void 0 : _a.ariaLabel) || "".concat(yValue, ". ") + "".concat(xValue, ".");
145
+ }, [_getFormattedXValue]);
146
+ var _getHighlightedLegend = React.useCallback(function () {
147
+ return selectedLegends.length > 0 ? selectedLegends : hoveredLegend ? [hoveredLegend] : [];
148
+ }, [hoveredLegend, selectedLegends]);
149
+ /**
150
+ * This function checks if the given legend is highlighted or not.
151
+ * A legend can be highlighted in 2 ways:
152
+ * 1. selection: if the user clicks on it
153
+ * 2. hovering: if there is no selected legend and the user hovers over it
154
+ */
155
+ var _legendHighlighted = React.useCallback(function (legend) {
156
+ return _getHighlightedLegend().includes("".concat(legend));
157
+ }, [_getHighlightedLegend]);
158
+ /**
159
+ * This function checks if none of the legends is selected or hovered.
160
+ */
161
+ var _noLegendHighlighted = React.useCallback(function () {
162
+ return _getHighlightedLegend().length === 0;
163
+ }, [_getHighlightedLegend]);
164
+ var _showCallout = React.useCallback(function (target, point) {
165
+ if (!(_noLegendHighlighted() || _legendHighlighted(point.legend)) || _calloutAnchorPoint.current === point) {
166
+ return;
167
+ }
168
+ _calloutAnchorPoint.current = point;
169
+ setCalloutTarget(target);
170
+ setCalloutVisible(true);
171
+ setCalloutLegend(point.legend);
172
+ setCalloutColor(point.color);
173
+ setXCalloutValue(point.yAxisCalloutData || point.y.toString());
174
+ setYCalloutValue(point.xAxisCalloutData || _getFormattedXValue(point));
175
+ setDataPointCalloutProps(point);
176
+ }, [_getFormattedXValue, _legendHighlighted, _noLegendHighlighted]);
177
+ var _onBarFocus = React.useCallback(function (point, focusEvent) {
178
+ _showCallout(focusEvent.currentTarget, point);
179
+ }, [_showCallout]);
180
+ var _onBarHover = React.useCallback(function (point, mouseEvent) {
181
+ _showCallout(mouseEvent.currentTarget, point);
182
+ }, [_showCallout]);
183
+ var _createBars = React.useCallback(function (xScale, yScale) {
184
+ var bars = _points.map(function (point, index) {
185
+ var shouldHighlight = _noLegendHighlighted() || _legendHighlighted(point.legend);
186
+ var startColor = point.color;
187
+ var endColor = startColor;
188
+ if (props.enableGradient) {
189
+ startColor = point.gradient[0];
190
+ endColor = point.gradient[1];
191
+ }
192
+ var gradientId = "".concat(_gradientId.current, "_").concat(index);
193
+ var startX = xScale(point.x.start);
194
+ var endX = xScale(point.x.end);
195
+ var y = (_yAxisType.current === YAxisType.StringAxis
196
+ ? yScale(point.y) + yScale.bandwidth() / 2
197
+ : yScale(point.y)) -
198
+ _barHeight.current / 2;
199
+ return (React.createElement(React.Fragment, { key: index },
200
+ props.enableGradient && (React.createElement("defs", null,
201
+ React.createElement("linearGradient", { id: gradientId },
202
+ React.createElement("stop", { offset: "0", stopColor: startColor }),
203
+ React.createElement("stop", { offset: "100%", stopColor: endColor })))),
204
+ React.createElement("rect", { x: Math.min(startX, endX), y: y, width: Math.abs(endX - startX), height: _barHeight.current, rx: props.roundCorners ? 3 : 0, fill: props.enableGradient ? "url(#".concat(gradientId, ")") : startColor, opacity: shouldHighlight ? 1 : 0.1, onClick: point.onClick, onMouseOver: function (event) { return _onBarHover(point, event); }, onMouseLeave: _onBarLeave, onFocus: function (event) { return _onBarFocus(point, event); }, onBlur: _onBarLeave, "data-is-focusable": shouldHighlight, role: "img", "aria-label": _getAriaLabel(point) })));
205
+ });
206
+ return bars;
207
+ }, [
208
+ _getAriaLabel,
209
+ _legendHighlighted,
210
+ _noLegendHighlighted,
211
+ _onBarFocus,
212
+ _onBarHover,
213
+ props.enableGradient,
214
+ props.roundCorners,
215
+ _points,
216
+ ]);
217
+ var _getGraphData = React.useCallback(function (xScale, yScale, containerHeight, containerWidth, xAxisElement, yAxisElement) {
218
+ return (_bars.current = _createBars(xScale, yScale));
219
+ }, [_createBars]);
220
+ var _onBarLeave = function () {
221
+ // do nothing
222
+ };
223
+ var _handleChartMouseLeave = React.useCallback(function () {
224
+ _calloutAnchorPoint.current = null;
225
+ setCalloutTarget(null);
226
+ setCalloutVisible(false);
227
+ setCalloutLegend('');
228
+ setCalloutColor('');
229
+ setXCalloutValue('');
230
+ setYCalloutValue('');
231
+ setDataPointCalloutProps(undefined);
232
+ }, []);
233
+ var _closeCallout = function () {
234
+ setCalloutVisible(false);
235
+ };
236
+ var _onLegendHover = function (legend) {
237
+ setHoveredLegend(legend);
238
+ };
239
+ var _onLegendLeave = function () {
240
+ setHoveredLegend('');
241
+ };
242
+ var _getLegendData = function () {
243
+ var actions = [];
244
+ Object.keys(_legendColorMap.current).forEach(function (legendTitle) {
245
+ var legend = {
246
+ title: legendTitle,
247
+ color: _legendColorMap.current[legendTitle][0],
248
+ hoverAction: function () {
249
+ _handleChartMouseLeave();
250
+ _onLegendHover(legendTitle);
251
+ },
252
+ onMouseOutAction: function () {
253
+ _onLegendLeave();
254
+ },
255
+ };
256
+ actions.push(legend);
257
+ });
258
+ var legends = (React.createElement(Legends, __assign({ legends: actions, enabledWrapLines: props.enabledLegendsWrapLines, overflowProps: props.legendsOverflowProps, focusZonePropsInHoverCard: props.focusZonePropsForLegendsInHoverCard, overflowText: props.legendsOverflowText, onChange: _onLegendSelectionChange, ref: _legendsRef }, props.legendProps)));
259
+ return legends;
260
+ };
261
+ var _onLegendSelectionChange = function (_selectedLegends, event, currentLegend) {
262
+ var _a, _b;
263
+ if ((_a = props.legendProps) === null || _a === void 0 ? void 0 : _a.canSelectMultipleLegends) {
264
+ setSelectedLegends(_selectedLegends);
265
+ }
266
+ else {
267
+ setSelectedLegends(_selectedLegends.slice(-1));
268
+ }
269
+ if ((_b = props.legendProps) === null || _b === void 0 ? void 0 : _b.onChange) {
270
+ props.legendProps.onChange(_selectedLegends, event, currentLegend);
271
+ }
272
+ };
273
+ var _getChartTitle = function () {
274
+ var chartTitle = props.chartTitle;
275
+ return (chartTitle ? "".concat(chartTitle, ". ") : '') + "Gantt chart with ".concat(_points.length, " bars. ");
276
+ };
277
+ var _isChartEmpty = function () {
278
+ return !(props.data && props.data.length > 0);
279
+ };
280
+ var _getYDomainMargins = React.useCallback(function (containerHeight) {
281
+ _domainMargin.current = MIN_DOMAIN_MARGIN;
282
+ var ySet = new Set();
283
+ _points.forEach(function (point) {
284
+ ySet.add(point.y);
285
+ });
286
+ var uniqueY = Array.from(ySet);
287
+ /** Total height available to render the bars */
288
+ var totalHeight = containerHeight - (margins.current.top + MIN_DOMAIN_MARGIN) - (margins.current.bottom + MIN_DOMAIN_MARGIN);
289
+ if (_yAxisType.current !== YAxisType.StringAxis) {
290
+ _barHeight.current = Math.max(props.barHeight ||
291
+ calculateAppropriateBarWidth(uniqueY, totalHeight, _yAxisPadding.current), 1);
292
+ _domainMargin.current += _barHeight.current / 2;
293
+ }
294
+ return __assign(__assign({}, margins.current), { top: margins.current.top + _domainMargin.current, bottom: margins.current.bottom + _domainMargin.current });
295
+ }, [props.barHeight, _points]);
296
+ var _getOrderedYAxisLabels = function () {
297
+ return sortAxisCategories(_mapCategoryToValues(), yAxisCategoryOrder);
298
+ };
299
+ var _mapCategoryToValues = function () {
300
+ var categoryToValues = {};
301
+ _points.forEach(function (point) {
302
+ if (!categoryToValues[point.y]) {
303
+ categoryToValues[point.y] = [];
304
+ }
305
+ // FIXME
306
+ // categoryToValues[point.y].push(point.x.end - point.x.start);
307
+ });
308
+ return categoryToValues;
309
+ };
310
+ var _renderBars = React.useCallback(function () {
311
+ return React.createElement("g", null, _bars.current);
312
+ }, []);
313
+ if (!_isChartEmpty()) {
314
+ _adjustProps();
315
+ var yAxisLabels = _getOrderedYAxisLabels();
316
+ var legendBars = _getLegendData();
317
+ var calloutProps = __assign({ isCalloutVisible: isCalloutVisible, directionalHint: DirectionalHint.topAutoEdge, id: "toolTip".concat(_calloutId.current), target: calloutTarget, isBeakVisible: false, gapSpace: 15, color: calloutColor, legend: calloutLegend, XValue: xCalloutValue, YValue: yCalloutValue, onDismiss: _closeCallout, preventDismissOnLostFocus: true }, props.calloutProps);
318
+ var tickParams = {
319
+ tickValues: props.tickValues,
320
+ tickFormat: props.tickFormat,
321
+ };
322
+ return (React.createElement(CartesianChart, __assign({}, props, { yAxisPadding: _yAxisPadding.current, chartTitle: _getChartTitle(), points: _points, chartType: ChartTypes.GanttChart, xAxisType: _xAxisType.current, yAxisType: _yAxisType.current, stringDatasetForYAxisDomain: yAxisLabels, calloutProps: calloutProps, tickParams: tickParams, legendBars: legendBars, createYAxis: createYAxisForHorizontalBarChartWithAxis, getDomainNRangeValues: _getDomainNRangeValues, createStringYAxis: createStringYAxisForHorizontalBarChartWithAxis, getMinMaxOfYAxis: findHBCWANumericMinMaxOfY, focusZoneDirection: FocusZoneDirection.vertical, customizedCallout: _getCustomizedCallout(), getmargins: _getMargins, getYDomainMargins: _getYDomainMargins, getGraphData: _getGraphData, onChartMouseLeave: _handleChartMouseLeave, ref: _cartesianChartRef, useUTC: useUTC, children: _renderBars })));
323
+ }
324
+ else {
325
+ return (React.createElement("div", { id: _emptyChartId.current, role: 'alert', style: { opacity: '0' }, "aria-label": 'Graph has no data to display' }));
326
+ }
327
+ });
328
+ GanttChartBase.displayName = 'GanttChart';
329
+ //# sourceMappingURL=GanttChart.base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GanttChart.base.js","sourceRoot":"../src/","sources":["components/GanttChart/GanttChart.base.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,IAAI,KAAK,EAAE,GAAG,IAAI,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAA6B,OAAO,EAAE,MAAM,k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OAAO,CACL,oBAAC,cAAc,eACT,KAAK,IACT,YAAY,EAAE,aAAa,CAAC,OAAO,EACnC,UAAU,EAAE,cAAc,EAAE,EAC5B,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,UAAU,CAAC,UAAU,EAChC,SAAS,EAAE,UAAU,CAAC,OAAO,EAC7B,SAAS,EAAE,UAAU,CAAC,OAAO,EAC7B,2BAA2B,EAAE,WAAW,EACxC,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,wCAAwC,EACrD,qBAAqB,EAAE,sBAAsB,EAC7C,iBAAiB,EAAE,8CAA8C,EACjE,gBAAgB,EAAE,yBAAyB,EAC3C,kBAAkB,EAAE,kBAAkB,CAAC,QAAQ,EAC/C,iBAAiB,EAAE,qBAAqB,EAAE,EAC1C,UAAU,EAAE,WAAW,EACvB,iBAAiB,EAAE,kBAAkB,EACrC,YAAY,EAAE,aAAa,EAC3B,iBAAiB,EAAE,sBAAsB,EACzC,GAAG,EAAE,kBAAkB,EACvB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,WAAW,IACrB,CACH,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,CACL,6BACE,EAAE,EAAE,aAAa,CAAC,OAAO,EACzB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,gBACX,8BAA8B,GAC1C,CACH,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import * as React from 'react';\nimport { max as d3Max, min as d3Min } from 'd3-array';\nimport { ScaleLinear, ScaleBand, ScaleTime } from 'd3-scale';\nimport { DirectionalHint, FocusZoneDirection, getId, getRTL } from '@fluentui/react';\nimport { ILegend, ILegendContainer, Legends } from '../Legends/index';\nimport { IMargins, IChart, IImageExportOptions, IGanttChartDataPoint } from '../../types/IDataPoint';\nimport { CartesianChart } from '../CommonComponents/index';\nimport { IGanttChartProps } from './GanttChart.types';\nimport {\n ChartHoverCard,\n ChartTypes,\n YAxisType,\n XAxisTypes,\n getTypeOfAxis,\n getNextColor,\n findHBCWANumericMinMaxOfY,\n createYAxisForHorizontalBarChartWithAxis,\n IDomainNRange,\n createStringYAxisForHorizontalBarChartWithAxis,\n getNextGradient,\n areArraysEqual,\n MIN_DOMAIN_MARGIN,\n sortAxisCategories,\n calculateAppropriateBarWidth,\n getColorFromToken,\n getScalePadding,\n getDateFormatLevel,\n} from '../../utilities/index';\nimport { toImage } from '../../utilities/image-export-utils';\nimport { formatDateToLocaleString, getMultiLevelDateTimeFormatOptions } from '@fluentui/chart-utilities';\n\ntype NumberScale = ScaleLinear<number, number>;\ntype StringScale = ScaleBand<string>;\ntype DateScale = ScaleTime<Date, number>;\n\nexport const GanttChartBase: React.FunctionComponent<IGanttChartProps> = React.forwardRef<\n HTMLDivElement,\n IGanttChartProps\n>(({ useUTC = true, yAxisCategoryOrder = 'default', ...props }, forwardedRef) => {\n const _barHeight = React.useRef<number>(0);\n const _calloutId = React.useRef<string>(getId('callout'));\n const margins = React.useRef<IMargins>({});\n const _bars = React.useRef<React.JSX.Element[]>([]);\n const _xAxisType = React.useRef<XAxisTypes>(XAxisTypes.DateAxis);\n const _yAxisType = React.useRef<YAxisType>(YAxisType.StringAxis);\n const _calloutAnchorPoint = React.useRef<IGanttChartDataPoint | null>(null);\n const _cartesianChartRef = React.useRef<IChart>(null);\n const _legendsRef = React.useRef<ILegendContainer>(null);\n const _domainMargin = React.useRef<number>(MIN_DOMAIN_MARGIN);\n const _yAxisPadding = React.useRef<number>(0);\n const _emptyChartId = React.useRef<string>(getId('Gantt_empty'));\n const _legendColorMap = React.useRef<Record<string, [string, string]>>({});\n const _gradientId = React.useRef<string>(getId('Gantt_gradient'));\n const prevProps = React.useRef<Partial<IGanttChartProps>>({});\n\n const [calloutColor, setCalloutColor] = React.useState<string>('');\n const [isCalloutVisible, setCalloutVisible] = React.useState<boolean>(false);\n const [hoveredLegend, setHoveredLegend] = React.useState<string>('');\n const [calloutTarget, setCalloutTarget] = React.useState<SVGElement | null>(null);\n const [calloutLegend, setCalloutLegend] = React.useState<string>('');\n const [xCalloutValue, setXCalloutValue] = React.useState<string>('');\n const [yCalloutValue, setYCalloutValue] = React.useState<string>('');\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>(props.legendProps?.selectedLegends || []);\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<IGanttChartDataPoint>();\n\n React.useEffect(() => {\n if (!areArraysEqual(prevProps.current.legendProps?.selectedLegends, props.legendProps?.selectedLegends)) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n prevProps.current = props;\n }, [props]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: _cartesianChartRef.current?.chartContainer ?? null,\n toImage: (opts?: IImageExportOptions): Promise<string> => {\n return toImage(_cartesianChartRef.current?.chartContainer, _legendsRef.current?.toSVG, getRTL(), opts);\n },\n }),\n [],\n );\n\n const _points = React.useMemo(() => {\n _legendColorMap.current = {};\n let colorIndex = 0;\n\n return (\n props.data?.map(point => {\n const legend = `${point.legend}`;\n if (!_legendColorMap.current[legend]) {\n let startColor = point.color\n ? getColorFromToken(point.color, props.theme?.isInverted)\n : getNextColor(colorIndex, 0, props.theme?.isInverted);\n let endColor = startColor;\n\n if (props.enableGradient) {\n const nextGradient = getNextGradient(colorIndex, 0, props.theme?.isInverted);\n startColor = point.gradient?.[0] || nextGradient[0];\n endColor = point.gradient?.[1] || nextGradient[1];\n }\n\n _legendColorMap.current[legend] = [startColor, endColor];\n colorIndex += 1;\n }\n\n return {\n ...point,\n color: _legendColorMap.current[legend][0],\n ...(props.enableGradient ? { gradient: _legendColorMap.current[legend] } : {}),\n };\n }) ?? []\n );\n }, [props.data, props.theme?.isInverted, props.enableGradient]);\n\n const _dateFormatOptions = React.useMemo(() => {\n if (_xAxisType.current !== XAxisTypes.DateAxis) {\n return undefined;\n }\n\n let lowestFormatLevel = 100;\n let highestFormatLevel = -1;\n _points.forEach(p => {\n const startFormatLevel = getDateFormatLevel(p.x.start as Date, useUTC);\n const endFormatLevel = getDateFormatLevel(p.x.end as Date, useUTC);\n lowestFormatLevel = Math.min(lowestFormatLevel, startFormatLevel, endFormatLevel);\n highestFormatLevel = Math.max(highestFormatLevel, startFormatLevel, endFormatLevel);\n });\n\n return getMultiLevelDateTimeFormatOptions(lowestFormatLevel, highestFormatLevel);\n }, [useUTC, _points]);\n\n const _getDomainNRangeValues = React.useCallback(\n (\n points: IGanttChartDataPoint[],\n _margins: IMargins,\n containerWidth: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n shiftX: number,\n ): IDomainNRange => {\n const xValues: (Date | number)[] = [];\n points.forEach(point => {\n xValues.push(point.x.start, point.x.end);\n });\n\n const xMin = d3Min(xValues) || 0;\n const xMax = d3Max(xValues) || 0;\n\n return {\n dStartValue: isRTL ? xMax : xMin,\n dEndValue: isRTL ? xMin : xMax,\n rStartValue: _margins.left! + (isRTL ? 0 : shiftX),\n rEndValue: containerWidth - _margins.right! - (isRTL ? shiftX : 0),\n };\n },\n [],\n );\n\n const _adjustProps = (): void => {\n _barHeight.current = Math.max(props.barHeight || 24, 1);\n\n if (props.data && props.data.length > 0) {\n _xAxisType.current = getTypeOfAxis(props.data[0].x.start, true) as XAxisTypes;\n _yAxisType.current = getTypeOfAxis(props.data[0].y, false) as YAxisType;\n }\n\n _yAxisPadding.current = getScalePadding(props.yAxisPadding, undefined, 1 / 2);\n };\n\n const _getMargins = React.useCallback((_margins: IMargins) => {\n margins.current = _margins;\n }, []);\n\n const _renderContentForOnlyBars = (point: IGanttChartDataPoint): React.JSX.Element => {\n return (\n <ChartHoverCard\n XValue={point.yAxisCalloutData || point.y.toString()}\n Legend={point.legend}\n YValue={point.xAxisCalloutData || _getFormattedXValue(point)}\n color={point.color}\n culture={props.culture}\n />\n );\n };\n\n const _renderCallout = (point?: IGanttChartDataPoint): React.JSX.Element | null => {\n return point ? _renderContentForOnlyBars(point) : null;\n };\n\n const _getCustomizedCallout = () => {\n return props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps, _renderCallout)\n : null;\n };\n\n const _getFormattedXValue = React.useCallback(\n (point: IGanttChartDataPoint): string => {\n let formattedStartX: string;\n let formattedEndX: string;\n\n if (_xAxisType.current === XAxisTypes.DateAxis) {\n formattedStartX = formatDateToLocaleString(\n point.x.start as Date,\n props.culture,\n useUTC,\n false,\n _dateFormatOptions,\n );\n formattedEndX = formatDateToLocaleString(point.x.end as Date, props.culture, useUTC, false, _dateFormatOptions);\n } else {\n formattedStartX = point.x.start.toString();\n formattedEndX = point.x.end.toString();\n }\n\n return `${formattedStartX} - ${formattedEndX}`;\n },\n [props.culture, useUTC, _dateFormatOptions],\n );\n\n const _getAriaLabel = React.useCallback(\n (point: IGanttChartDataPoint): string => {\n const xValue = point.xAxisCalloutData || _getFormattedXValue(point);\n const yValue = point.yAxisCalloutData || point.y;\n return point.callOutAccessibilityData?.ariaLabel || `${yValue}. ` + `${xValue}.`;\n },\n [_getFormattedXValue],\n );\n\n const _getHighlightedLegend = React.useCallback(() => {\n return selectedLegends.length > 0 ? selectedLegends : hoveredLegend ? [hoveredLegend] : [];\n }, [hoveredLegend, selectedLegends]);\n\n /**\n * This function checks if the given legend is highlighted or not.\n * A legend can be highlighted in 2 ways:\n * 1. selection: if the user clicks on it\n * 2. hovering: if there is no selected legend and the user hovers over it\n */\n const _legendHighlighted = React.useCallback(\n (legend: string | undefined) => {\n return _getHighlightedLegend().includes(`${legend}`);\n },\n [_getHighlightedLegend],\n );\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n const _noLegendHighlighted = React.useCallback(() => {\n return _getHighlightedLegend().length === 0;\n }, [_getHighlightedLegend]);\n\n const _showCallout = React.useCallback(\n (target: SVGElement, point: IGanttChartDataPoint) => {\n if (!(_noLegendHighlighted() || _legendHighlighted(point.legend)) || _calloutAnchorPoint.current === point) {\n return;\n }\n\n _calloutAnchorPoint.current = point;\n setCalloutTarget(target);\n setCalloutVisible(true);\n setCalloutLegend(point.legend!);\n setCalloutColor(point.color!);\n setXCalloutValue(point.yAxisCalloutData || point.y.toString());\n setYCalloutValue(point.xAxisCalloutData! || _getFormattedXValue(point));\n setDataPointCalloutProps(point);\n },\n [_getFormattedXValue, _legendHighlighted, _noLegendHighlighted],\n );\n\n const _onBarFocus = React.useCallback(\n (point: IGanttChartDataPoint, focusEvent: React.FocusEvent<SVGElement>): void => {\n _showCallout(focusEvent.currentTarget, point);\n },\n [_showCallout],\n );\n\n const _onBarHover = React.useCallback(\n (point: IGanttChartDataPoint, mouseEvent: React.MouseEvent<SVGElement>): void => {\n _showCallout(mouseEvent.currentTarget, point);\n },\n [_showCallout],\n );\n\n const _createBars = React.useCallback(\n (xScale: DateScale | NumberScale, yScale: NumberScale | StringScale): React.JSX.Element[] => {\n const bars = _points.map((point: IGanttChartDataPoint, index: number) => {\n const shouldHighlight = _noLegendHighlighted() || _legendHighlighted(point.legend);\n\n let startColor = point.color!;\n let endColor = startColor;\n if (props.enableGradient) {\n startColor = point.gradient![0];\n endColor = point.gradient![1];\n }\n const gradientId = `${_gradientId.current}_${index}`;\n\n const startX = xScale(point.x.start);\n const endX = xScale(point.x.end);\n const y =\n (_yAxisType.current === YAxisType.StringAxis\n ? (yScale as StringScale)(point.y as string)! + (yScale as StringScale).bandwidth() / 2\n : (yScale as NumberScale)(point.y as number)) -\n _barHeight.current / 2;\n\n return (\n <React.Fragment key={index}>\n {props.enableGradient && (\n <defs>\n <linearGradient id={gradientId}>\n <stop offset=\"0\" stopColor={startColor} />\n <stop offset=\"100%\" stopColor={endColor} />\n </linearGradient>\n </defs>\n )}\n <rect\n x={Math.min(startX, endX)}\n y={y}\n width={Math.abs(endX - startX)}\n height={_barHeight.current}\n rx={props.roundCorners ? 3 : 0}\n fill={props.enableGradient ? `url(#${gradientId})` : startColor}\n opacity={shouldHighlight ? 1 : 0.1}\n onClick={point.onClick}\n onMouseOver={event => _onBarHover(point, event)}\n onMouseLeave={_onBarLeave}\n onFocus={event => _onBarFocus(point, event)}\n onBlur={_onBarLeave}\n data-is-focusable={shouldHighlight}\n role=\"img\"\n aria-label={_getAriaLabel(point)}\n />\n </React.Fragment>\n );\n });\n return bars;\n },\n [\n _getAriaLabel,\n _legendHighlighted,\n _noLegendHighlighted,\n _onBarFocus,\n _onBarHover,\n props.enableGradient,\n props.roundCorners,\n _points,\n ],\n );\n\n const _getGraphData = React.useCallback(\n (\n xScale: DateScale | NumberScale,\n yScale: NumberScale | StringScale,\n containerHeight: number,\n containerWidth: number,\n xAxisElement: SVGElement | null,\n yAxisElement: SVGElement | null,\n ) => {\n return (_bars.current = _createBars(xScale, yScale));\n },\n [_createBars],\n );\n\n const _onBarLeave = (): void => {\n // do nothing\n };\n\n const _handleChartMouseLeave = React.useCallback((): void => {\n _calloutAnchorPoint.current = null;\n setCalloutTarget(null);\n setCalloutVisible(false);\n setCalloutLegend('');\n setCalloutColor('');\n setXCalloutValue('');\n setYCalloutValue('');\n setDataPointCalloutProps(undefined);\n }, []);\n\n const _closeCallout = () => {\n setCalloutVisible(false);\n };\n\n const _onLegendHover = (legend: string): void => {\n setHoveredLegend(legend);\n };\n\n const _onLegendLeave = (): void => {\n setHoveredLegend('');\n };\n\n const _getLegendData = (): React.JSX.Element => {\n const actions: ILegend[] = [];\n\n Object.keys(_legendColorMap.current).forEach((legendTitle: string) => {\n const legend: ILegend = {\n title: legendTitle,\n color: _legendColorMap.current[legendTitle][0],\n hoverAction: () => {\n _handleChartMouseLeave();\n _onLegendHover(legendTitle);\n },\n onMouseOutAction: () => {\n _onLegendLeave();\n },\n };\n\n actions.push(legend);\n });\n\n const legends = (\n <Legends\n legends={actions}\n enabledWrapLines={props.enabledLegendsWrapLines}\n overflowProps={props.legendsOverflowProps}\n focusZonePropsInHoverCard={props.focusZonePropsForLegendsInHoverCard}\n overflowText={props.legendsOverflowText}\n onChange={_onLegendSelectionChange}\n ref={_legendsRef}\n {...props.legendProps}\n />\n );\n return legends;\n };\n\n const _onLegendSelectionChange = (\n _selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: ILegend,\n ): void => {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(_selectedLegends);\n } else {\n setSelectedLegends(_selectedLegends.slice(-1));\n }\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(_selectedLegends, event, currentLegend);\n }\n };\n\n const _getChartTitle = (): string => {\n const { chartTitle } = props;\n return (chartTitle ? `${chartTitle}. ` : '') + `Gantt chart with ${_points.length} bars. `;\n };\n\n const _isChartEmpty = (): boolean => {\n return !(props.data && props.data.length > 0);\n };\n\n const _getYDomainMargins = React.useCallback(\n (containerHeight: number): IMargins => {\n _domainMargin.current = MIN_DOMAIN_MARGIN;\n\n const ySet = new Set<string | number>();\n _points.forEach((point: IGanttChartDataPoint) => {\n ySet.add(point.y);\n });\n const uniqueY = Array.from(ySet);\n\n /** Total height available to render the bars */\n const totalHeight =\n containerHeight - (margins.current.top! + MIN_DOMAIN_MARGIN) - (margins.current.bottom! + MIN_DOMAIN_MARGIN);\n\n if (_yAxisType.current !== YAxisType.StringAxis) {\n _barHeight.current = Math.max(\n props.barHeight ||\n calculateAppropriateBarWidth(uniqueY as number[] | Date[], totalHeight, _yAxisPadding.current),\n 1,\n );\n _domainMargin.current += _barHeight.current / 2;\n }\n\n return {\n ...margins.current,\n top: margins.current.top! + _domainMargin.current,\n bottom: margins.current.bottom! + _domainMargin.current,\n };\n },\n [props.barHeight, _points],\n );\n\n const _getOrderedYAxisLabels = () => {\n return sortAxisCategories(_mapCategoryToValues(), yAxisCategoryOrder);\n };\n\n const _mapCategoryToValues = () => {\n const categoryToValues: Record<string, number[]> = {};\n _points.forEach(point => {\n if (!categoryToValues[point.y]) {\n categoryToValues[point.y] = [];\n }\n // FIXME\n // categoryToValues[point.y].push(point.x.end - point.x.start);\n });\n return categoryToValues;\n };\n\n const _renderBars = React.useCallback(() => {\n return <g>{_bars.current}</g>;\n }, []);\n\n if (!_isChartEmpty()) {\n _adjustProps();\n\n const yAxisLabels = _getOrderedYAxisLabels();\n const legendBars: React.JSX.Element = _getLegendData();\n const calloutProps = {\n isCalloutVisible,\n directionalHint: DirectionalHint.topAutoEdge,\n id: `toolTip${_calloutId.current}`,\n target: calloutTarget,\n isBeakVisible: false,\n gapSpace: 15,\n color: calloutColor,\n legend: calloutLegend,\n XValue: xCalloutValue,\n YValue: yCalloutValue,\n onDismiss: _closeCallout,\n preventDismissOnLostFocus: true,\n ...props.calloutProps,\n };\n const tickParams = {\n tickValues: props.tickValues,\n tickFormat: props.tickFormat,\n };\n\n return (\n <CartesianChart\n {...props}\n yAxisPadding={_yAxisPadding.current}\n chartTitle={_getChartTitle()}\n points={_points}\n chartType={ChartTypes.GanttChart}\n xAxisType={_xAxisType.current}\n yAxisType={_yAxisType.current}\n stringDatasetForYAxisDomain={yAxisLabels}\n calloutProps={calloutProps}\n tickParams={tickParams}\n legendBars={legendBars}\n createYAxis={createYAxisForHorizontalBarChartWithAxis}\n getDomainNRangeValues={_getDomainNRangeValues}\n createStringYAxis={createStringYAxisForHorizontalBarChartWithAxis}\n getMinMaxOfYAxis={findHBCWANumericMinMaxOfY}\n focusZoneDirection={FocusZoneDirection.vertical}\n customizedCallout={_getCustomizedCallout()}\n getmargins={_getMargins}\n getYDomainMargins={_getYDomainMargins}\n getGraphData={_getGraphData}\n onChartMouseLeave={_handleChartMouseLeave}\n ref={_cartesianChartRef}\n useUTC={useUTC}\n children={_renderBars}\n />\n );\n } else {\n return (\n <div\n id={_emptyChartId.current}\n role={'alert'}\n style={{ opacity: '0' }}\n aria-label={'Graph has no data to display'}\n />\n );\n }\n});\n\nGanttChartBase.displayName = 'GanttChart';\n"]}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { IGanttChartProps } from '../../index';
3
+ /**
4
+ * GanttChart component.
5
+ * {@docCategory GanttChart}
6
+ */
7
+ export declare const GanttChart: React.FunctionComponent<IGanttChartProps>;
@@ -0,0 +1,10 @@
1
+ import { styled } from '@fluentui/react/lib/Utilities';
2
+ import { GanttChartBase } from './GanttChart.base';
3
+ import { getStyles } from './GanttChart.styles';
4
+ // Create a GanttChart variant which uses these default styles and this styled subcomponent.
5
+ /**
6
+ * GanttChart component.
7
+ * {@docCategory GanttChart}
8
+ */
9
+ export var GanttChart = styled(GanttChartBase, getStyles);
10
+ //# sourceMappingURL=GanttChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GanttChart.js","sourceRoot":"../src/","sources":["components/GanttChart/GanttChart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,4FAA4F;AAC5F;;;GAGG;AACH,MAAM,CAAC,IAAM,UAAU,GAA8C,MAAM,CAIzE,cAAc,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { styled } from '@fluentui/react/lib/Utilities';\nimport { IGanttChartProps, IGanttChartStyleProps, IGanttChartStyles } from '../../index';\nimport { GanttChartBase } from './GanttChart.base';\nimport { getStyles } from './GanttChart.styles';\n\n// Create a GanttChart variant which uses these default styles and this styled subcomponent.\n/**\n * GanttChart component.\n * {@docCategory GanttChart}\n */\nexport const GanttChart: React.FunctionComponent<IGanttChartProps> = styled<\n IGanttChartProps,\n IGanttChartStyleProps,\n IGanttChartStyles\n>(GanttChartBase, getStyles);\n"]}
@@ -0,0 +1,2 @@
1
+ import { IGanttChartStyleProps, IGanttChartStyles } from '../../index';
2
+ export declare const getStyles: (props: IGanttChartStyleProps) => IGanttChartStyles;
@@ -0,0 +1,4 @@
1
+ export var getStyles = function (props) {
2
+ return {};
3
+ };
4
+ //# sourceMappingURL=GanttChart.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GanttChart.styles.js","sourceRoot":"../src/","sources":["components/GanttChart/GanttChart.styles.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,IAAM,SAAS,GAAG,UAAC,KAA4B;IACpD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC","sourcesContent":["import { IGanttChartStyleProps, IGanttChartStyles } from '../../index';\n\nexport const getStyles = (props: IGanttChartStyleProps): IGanttChartStyles => {\n return {};\n};\n"]}
@@ -0,0 +1,67 @@
1
+ import { IRenderFunction, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';
2
+ import { ICartesianChartProps, ICartesianChartStyleProps, ICartesianChartStyles, IGanttChartDataPoint } from '../../index';
3
+ /**
4
+ * Gantt Chart properties
5
+ * {@docCategory GanttChart}
6
+ */
7
+ export interface IGanttChartProps extends ICartesianChartProps {
8
+ /**
9
+ * Data to render in the chart.
10
+ */
11
+ data?: IGanttChartDataPoint[];
12
+ /**
13
+ * Define a custom callout renderer for a data point.
14
+ */
15
+ onRenderCalloutPerDataPoint?: IRenderFunction<IGanttChartDataPoint>;
16
+ /**
17
+ * Width of each bar in the chart.
18
+ */
19
+ barHeight?: number;
20
+ /**
21
+ * chart title for the chart
22
+ */
23
+ chartTitle?: string;
24
+ /**
25
+ * Call to provide customized styling that will layer on top of the variant rules.
26
+ */
27
+ styles?: IStyleFunctionOrObject<IGanttChartStyleProps, IGanttChartStyles>;
28
+ /**
29
+ * The prop used to define the culture to localized the numbers
30
+ */
31
+ culture?: string;
32
+ /**
33
+ * it's padding between bar's or lines in the graph
34
+ */
35
+ yAxisPadding?: number;
36
+ /**
37
+ *@default false
38
+ *Used for to elipse y axis labes and show tooltip on x axis labels
39
+ */
40
+ showYAxisLablesTooltip?: boolean;
41
+ /**
42
+ *@default false
43
+ *Used for showing complete y axis lables */
44
+ showYAxisLables?: boolean;
45
+ /**
46
+ * @default false
47
+ * The prop used to enable gradient fill color for the chart.
48
+ */
49
+ enableGradient?: boolean;
50
+ /**
51
+ * @default false
52
+ * The prop used to enable rounded corners for the bars.
53
+ */
54
+ roundCorners?: boolean;
55
+ }
56
+ /**
57
+ * Gantt Chart style properties
58
+ * {@docCategory GanttChart}
59
+ */
60
+ export interface IGanttChartStyleProps extends ICartesianChartStyleProps {
61
+ }
62
+ /**
63
+ * Gantt Chart styles
64
+ * {@docCategory GanttChart}
65
+ */
66
+ export interface IGanttChartStyles extends ICartesianChartStyles {
67
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GanttChart.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GanttChart.types.js","sourceRoot":"../src/","sources":["components/GanttChart/GanttChart.types.ts"],"names":[],"mappings":"","sourcesContent":["import { IRenderFunction, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport {\n ICartesianChartProps,\n ICartesianChartStyleProps,\n ICartesianChartStyles,\n IGanttChartDataPoint,\n} from '../../index';\n\n/**\n * Gantt Chart properties\n * {@docCategory GanttChart}\n */\nexport interface IGanttChartProps extends ICartesianChartProps {\n /**\n * Data to render in the chart.\n */\n data?: IGanttChartDataPoint[];\n\n /**\n * Define a custom callout renderer for a data point.\n */\n onRenderCalloutPerDataPoint?: IRenderFunction<IGanttChartDataPoint>;\n\n /**\n * Width of each bar in the chart.\n */\n barHeight?: number;\n\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<IGanttChartStyleProps, IGanttChartStyles>;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * it's padding between bar's or lines in the graph\n */\n yAxisPadding?: number;\n\n /**\n *@default false\n *Used for to elipse y axis labes and show tooltip on x axis labels\n */\n showYAxisLablesTooltip?: boolean;\n\n /**\n *@default false\n *Used for showing complete y axis lables */\n showYAxisLables?: boolean;\n\n /**\n * @default false\n * The prop used to enable gradient fill color for the chart.\n */\n enableGradient?: boolean;\n\n /**\n * @default false\n * The prop used to enable rounded corners for the bars.\n */\n roundCorners?: boolean;\n}\n\n/**\n * Gantt Chart style properties\n * {@docCategory GanttChart}\n */\nexport interface IGanttChartStyleProps extends ICartesianChartStyleProps {}\n\n/**\n * Gantt Chart styles\n * {@docCategory GanttChart}\n */\nexport interface IGanttChartStyles extends ICartesianChartStyles {}\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './GanttChart';
2
+ export * from './GanttChart.types';
@@ -0,0 +1,3 @@
1
+ export * from './GanttChart';
2
+ export * from './GanttChart.types';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/GanttChart/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './GanttChart';\nexport * from './GanttChart.types';\n"]}
@@ -866,7 +866,7 @@ var LineChartBase = /** @class */ (function (_super) {
866
866
  // eslint-disable-next-line @typescript-eslint/no-deprecated
867
867
  LineChartBase.prototype._createLines = function (xElement, containerHeight) {
868
868
  var _this_1 = this;
869
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18;
869
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
870
870
  // eslint-disable-next-line @typescript-eslint/no-deprecated
871
871
  var lines = [];
872
872
  if (this.state.isSelectedLegend) {
@@ -899,7 +899,7 @@ var LineChartBase = /** @class */ (function (_super) {
899
899
  var yPadding = this_1._points[i].useSecondaryYScale && this_1._yScaleSecondary ? this_1._yPaddingSecondary : this_1._yPaddingPrimary;
900
900
  var extraMaxPixels = this_1._hasMarkersMode ? this_1._getRangeForScatterMarkerSize(yScale, yPadding) : 0;
901
901
  if (this_1._points[i].data.length === 1) {
902
- var _19 = this_1._points[i].data[0], x1_1 = _19.x, y1 = _19.y, xAxisCalloutData_1 = _19.xAxisCalloutData, xAxisCalloutAccessibilityData_1 = _19.xAxisCalloutAccessibilityData;
902
+ var _18 = this_1._points[i].data[0], x1_1 = _18.x, y1 = _18.y, xAxisCalloutData_1 = _18.xAxisCalloutData, xAxisCalloutAccessibilityData_1 = _18.xAxisCalloutAccessibilityData;
903
903
  var circleId_1 = "".concat(this_1._circleId, "_").concat(i);
904
904
  var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
905
905
  var currentMarkerSize = this_1._points[i].data[0].markerSize;
@@ -964,8 +964,8 @@ var LineChartBase = /** @class */ (function (_super) {
964
964
  var lineId = "".concat(this_1._lineId, "_").concat(i, "_").concat(j);
965
965
  var borderId = "".concat(this_1._borderId, "_").concat(i, "_").concat(j);
966
966
  var circleId = "".concat(this_1._circleId, "_").concat(i, "_").concat(j);
967
- var _20 = this_1._points[i].data[j - 1], x1 = _20.x, y1 = _20.y, xAxisCalloutData = _20.xAxisCalloutData, xAxisCalloutAccessibilityData = _20.xAxisCalloutAccessibilityData;
968
- var _21 = this_1._points[i].data[j], x2 = _21.x, y2 = _21.y;
967
+ var _19 = this_1._points[i].data[j - 1], x1 = _19.x, y1 = _19.y, xAxisCalloutData = _19.xAxisCalloutData, xAxisCalloutAccessibilityData = _19.xAxisCalloutAccessibilityData;
968
+ var _20 = this_1._points[i].data[j], x2 = _20.x, y2 = _20.y;
969
969
  var path = this_1._getPath(this_1._xAxisScale(x1), yScale(y1), circleId, j, false, this_1._points[i].index);
970
970
  var strokeWidth = ((_s = this_1._points[i].lineOptions) === null || _s === void 0 ? void 0 : _s.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
971
971
  var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
@@ -986,7 +986,7 @@ var LineChartBase = /** @class */ (function (_super) {
986
986
  var hiddenHoverCircleId = "".concat(circleId).concat(j, "D");
987
987
  var lastPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== lastCircleId_1;
988
988
  path = this_1._getPath(this_1._xAxisScale(x2), yScale(y2), lastCircleId_1, j, true, this_1._points[i].index);
989
- var _22 = this_1._points[i].data[j], lastCirlceXCallout_1 = _22.xAxisCalloutData, lastCirlceXCalloutAccessibilityData_1 = _22.xAxisCalloutAccessibilityData;
989
+ var _21 = this_1._points[i].data[j], lastCirlceXCallout_1 = _21.xAxisCalloutData, lastCirlceXCalloutAccessibilityData_1 = _21.xAxisCalloutAccessibilityData;
990
990
  currentMarkerSize = this_1._points[i].data[j].markerSize;
991
991
  var lastSupportsTextMode = (_z = (_y = this_1._points[i].lineOptions) === null || _y === void 0 ? void 0 : _y.mode) === null || _z === void 0 ? void 0 : _z.includes('text');
992
992
  var lastText = this_1._points[i].data[j].text;
@@ -1040,12 +1040,7 @@ var LineChartBase = /** @class */ (function (_super) {
1040
1040
  xAxisScale: this_1._xAxisScale,
1041
1041
  yAxisScale: yScale,
1042
1042
  className: classNames.markerLabel || '',
1043
- maybeLineOptions: ((_17 = this_1._points[i]) === null || _17 === void 0 ? void 0 : _17.lineOptions)
1044
- ? {
1045
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1046
- originXOffset: (_18 = this_1._points[i].lineOptions) === null || _18 === void 0 ? void 0 : _18.originXOffset,
1047
- }
1048
- : undefined,
1043
+ lineOptions: (_17 = this_1._points[i]) === null || _17 === void 0 ? void 0 : _17.lineOptions,
1049
1044
  }));
1050
1045
  }
1051
1046
  lines.push(React.createElement("g", { key: "line_".concat(i), role: "region", "aria-label": "".concat(legendVal, ", line ").concat(i + 1, " of ").concat(this_1._points.length, " with ").concat(this_1._points[i].data.length, " data points.") },