@fluentui/react-charting 5.24.11 → 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 (157) 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 +22 -4
  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 +173 -63
  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.d.ts +1 -0
  39. package/lib/components/LineChart/LineChart.base.js +34 -11
  40. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  41. package/lib/components/ScatterChart/ScatterChart.base.js +37 -23
  42. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  43. package/lib/index.d.ts +3 -1
  44. package/lib/index.js +1 -0
  45. package/lib/index.js.map +1 -1
  46. package/lib/types/IDataPoint.d.ts +49 -0
  47. package/lib/types/IDataPoint.js.map +1 -1
  48. package/lib/utilities/scatterpolar-utils.d.ts +22 -0
  49. package/lib/utilities/scatterpolar-utils.js +38 -0
  50. package/lib/utilities/scatterpolar-utils.js.map +1 -0
  51. package/lib/utilities/test-data.d.ts +4 -1
  52. package/lib/utilities/test-data.js +213 -0
  53. package/lib/utilities/test-data.js.map +1 -1
  54. package/lib/utilities/utilities.d.ts +14 -6
  55. package/lib/utilities/utilities.js +25 -9
  56. package/lib/utilities/utilities.js.map +1 -1
  57. package/lib-amd/GanttChart.d.ts +1 -0
  58. package/lib-amd/GanttChart.js +6 -0
  59. package/lib-amd/GanttChart.js.map +1 -0
  60. package/lib-amd/components/CommonComponents/CartesianChart.base.js +2 -1
  61. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  62. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +3 -3
  63. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  64. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +22 -5
  65. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  66. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  67. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +25 -2
  68. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  69. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  70. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +173 -62
  71. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  72. package/lib-amd/components/GanttChart/GanttChart.base.d.ts +3 -0
  73. package/lib-amd/components/GanttChart/GanttChart.base.js +325 -0
  74. package/lib-amd/components/GanttChart/GanttChart.base.js.map +1 -0
  75. package/lib-amd/components/GanttChart/GanttChart.d.ts +7 -0
  76. package/lib-amd/components/GanttChart/GanttChart.js +12 -0
  77. package/lib-amd/components/GanttChart/GanttChart.js.map +1 -0
  78. package/lib-amd/components/GanttChart/GanttChart.styles.d.ts +2 -0
  79. package/lib-amd/components/GanttChart/GanttChart.styles.js +10 -0
  80. package/lib-amd/components/GanttChart/GanttChart.styles.js.map +1 -0
  81. package/lib-amd/components/GanttChart/GanttChart.types.d.ts +67 -0
  82. package/lib-amd/components/GanttChart/GanttChart.types.js +5 -0
  83. package/lib-amd/components/GanttChart/GanttChart.types.js.map +1 -0
  84. package/lib-amd/components/GanttChart/index.d.ts +2 -0
  85. package/lib-amd/components/GanttChart/index.js +7 -0
  86. package/lib-amd/components/GanttChart/index.js.map +1 -0
  87. package/lib-amd/components/LineChart/LineChart.base.d.ts +1 -0
  88. package/lib-amd/components/LineChart/LineChart.base.js +33 -11
  89. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  90. package/lib-amd/components/ScatterChart/ScatterChart.base.js +36 -23
  91. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  92. package/lib-amd/index.d.ts +3 -1
  93. package/lib-amd/index.js +3 -2
  94. package/lib-amd/index.js.map +1 -1
  95. package/lib-amd/types/IDataPoint.d.ts +49 -0
  96. package/lib-amd/types/IDataPoint.js.map +1 -1
  97. package/lib-amd/utilities/scatterpolar-utils.d.ts +22 -0
  98. package/lib-amd/utilities/scatterpolar-utils.js +43 -0
  99. package/lib-amd/utilities/scatterpolar-utils.js.map +1 -0
  100. package/lib-amd/utilities/test-data.d.ts +4 -1
  101. package/lib-amd/utilities/test-data.js +214 -2
  102. package/lib-amd/utilities/test-data.js.map +1 -1
  103. package/lib-amd/utilities/utilities.d.ts +14 -6
  104. package/lib-amd/utilities/utilities.js +27 -9
  105. package/lib-amd/utilities/utilities.js.map +1 -1
  106. package/lib-commonjs/GanttChart.d.ts +1 -0
  107. package/lib-commonjs/GanttChart.js +5 -0
  108. package/lib-commonjs/GanttChart.js.map +1 -0
  109. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +2 -1
  110. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  111. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +3 -3
  112. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  113. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +23 -5
  114. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  115. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  116. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +25 -1
  117. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  118. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  119. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +173 -62
  120. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  121. package/lib-commonjs/components/GanttChart/GanttChart.base.d.ts +3 -0
  122. package/lib-commonjs/components/GanttChart/GanttChart.base.js +332 -0
  123. package/lib-commonjs/components/GanttChart/GanttChart.base.js.map +1 -0
  124. package/lib-commonjs/components/GanttChart/GanttChart.d.ts +7 -0
  125. package/lib-commonjs/components/GanttChart/GanttChart.js +13 -0
  126. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -0
  127. package/lib-commonjs/components/GanttChart/GanttChart.styles.d.ts +2 -0
  128. package/lib-commonjs/components/GanttChart/GanttChart.styles.js +8 -0
  129. package/lib-commonjs/components/GanttChart/GanttChart.styles.js.map +1 -0
  130. package/lib-commonjs/components/GanttChart/GanttChart.types.d.ts +67 -0
  131. package/lib-commonjs/components/GanttChart/GanttChart.types.js +3 -0
  132. package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -0
  133. package/lib-commonjs/components/GanttChart/index.d.ts +2 -0
  134. package/lib-commonjs/components/GanttChart/index.js +6 -0
  135. package/lib-commonjs/components/GanttChart/index.js.map +1 -0
  136. package/lib-commonjs/components/LineChart/LineChart.base.d.ts +1 -0
  137. package/lib-commonjs/components/LineChart/LineChart.base.js +33 -10
  138. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  139. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +36 -22
  140. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  141. package/lib-commonjs/index.d.ts +3 -1
  142. package/lib-commonjs/index.js +3 -1
  143. package/lib-commonjs/index.js.map +1 -1
  144. package/lib-commonjs/types/IDataPoint.d.ts +49 -0
  145. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  146. package/lib-commonjs/utilities/scatterpolar-utils.d.ts +22 -0
  147. package/lib-commonjs/utilities/scatterpolar-utils.js +42 -0
  148. package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -0
  149. package/lib-commonjs/utilities/test-data.d.ts +4 -1
  150. package/lib-commonjs/utilities/test-data.js +214 -1
  151. package/lib-commonjs/utilities/test-data.js.map +1 -1
  152. package/lib-commonjs/utilities/utilities.d.ts +14 -6
  153. package/lib-commonjs/utilities/utilities.js +28 -10
  154. package/lib-commonjs/utilities/utilities.js.map +1 -1
  155. package/package.json +2 -2
  156. package/src/components/CommonComponents/CartesianChart.types.ts +5 -2
  157. package/src/components/GanttChart/GanttChart.types.ts +83 -0
@@ -24,6 +24,7 @@ export var ChartTypes;
24
24
  ChartTypes[ChartTypes["HeatMapChart"] = 5] = "HeatMapChart";
25
25
  ChartTypes[ChartTypes["HorizontalBarChartWithAxis"] = 6] = "HorizontalBarChartWithAxis";
26
26
  ChartTypes[ChartTypes["ScatterChart"] = 7] = "ScatterChart";
27
+ ChartTypes[ChartTypes["GanttChart"] = 8] = "GanttChart";
27
28
  })(ChartTypes || (ChartTypes = {}));
28
29
  export var XAxisTypes;
29
30
  (function (XAxisTypes) {
@@ -94,7 +95,7 @@ export function createNumericXAxis(xAxisParams, tickParams, chartType, culture)
94
95
  .tickPadding(tickPadding)
95
96
  .ticks(tickCount)
96
97
  .tickFormat(tickFormat);
97
- if (chartType === ChartTypes.HorizontalBarChartWithAxis) {
98
+ if ([ChartTypes.HorizontalBarChartWithAxis, ChartTypes.GanttChart].includes(chartType)) {
98
99
  xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
99
100
  }
100
101
  if (tickParams.tickValues) {
@@ -173,7 +174,7 @@ function getMultiLevelD3DateFormatter(startLevel, endLevel, locale, useUTC) {
173
174
  var formatter = timeFormat(MULTI_LEVEL_DATE_TIME_FORMATS[startLevel][endLevel]);
174
175
  return formatter;
175
176
  }
176
- function getDateFormatLevel(date, useUTC) {
177
+ export function getDateFormatLevel(date, useUTC) {
177
178
  var _a;
178
179
  var timeSecond = useUTC ? d3UtcSecond : d3TimeSecond;
179
180
  var timeMinute = useUTC ? d3UtcMinute : d3TimeMinute;
@@ -208,7 +209,7 @@ function isPowerOf10(num) {
208
209
  * @param {IXAxisParams} xAxisParams
209
210
  * @param {ITickParams} tickParams
210
211
  */
211
- export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
212
+ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
212
213
  var _a;
213
214
  var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _b = xAxisParams.tickPadding, tickPadding = _b === void 0 ? 6 : _b, _c = xAxisParams.xAxistickSize, xAxistickSize = _c === void 0 ? 6 : _c, xAxisCount = xAxisParams.xAxisCount, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth;
214
215
  var xAxisScale = useUTC ? d3ScaleUtc() : d3ScaleTime();
@@ -257,6 +258,9 @@ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeF
257
258
  .tickPadding(tickPadding)
258
259
  .ticks(tickCount)
259
260
  .tickFormat(tickFormat);
261
+ if ([ChartTypes.GanttChart].includes(chartType)) {
262
+ xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
263
+ }
260
264
  tickParams.tickValues ? xAxis.tickValues(tickParams.tickValues) : '';
261
265
  if (xAxisElement) {
262
266
  d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
@@ -801,6 +805,7 @@ export function getXAxisType(points) {
801
805
  * @returns {IDomainNRange}
802
806
  */
803
807
  export function domainRangeOfNumericForAreaChart(points, margins, width, isRTL) {
808
+ var isScatterPolar = isScatterPolarSeries(points);
804
809
  var xMin = d3Min(points, function (point) {
805
810
  return d3Min(point.data, function (item) { return item.x; });
806
811
  });
@@ -812,8 +817,8 @@ export function domainRangeOfNumericForAreaChart(points, margins, width, isRTL)
812
817
  var rStartValue = margins.left;
813
818
  var rEndValue = width - margins.right;
814
819
  return isRTL
815
- ? { dStartValue: xMax, dEndValue: xMin, rStartValue: rStartValue, rEndValue: rEndValue }
816
- : { dStartValue: xMin, dEndValue: xMax, rStartValue: rStartValue, rEndValue: rEndValue };
820
+ ? { dStartValue: isScatterPolar ? 1 : xMax, dEndValue: isScatterPolar ? -1 : xMin, rStartValue: rStartValue, rEndValue: rEndValue }
821
+ : { dStartValue: isScatterPolar ? -1 : xMin, dEndValue: isScatterPolar ? 1 : xMax, rStartValue: rStartValue, rEndValue: rEndValue };
817
822
  }
818
823
  /**
819
824
  * Groups HorizontalBarChart With Axis data based on YValue
@@ -1024,9 +1029,9 @@ export function findVerticalNumericMinMaxOfY(points, yAxisType, useSecondaryYSca
1024
1029
  return { startValue: d3Min(values), endValue: d3Max(values) };
1025
1030
  }
1026
1031
  /**
1027
- * Fins the min and max values of the vertical bar chart y axis data point.
1032
+ * Fins the min and max values of the horizontal bar chart y axis data point.
1028
1033
  * @export
1029
- * @param {IVerticalBarChartDataPoint[]} points
1034
+ * @param {IHorizontalBarChartWithAxisDataPoint[]|IGanttChartDataPoint[]} points
1030
1035
  * @returns {{ startValue: number; endValue: number }}
1031
1036
  */
1032
1037
  export function findHBCWANumericMinMaxOfY(points, yAxisType) {
@@ -1383,6 +1388,7 @@ export function domainRangeOfDateForScatterChart(points, margins, width, isRTL,
1383
1388
  * @returns {IDomainNRange}
1384
1389
  */
1385
1390
  export function domainRangeOfNumericForScatterChart(points, margins, width, isRTL) {
1391
+ var isScatterPolar = isScatterPolarSeries(points);
1386
1392
  var xMin = d3Min(points, function (point) {
1387
1393
  return d3Min(point.data, function (item) { return item.x; });
1388
1394
  });
@@ -1397,8 +1403,8 @@ export function domainRangeOfNumericForScatterChart(points, margins, width, isRT
1397
1403
  var rStartValue = margins.left;
1398
1404
  var rEndValue = width - margins.right;
1399
1405
  return isRTL
1400
- ? { dStartValue: xMax, dEndValue: xMin, rStartValue: rStartValue, rEndValue: rEndValue }
1401
- : { dStartValue: xMin, dEndValue: xMax, rStartValue: rStartValue, rEndValue: rEndValue };
1406
+ ? { dStartValue: isScatterPolar ? 1 : xMax, dEndValue: isScatterPolar ? -1 : xMin, rStartValue: rStartValue, rEndValue: rEndValue }
1407
+ : { dStartValue: isScatterPolar ? -1 : xMin, dEndValue: isScatterPolar ? 1 : xMax, rStartValue: rStartValue, rEndValue: rEndValue };
1402
1408
  }
1403
1409
  export var truncateString = function (str, maxLength, ellipsis) {
1404
1410
  if (ellipsis === void 0) { ellipsis = '...'; }
@@ -1477,4 +1483,14 @@ export function getContrastTextColor(backgroundColor, theme) {
1477
1483
  }
1478
1484
  return textColor;
1479
1485
  }
1486
+ /**
1487
+ * Utility function to check if an array of points is scatterpolar
1488
+ * @param points - Array of chart points
1489
+ * @returns true if any point has lineOptions.mode as 'scatterpolar'
1490
+ */
1491
+ export function isScatterPolarSeries(points) {
1492
+ return points.some(
1493
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1494
+ function (item) { var _a; return typeof ((_a = item.lineOptions) === null || _a === void 0 ? void 0 : _a.mode) === 'string' && item.lineOptions.mode === 'scatterpolar'; });
1495
+ }
1480
1496
  //# sourceMappingURL=utilities.js.map