@fluentui/react-charting 5.24.12 → 5.24.13

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 (139) hide show
  1. package/CHANGELOG.json +34 -1
  2. package/CHANGELOG.md +14 -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 +62 -52
  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/ScatterChart/ScatterChart.base.js +8 -17
  39. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  40. package/lib/index.d.ts +3 -1
  41. package/lib/index.js +1 -0
  42. package/lib/index.js.map +1 -1
  43. package/lib/types/IDataPoint.d.ts +49 -0
  44. package/lib/types/IDataPoint.js.map +1 -1
  45. package/lib/utilities/test-data.d.ts +4 -1
  46. package/lib/utilities/test-data.js +213 -0
  47. package/lib/utilities/test-data.js.map +1 -1
  48. package/lib/utilities/utilities.d.ts +8 -6
  49. package/lib/utilities/utilities.js +9 -5
  50. package/lib/utilities/utilities.js.map +1 -1
  51. package/lib-amd/GanttChart.d.ts +1 -0
  52. package/lib-amd/GanttChart.js +6 -0
  53. package/lib-amd/GanttChart.js.map +1 -0
  54. package/lib-amd/components/CommonComponents/CartesianChart.base.js +2 -1
  55. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  56. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +3 -3
  57. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  58. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +10 -4
  59. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  60. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  61. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +25 -2
  62. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  63. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  64. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +63 -52
  65. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  66. package/lib-amd/components/GanttChart/GanttChart.base.d.ts +3 -0
  67. package/lib-amd/components/GanttChart/GanttChart.base.js +325 -0
  68. package/lib-amd/components/GanttChart/GanttChart.base.js.map +1 -0
  69. package/lib-amd/components/GanttChart/GanttChart.d.ts +7 -0
  70. package/lib-amd/components/GanttChart/GanttChart.js +12 -0
  71. package/lib-amd/components/GanttChart/GanttChart.js.map +1 -0
  72. package/lib-amd/components/GanttChart/GanttChart.styles.d.ts +2 -0
  73. package/lib-amd/components/GanttChart/GanttChart.styles.js +10 -0
  74. package/lib-amd/components/GanttChart/GanttChart.styles.js.map +1 -0
  75. package/lib-amd/components/GanttChart/GanttChart.types.d.ts +67 -0
  76. package/lib-amd/components/GanttChart/GanttChart.types.js +5 -0
  77. package/lib-amd/components/GanttChart/GanttChart.types.js.map +1 -0
  78. package/lib-amd/components/GanttChart/index.d.ts +2 -0
  79. package/lib-amd/components/GanttChart/index.js +7 -0
  80. package/lib-amd/components/GanttChart/index.js.map +1 -0
  81. package/lib-amd/components/ScatterChart/ScatterChart.base.js +8 -17
  82. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  83. package/lib-amd/index.d.ts +3 -1
  84. package/lib-amd/index.js +3 -2
  85. package/lib-amd/index.js.map +1 -1
  86. package/lib-amd/types/IDataPoint.d.ts +49 -0
  87. package/lib-amd/types/IDataPoint.js.map +1 -1
  88. package/lib-amd/utilities/test-data.d.ts +4 -1
  89. package/lib-amd/utilities/test-data.js +214 -2
  90. package/lib-amd/utilities/test-data.js.map +1 -1
  91. package/lib-amd/utilities/utilities.d.ts +8 -6
  92. package/lib-amd/utilities/utilities.js +10 -5
  93. package/lib-amd/utilities/utilities.js.map +1 -1
  94. package/lib-commonjs/GanttChart.d.ts +1 -0
  95. package/lib-commonjs/GanttChart.js +5 -0
  96. package/lib-commonjs/GanttChart.js.map +1 -0
  97. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +2 -1
  98. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  99. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +3 -3
  100. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  101. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +11 -4
  102. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  103. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  104. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +25 -1
  105. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  106. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  107. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +63 -52
  108. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  109. package/lib-commonjs/components/GanttChart/GanttChart.base.d.ts +3 -0
  110. package/lib-commonjs/components/GanttChart/GanttChart.base.js +332 -0
  111. package/lib-commonjs/components/GanttChart/GanttChart.base.js.map +1 -0
  112. package/lib-commonjs/components/GanttChart/GanttChart.d.ts +7 -0
  113. package/lib-commonjs/components/GanttChart/GanttChart.js +13 -0
  114. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -0
  115. package/lib-commonjs/components/GanttChart/GanttChart.styles.d.ts +2 -0
  116. package/lib-commonjs/components/GanttChart/GanttChart.styles.js +8 -0
  117. package/lib-commonjs/components/GanttChart/GanttChart.styles.js.map +1 -0
  118. package/lib-commonjs/components/GanttChart/GanttChart.types.d.ts +67 -0
  119. package/lib-commonjs/components/GanttChart/GanttChart.types.js +3 -0
  120. package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -0
  121. package/lib-commonjs/components/GanttChart/index.d.ts +2 -0
  122. package/lib-commonjs/components/GanttChart/index.js +6 -0
  123. package/lib-commonjs/components/GanttChart/index.js.map +1 -0
  124. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +8 -17
  125. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  126. package/lib-commonjs/index.d.ts +3 -1
  127. package/lib-commonjs/index.js +3 -1
  128. package/lib-commonjs/index.js.map +1 -1
  129. package/lib-commonjs/types/IDataPoint.d.ts +49 -0
  130. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  131. package/lib-commonjs/utilities/test-data.d.ts +4 -1
  132. package/lib-commonjs/utilities/test-data.js +214 -1
  133. package/lib-commonjs/utilities/test-data.js.map +1 -1
  134. package/lib-commonjs/utilities/utilities.d.ts +8 -6
  135. package/lib-commonjs/utilities/utilities.js +11 -6
  136. package/lib-commonjs/utilities/utilities.js.map +1 -1
  137. package/package.json +2 -2
  138. package/src/components/CommonComponents/CartesianChart.types.ts +5 -2
  139. 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,332 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GanttChartBase = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var React = require("react");
6
+ var d3_array_1 = require("d3-array");
7
+ var react_1 = require("@fluentui/react");
8
+ var index_1 = require("../Legends/index");
9
+ var index_2 = require("../CommonComponents/index");
10
+ var index_3 = require("../../utilities/index");
11
+ var image_export_utils_1 = require("../../utilities/image-export-utils");
12
+ var chart_utilities_1 = require("@fluentui/chart-utilities");
13
+ exports.GanttChartBase = React.forwardRef(function (_a, forwardedRef) {
14
+ var _b, _c;
15
+ var _d = _a.useUTC, useUTC = _d === void 0 ? true : _d, _e = _a.yAxisCategoryOrder, yAxisCategoryOrder = _e === void 0 ? 'default' : _e, props = tslib_1.__rest(_a, ["useUTC", "yAxisCategoryOrder"]);
16
+ var _barHeight = React.useRef(0);
17
+ var _calloutId = React.useRef((0, react_1.getId)('callout'));
18
+ var margins = React.useRef({});
19
+ var _bars = React.useRef([]);
20
+ var _xAxisType = React.useRef(index_3.XAxisTypes.DateAxis);
21
+ var _yAxisType = React.useRef(index_3.YAxisType.StringAxis);
22
+ var _calloutAnchorPoint = React.useRef(null);
23
+ var _cartesianChartRef = React.useRef(null);
24
+ var _legendsRef = React.useRef(null);
25
+ var _domainMargin = React.useRef(index_3.MIN_DOMAIN_MARGIN);
26
+ var _yAxisPadding = React.useRef(0);
27
+ var _emptyChartId = React.useRef((0, react_1.getId)('Gantt_empty'));
28
+ var _legendColorMap = React.useRef({});
29
+ var _gradientId = React.useRef((0, react_1.getId)('Gantt_gradient'));
30
+ var prevProps = React.useRef({});
31
+ var _f = React.useState(''), calloutColor = _f[0], setCalloutColor = _f[1];
32
+ var _g = React.useState(false), isCalloutVisible = _g[0], setCalloutVisible = _g[1];
33
+ var _h = React.useState(''), hoveredLegend = _h[0], setHoveredLegend = _h[1];
34
+ var _j = React.useState(null), calloutTarget = _j[0], setCalloutTarget = _j[1];
35
+ var _k = React.useState(''), calloutLegend = _k[0], setCalloutLegend = _k[1];
36
+ var _l = React.useState(''), xCalloutValue = _l[0], setXCalloutValue = _l[1];
37
+ var _m = React.useState(''), yCalloutValue = _m[0], setYCalloutValue = _m[1];
38
+ var _o = React.useState(((_b = props.legendProps) === null || _b === void 0 ? void 0 : _b.selectedLegends) || []), selectedLegends = _o[0], setSelectedLegends = _o[1];
39
+ var _p = React.useState(), dataPointCalloutProps = _p[0], setDataPointCalloutProps = _p[1];
40
+ React.useEffect(function () {
41
+ var _a, _b, _c;
42
+ if (!(0, index_3.areArraysEqual)((_a = prevProps.current.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegends, (_b = props.legendProps) === null || _b === void 0 ? void 0 : _b.selectedLegends)) {
43
+ setSelectedLegends(((_c = props.legendProps) === null || _c === void 0 ? void 0 : _c.selectedLegends) || []);
44
+ }
45
+ prevProps.current = props;
46
+ }, [props]);
47
+ React.useImperativeHandle(props.componentRef, function () {
48
+ var _a, _b;
49
+ return ({
50
+ chartContainer: (_b = (_a = _cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer) !== null && _b !== void 0 ? _b : null,
51
+ toImage: function (opts) {
52
+ var _a, _b;
53
+ return (0, image_export_utils_1.toImage)((_a = _cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer, (_b = _legendsRef.current) === null || _b === void 0 ? void 0 : _b.toSVG, (0, react_1.getRTL)(), opts);
54
+ },
55
+ });
56
+ }, []);
57
+ var _points = React.useMemo(function () {
58
+ var _a, _b;
59
+ _legendColorMap.current = {};
60
+ var colorIndex = 0;
61
+ return ((_b = (_a = props.data) === null || _a === void 0 ? void 0 : _a.map(function (point) {
62
+ var _a, _b, _c, _d, _e;
63
+ var legend = "".concat(point.legend);
64
+ if (!_legendColorMap.current[legend]) {
65
+ var startColor = point.color
66
+ ? (0, index_3.getColorFromToken)(point.color, (_a = props.theme) === null || _a === void 0 ? void 0 : _a.isInverted)
67
+ : (0, index_3.getNextColor)(colorIndex, 0, (_b = props.theme) === null || _b === void 0 ? void 0 : _b.isInverted);
68
+ var endColor = startColor;
69
+ if (props.enableGradient) {
70
+ var nextGradient = (0, index_3.getNextGradient)(colorIndex, 0, (_c = props.theme) === null || _c === void 0 ? void 0 : _c.isInverted);
71
+ startColor = ((_d = point.gradient) === null || _d === void 0 ? void 0 : _d[0]) || nextGradient[0];
72
+ endColor = ((_e = point.gradient) === null || _e === void 0 ? void 0 : _e[1]) || nextGradient[1];
73
+ }
74
+ _legendColorMap.current[legend] = [startColor, endColor];
75
+ colorIndex += 1;
76
+ }
77
+ return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, point), { color: _legendColorMap.current[legend][0] }), (props.enableGradient ? { gradient: _legendColorMap.current[legend] } : {}));
78
+ })) !== null && _b !== void 0 ? _b : []);
79
+ }, [props.data, (_c = props.theme) === null || _c === void 0 ? void 0 : _c.isInverted, props.enableGradient]);
80
+ var _dateFormatOptions = React.useMemo(function () {
81
+ if (_xAxisType.current !== index_3.XAxisTypes.DateAxis) {
82
+ return undefined;
83
+ }
84
+ var lowestFormatLevel = 100;
85
+ var highestFormatLevel = -1;
86
+ _points.forEach(function (p) {
87
+ var startFormatLevel = (0, index_3.getDateFormatLevel)(p.x.start, useUTC);
88
+ var endFormatLevel = (0, index_3.getDateFormatLevel)(p.x.end, useUTC);
89
+ lowestFormatLevel = Math.min(lowestFormatLevel, startFormatLevel, endFormatLevel);
90
+ highestFormatLevel = Math.max(highestFormatLevel, startFormatLevel, endFormatLevel);
91
+ });
92
+ return (0, chart_utilities_1.getMultiLevelDateTimeFormatOptions)(lowestFormatLevel, highestFormatLevel);
93
+ }, [useUTC, _points]);
94
+ var _getDomainNRangeValues = React.useCallback(function (points, _margins, containerWidth, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
95
+ var xValues = [];
96
+ points.forEach(function (point) {
97
+ xValues.push(point.x.start, point.x.end);
98
+ });
99
+ var xMin = (0, d3_array_1.min)(xValues) || 0;
100
+ var xMax = (0, d3_array_1.max)(xValues) || 0;
101
+ return {
102
+ dStartValue: isRTL ? xMax : xMin,
103
+ dEndValue: isRTL ? xMin : xMax,
104
+ rStartValue: _margins.left + (isRTL ? 0 : shiftX),
105
+ rEndValue: containerWidth - _margins.right - (isRTL ? shiftX : 0),
106
+ };
107
+ }, []);
108
+ var _adjustProps = function () {
109
+ _barHeight.current = Math.max(props.barHeight || 24, 1);
110
+ if (props.data && props.data.length > 0) {
111
+ _xAxisType.current = (0, index_3.getTypeOfAxis)(props.data[0].x.start, true);
112
+ _yAxisType.current = (0, index_3.getTypeOfAxis)(props.data[0].y, false);
113
+ }
114
+ _yAxisPadding.current = (0, index_3.getScalePadding)(props.yAxisPadding, undefined, 1 / 2);
115
+ };
116
+ var _getMargins = React.useCallback(function (_margins) {
117
+ margins.current = _margins;
118
+ }, []);
119
+ var _renderContentForOnlyBars = function (point) {
120
+ return (React.createElement(index_3.ChartHoverCard, { XValue: point.yAxisCalloutData || point.y.toString(), Legend: point.legend, YValue: point.xAxisCalloutData || _getFormattedXValue(point), color: point.color, culture: props.culture }));
121
+ };
122
+ var _renderCallout = function (point) {
123
+ return point ? _renderContentForOnlyBars(point) : null;
124
+ };
125
+ var _getCustomizedCallout = function () {
126
+ return props.onRenderCalloutPerDataPoint
127
+ ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps, _renderCallout)
128
+ : null;
129
+ };
130
+ var _getFormattedXValue = React.useCallback(function (point) {
131
+ var formattedStartX;
132
+ var formattedEndX;
133
+ if (_xAxisType.current === index_3.XAxisTypes.DateAxis) {
134
+ formattedStartX = (0, chart_utilities_1.formatDateToLocaleString)(point.x.start, props.culture, useUTC, false, _dateFormatOptions);
135
+ formattedEndX = (0, chart_utilities_1.formatDateToLocaleString)(point.x.end, props.culture, useUTC, false, _dateFormatOptions);
136
+ }
137
+ else {
138
+ formattedStartX = point.x.start.toString();
139
+ formattedEndX = point.x.end.toString();
140
+ }
141
+ return "".concat(formattedStartX, " - ").concat(formattedEndX);
142
+ }, [props.culture, useUTC, _dateFormatOptions]);
143
+ var _getAriaLabel = React.useCallback(function (point) {
144
+ var _a;
145
+ var xValue = point.xAxisCalloutData || _getFormattedXValue(point);
146
+ var yValue = point.yAxisCalloutData || point.y;
147
+ return ((_a = point.callOutAccessibilityData) === null || _a === void 0 ? void 0 : _a.ariaLabel) || "".concat(yValue, ". ") + "".concat(xValue, ".");
148
+ }, [_getFormattedXValue]);
149
+ var _getHighlightedLegend = React.useCallback(function () {
150
+ return selectedLegends.length > 0 ? selectedLegends : hoveredLegend ? [hoveredLegend] : [];
151
+ }, [hoveredLegend, selectedLegends]);
152
+ /**
153
+ * This function checks if the given legend is highlighted or not.
154
+ * A legend can be highlighted in 2 ways:
155
+ * 1. selection: if the user clicks on it
156
+ * 2. hovering: if there is no selected legend and the user hovers over it
157
+ */
158
+ var _legendHighlighted = React.useCallback(function (legend) {
159
+ return _getHighlightedLegend().includes("".concat(legend));
160
+ }, [_getHighlightedLegend]);
161
+ /**
162
+ * This function checks if none of the legends is selected or hovered.
163
+ */
164
+ var _noLegendHighlighted = React.useCallback(function () {
165
+ return _getHighlightedLegend().length === 0;
166
+ }, [_getHighlightedLegend]);
167
+ var _showCallout = React.useCallback(function (target, point) {
168
+ if (!(_noLegendHighlighted() || _legendHighlighted(point.legend)) || _calloutAnchorPoint.current === point) {
169
+ return;
170
+ }
171
+ _calloutAnchorPoint.current = point;
172
+ setCalloutTarget(target);
173
+ setCalloutVisible(true);
174
+ setCalloutLegend(point.legend);
175
+ setCalloutColor(point.color);
176
+ setXCalloutValue(point.yAxisCalloutData || point.y.toString());
177
+ setYCalloutValue(point.xAxisCalloutData || _getFormattedXValue(point));
178
+ setDataPointCalloutProps(point);
179
+ }, [_getFormattedXValue, _legendHighlighted, _noLegendHighlighted]);
180
+ var _onBarFocus = React.useCallback(function (point, focusEvent) {
181
+ _showCallout(focusEvent.currentTarget, point);
182
+ }, [_showCallout]);
183
+ var _onBarHover = React.useCallback(function (point, mouseEvent) {
184
+ _showCallout(mouseEvent.currentTarget, point);
185
+ }, [_showCallout]);
186
+ var _createBars = React.useCallback(function (xScale, yScale) {
187
+ var bars = _points.map(function (point, index) {
188
+ var shouldHighlight = _noLegendHighlighted() || _legendHighlighted(point.legend);
189
+ var startColor = point.color;
190
+ var endColor = startColor;
191
+ if (props.enableGradient) {
192
+ startColor = point.gradient[0];
193
+ endColor = point.gradient[1];
194
+ }
195
+ var gradientId = "".concat(_gradientId.current, "_").concat(index);
196
+ var startX = xScale(point.x.start);
197
+ var endX = xScale(point.x.end);
198
+ var y = (_yAxisType.current === index_3.YAxisType.StringAxis
199
+ ? yScale(point.y) + yScale.bandwidth() / 2
200
+ : yScale(point.y)) -
201
+ _barHeight.current / 2;
202
+ return (React.createElement(React.Fragment, { key: index },
203
+ props.enableGradient && (React.createElement("defs", null,
204
+ React.createElement("linearGradient", { id: gradientId },
205
+ React.createElement("stop", { offset: "0", stopColor: startColor }),
206
+ React.createElement("stop", { offset: "100%", stopColor: endColor })))),
207
+ 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) })));
208
+ });
209
+ return bars;
210
+ }, [
211
+ _getAriaLabel,
212
+ _legendHighlighted,
213
+ _noLegendHighlighted,
214
+ _onBarFocus,
215
+ _onBarHover,
216
+ props.enableGradient,
217
+ props.roundCorners,
218
+ _points,
219
+ ]);
220
+ var _getGraphData = React.useCallback(function (xScale, yScale, containerHeight, containerWidth, xAxisElement, yAxisElement) {
221
+ return (_bars.current = _createBars(xScale, yScale));
222
+ }, [_createBars]);
223
+ var _onBarLeave = function () {
224
+ // do nothing
225
+ };
226
+ var _handleChartMouseLeave = React.useCallback(function () {
227
+ _calloutAnchorPoint.current = null;
228
+ setCalloutTarget(null);
229
+ setCalloutVisible(false);
230
+ setCalloutLegend('');
231
+ setCalloutColor('');
232
+ setXCalloutValue('');
233
+ setYCalloutValue('');
234
+ setDataPointCalloutProps(undefined);
235
+ }, []);
236
+ var _closeCallout = function () {
237
+ setCalloutVisible(false);
238
+ };
239
+ var _onLegendHover = function (legend) {
240
+ setHoveredLegend(legend);
241
+ };
242
+ var _onLegendLeave = function () {
243
+ setHoveredLegend('');
244
+ };
245
+ var _getLegendData = function () {
246
+ var actions = [];
247
+ Object.keys(_legendColorMap.current).forEach(function (legendTitle) {
248
+ var legend = {
249
+ title: legendTitle,
250
+ color: _legendColorMap.current[legendTitle][0],
251
+ hoverAction: function () {
252
+ _handleChartMouseLeave();
253
+ _onLegendHover(legendTitle);
254
+ },
255
+ onMouseOutAction: function () {
256
+ _onLegendLeave();
257
+ },
258
+ };
259
+ actions.push(legend);
260
+ });
261
+ var legends = (React.createElement(index_1.Legends, tslib_1.__assign({ legends: actions, enabledWrapLines: props.enabledLegendsWrapLines, overflowProps: props.legendsOverflowProps, focusZonePropsInHoverCard: props.focusZonePropsForLegendsInHoverCard, overflowText: props.legendsOverflowText, onChange: _onLegendSelectionChange, ref: _legendsRef }, props.legendProps)));
262
+ return legends;
263
+ };
264
+ var _onLegendSelectionChange = function (_selectedLegends, event, currentLegend) {
265
+ var _a, _b;
266
+ if ((_a = props.legendProps) === null || _a === void 0 ? void 0 : _a.canSelectMultipleLegends) {
267
+ setSelectedLegends(_selectedLegends);
268
+ }
269
+ else {
270
+ setSelectedLegends(_selectedLegends.slice(-1));
271
+ }
272
+ if ((_b = props.legendProps) === null || _b === void 0 ? void 0 : _b.onChange) {
273
+ props.legendProps.onChange(_selectedLegends, event, currentLegend);
274
+ }
275
+ };
276
+ var _getChartTitle = function () {
277
+ var chartTitle = props.chartTitle;
278
+ return (chartTitle ? "".concat(chartTitle, ". ") : '') + "Gantt chart with ".concat(_points.length, " bars. ");
279
+ };
280
+ var _isChartEmpty = function () {
281
+ return !(props.data && props.data.length > 0);
282
+ };
283
+ var _getYDomainMargins = React.useCallback(function (containerHeight) {
284
+ _domainMargin.current = index_3.MIN_DOMAIN_MARGIN;
285
+ var ySet = new Set();
286
+ _points.forEach(function (point) {
287
+ ySet.add(point.y);
288
+ });
289
+ var uniqueY = Array.from(ySet);
290
+ /** Total height available to render the bars */
291
+ var totalHeight = containerHeight - (margins.current.top + index_3.MIN_DOMAIN_MARGIN) - (margins.current.bottom + index_3.MIN_DOMAIN_MARGIN);
292
+ if (_yAxisType.current !== index_3.YAxisType.StringAxis) {
293
+ _barHeight.current = Math.max(props.barHeight ||
294
+ (0, index_3.calculateAppropriateBarWidth)(uniqueY, totalHeight, _yAxisPadding.current), 1);
295
+ _domainMargin.current += _barHeight.current / 2;
296
+ }
297
+ return tslib_1.__assign(tslib_1.__assign({}, margins.current), { top: margins.current.top + _domainMargin.current, bottom: margins.current.bottom + _domainMargin.current });
298
+ }, [props.barHeight, _points]);
299
+ var _getOrderedYAxisLabels = function () {
300
+ return (0, index_3.sortAxisCategories)(_mapCategoryToValues(), yAxisCategoryOrder);
301
+ };
302
+ var _mapCategoryToValues = function () {
303
+ var categoryToValues = {};
304
+ _points.forEach(function (point) {
305
+ if (!categoryToValues[point.y]) {
306
+ categoryToValues[point.y] = [];
307
+ }
308
+ // FIXME
309
+ // categoryToValues[point.y].push(point.x.end - point.x.start);
310
+ });
311
+ return categoryToValues;
312
+ };
313
+ var _renderBars = React.useCallback(function () {
314
+ return React.createElement("g", null, _bars.current);
315
+ }, []);
316
+ if (!_isChartEmpty()) {
317
+ _adjustProps();
318
+ var yAxisLabels = _getOrderedYAxisLabels();
319
+ var legendBars = _getLegendData();
320
+ var calloutProps = tslib_1.__assign({ isCalloutVisible: isCalloutVisible, directionalHint: react_1.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);
321
+ var tickParams = {
322
+ tickValues: props.tickValues,
323
+ tickFormat: props.tickFormat,
324
+ };
325
+ return (React.createElement(index_2.CartesianChart, tslib_1.__assign({}, props, { yAxisPadding: _yAxisPadding.current, chartTitle: _getChartTitle(), points: _points, chartType: index_3.ChartTypes.GanttChart, xAxisType: _xAxisType.current, yAxisType: _yAxisType.current, stringDatasetForYAxisDomain: yAxisLabels, calloutProps: calloutProps, tickParams: tickParams, legendBars: legendBars, createYAxis: index_3.createYAxisForHorizontalBarChartWithAxis, getDomainNRangeValues: _getDomainNRangeValues, createStringYAxis: index_3.createStringYAxisForHorizontalBarChartWithAxis, getMinMaxOfYAxis: index_3.findHBCWANumericMinMaxOfY, focusZoneDirection: react_1.FocusZoneDirection.vertical, customizedCallout: _getCustomizedCallout(), getmargins: _getMargins, getYDomainMargins: _getYDomainMargins, getGraphData: _getGraphData, onChartMouseLeave: _handleChartMouseLeave, ref: _cartesianChartRef, useUTC: useUTC, children: _renderBars })));
326
+ }
327
+ else {
328
+ return (React.createElement("div", { id: _emptyChartId.current, role: 'alert', style: { opacity: '0' }, "aria-label": 'Graph has no data to display' }));
329
+ }
330
+ });
331
+ exports.GanttChartBase.displayName = 'GanttChart';
332
+ //# 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,6BAA+B;AAC/B,qCAAsD;AAEtD,yCAAqF;AACrF,0CAAsE;AAEtE,mDAA2D;AAE3D,+CAmB+B;AAC/B,yEAA6D;AAC7D,6DAAyG;AAM5F,QAAA,cAAc,GAA8C,KAAK,CAAC,UAAU,CAGvF,UAAC,EAA2D,EAAE,YAAY;;IAAvE,IAAA,cAAa,EAAb,MAAM,mBAAG,IAAI,KAAA,EAAE,0BAA8B,EAA9B,kBAAkB,mBAAG,SAAS,KAAA,EAAK,KAAK,sBAAzD,gCAA2D,CAAF;IAC1D,IAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAS,CAAC,CAAC,CAAC;IAC3C,IAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAS,IAAA,aAAK,EAAC,SAAS,CAAC,CAAC,CAAC;IAC1D,IAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAW,EAAE,CAAC,CAAC;IAC3C,IAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAsB,EAAE,CAAC,CAAC;IACpD,IAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAa,k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AAE,GAAG,EAAE,gBACX,8BAA8B,GAC1C,CACH,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,sBAAc,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,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GanttChart = void 0;
4
+ var Utilities_1 = require("@fluentui/react/lib/Utilities");
5
+ var GanttChart_base_1 = require("./GanttChart.base");
6
+ var GanttChart_styles_1 = require("./GanttChart.styles");
7
+ // Create a GanttChart variant which uses these default styles and this styled subcomponent.
8
+ /**
9
+ * GanttChart component.
10
+ * {@docCategory GanttChart}
11
+ */
12
+ exports.GanttChart = (0, Utilities_1.styled)(GanttChart_base_1.GanttChartBase, GanttChart_styles_1.getStyles);
13
+ //# sourceMappingURL=GanttChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GanttChart.js","sourceRoot":"../src/","sources":["components/GanttChart/GanttChart.tsx"],"names":[],"mappings":";;;AACA,2DAAuD;AAEvD,qDAAmD;AACnD,yDAAgD;AAEhD,4FAA4F;AAC5F;;;GAGG;AACU,QAAA,UAAU,GAA8C,IAAA,kBAAM,EAIzE,gCAAc,EAAE,6BAAS,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,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStyles = void 0;
4
+ var getStyles = function (props) {
5
+ return {};
6
+ };
7
+ exports.getStyles = getStyles;
8
+ //# 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":";;;AAEO,IAAM,SAAS,GAAG,UAAC,KAA4B;IACpD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB","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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# 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,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./GanttChart"), exports);
5
+ tslib_1.__exportStar(require("./GanttChart.types"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/GanttChart/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,6DAAmC","sourcesContent":["export * from './GanttChart';\nexport * from './GanttChart.types';\n"]}
@@ -300,26 +300,17 @@ exports.ScatterChartBase = React.forwardRef(function (props, forwardedRef) {
300
300
  if (_xAxisType === index_4.XAxisTypes.StringAxis) {
301
301
  _xBandwidth.current = ((_a = _xAxisScale.current) === null || _a === void 0 ? void 0 : _a.bandwidth()) / 2;
302
302
  }
303
- else if (_xAxisType === index_4.XAxisTypes.DateAxis) {
304
- xMin = (0, d3_array_1.min)(_points.current, function (point) {
305
- return (0, d3_array_1.min)(point.data, function (item) { return item.x; });
306
- }).getTime();
307
- xMax = (0, d3_array_1.max)(_points.current, function (point) {
308
- return (0, d3_array_1.max)(point.data, function (item) {
309
- return item.x;
310
- });
311
- }).getTime();
312
- xPadding = (xMax - xMin) * 0.1;
313
- }
314
303
  else {
315
- xMin = (0, d3_array_1.min)(_points.current, function (point) {
316
- return (0, d3_array_1.min)(point.data, function (item) { return item.x; });
304
+ var isDate_1 = _xAxisType === index_4.XAxisTypes.DateAxis;
305
+ var getX_1 = function (item) { return (isDate_1 ? item.x : item.x); };
306
+ var minVal = (0, d3_array_1.min)(_points.current, function (point) {
307
+ return (0, d3_array_1.min)(point.data, getX_1);
317
308
  });
318
- xMax = (0, d3_array_1.max)(_points.current, function (point) {
319
- return (0, d3_array_1.max)(point.data, function (item) {
320
- return item.x;
321
- });
309
+ var maxVal = (0, d3_array_1.max)(_points.current, function (point) {
310
+ return (0, d3_array_1.max)(point.data, getX_1);
322
311
  });
312
+ xMin = isDate_1 ? minVal.getTime() : minVal;
313
+ xMax = isDate_1 ? maxVal.getTime() : maxVal;
323
314
  xPadding = (xMax - xMin) * 0.1;
324
315
  }
325
316
  var maxMarkerSize = (0, d3_array_1.max)(_points.current, function (point) {