@fluentui/react-charting 5.24.13 → 5.24.15

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 (65) hide show
  1. package/CHANGELOG.json +64 -1
  2. package/CHANGELOG.md +23 -2
  3. package/dist/react-charting.d.ts +26 -17
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +1 -0
  7. package/lib/Utilities.js +19 -1
  8. package/lib/Utilities.js.map +1 -1
  9. package/lib/components/CommonComponents/CartesianChart.base.js +6 -6
  10. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  11. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +45 -12
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  13. package/lib/components/GanttChart/GanttChart.base.js +210 -158
  14. package/lib/components/GanttChart/GanttChart.base.js.map +1 -1
  15. package/lib/components/GanttChart/GanttChart.types.d.ts +23 -13
  16. package/lib/components/GanttChart/GanttChart.types.js.map +1 -1
  17. package/lib/components/LineChart/LineChart.base.js +6 -11
  18. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  19. package/lib/components/ScatterChart/ScatterChart.base.js +4 -9
  20. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  21. package/lib/types/IDataPoint.d.ts +3 -4
  22. package/lib/types/IDataPoint.js.map +1 -1
  23. package/lib/utilities/scatterpolar-utils.d.ts +7 -4
  24. package/lib/utilities/scatterpolar-utils.js +19 -2
  25. package/lib/utilities/scatterpolar-utils.js.map +1 -1
  26. package/lib-amd/Utilities.js +9 -0
  27. package/lib-amd/Utilities.js.map +1 -1
  28. package/lib-amd/components/CommonComponents/CartesianChart.base.js +6 -6
  29. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  30. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +45 -12
  31. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  32. package/lib-amd/components/GanttChart/GanttChart.base.js +210 -158
  33. package/lib-amd/components/GanttChart/GanttChart.base.js.map +1 -1
  34. package/lib-amd/components/GanttChart/GanttChart.types.d.ts +23 -13
  35. package/lib-amd/components/GanttChart/GanttChart.types.js.map +1 -1
  36. package/lib-amd/components/LineChart/LineChart.base.js +6 -11
  37. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  38. package/lib-amd/components/ScatterChart/ScatterChart.base.js +4 -9
  39. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  40. package/lib-amd/types/IDataPoint.d.ts +3 -4
  41. package/lib-amd/types/IDataPoint.js.map +1 -1
  42. package/lib-amd/utilities/scatterpolar-utils.d.ts +7 -4
  43. package/lib-amd/utilities/scatterpolar-utils.js +21 -3
  44. package/lib-amd/utilities/scatterpolar-utils.js.map +1 -1
  45. package/lib-commonjs/Utilities.js +9 -0
  46. package/lib-commonjs/Utilities.js.map +1 -1
  47. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +6 -6
  48. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  49. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +45 -12
  50. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  51. package/lib-commonjs/components/GanttChart/GanttChart.base.js +210 -158
  52. package/lib-commonjs/components/GanttChart/GanttChart.base.js.map +1 -1
  53. package/lib-commonjs/components/GanttChart/GanttChart.types.d.ts +23 -13
  54. package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -1
  55. package/lib-commonjs/components/LineChart/LineChart.base.js +6 -11
  56. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  57. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +4 -9
  58. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  59. package/lib-commonjs/types/IDataPoint.d.ts +3 -4
  60. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  61. package/lib-commonjs/utilities/scatterpolar-utils.d.ts +7 -4
  62. package/lib-commonjs/utilities/scatterpolar-utils.js +21 -3
  63. package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -1
  64. package/package.json +2 -2
  65. package/src/components/GanttChart/GanttChart.types.ts +24 -13
@@ -330,7 +330,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
330
330
  });
331
331
  });
332
332
  var vsbcData = Object.values(mapXToDataPoints);
333
- return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vsbcData, width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_d = vsbcData[0]) === null || _d === void 0 ? void 0 : _d.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat);
333
+ return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vsbcData, width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_d = vsbcData[0]) === null || _d === void 0 ? void 0 : _d.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat);
334
334
  };
335
335
  exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
336
336
  var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -491,7 +491,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
491
491
  var legendShape = getLegendShape(series);
492
492
  var validXYRanges = (0, exports.getValidXYRanges)(series);
493
493
  return validXYRanges.map(function (_a, rangeIdx) {
494
- var _b, _c, _d;
494
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
495
495
  var rangeStart = _a[0], rangeEnd = _a[1];
496
496
  var rangeXValues = xValues.slice(rangeStart, rangeEnd);
497
497
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
@@ -511,10 +511,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
511
511
  : {})), (textValues ? { text: textValues[i] } : {})), { yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat) }));
512
512
  }),
513
513
  color: (_c = (0, d3_color_1.rgb)(seriesColor).copy({ opacity: seriesOpacity }).formatHex8()) !== null && _c !== void 0 ? _c : seriesColor,
514
- lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.type !== 'scatterpolar' ? series.mode : 'scatterpolar',
515
- // originXOffset is not typed on Layout, but may be present in input.layout as a part of projection of
516
- // scatter polar coordingates to cartesian coordinates
517
- originXOffset: (_d = input.layout) === null || _d === void 0 ? void 0 : _d.__polarOriginX }),
514
+ lineOptions: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.type !== 'scatterpolar' ? series.mode : 'scatterpolar' }), (series.type === 'scatterpolar'
515
+ ? {
516
+ originXOffset: (_d = input.layout) === null || _d === void 0 ? void 0 : _d.__polarOriginX,
517
+ direction: (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.polar) === null || _f === void 0 ? void 0 : _f.angularaxis) === null || _g === void 0 ? void 0 : _g.direction,
518
+ rotation: (_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.polar) === null || _j === void 0 ? void 0 : _j.angularaxis) === null || _k === void 0 ? void 0 : _k.rotation,
519
+ }
520
+ : {})),
518
521
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
519
522
  };
520
523
  });
@@ -602,7 +605,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
602
605
  var isXDate = ((_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.xaxis) === null || _f === void 0 ? void 0 : _f.type) === 'date' || (0, chart_utilities_1.isDateArray)(series.x);
603
606
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
604
607
  var convertXValueToNumber = function (value) {
605
- return (0, chart_utilities_1.isInvalidValue)(value) ? 0 : isXDate ? new Date(value).getTime() : value;
608
+ return (0, chart_utilities_1.isInvalidValue)(value) ? 0 : isXDate ? +parseLocalDate(value) : +value;
606
609
  };
607
610
  return series.y
608
611
  .map(function (yVal, i) {
@@ -1127,7 +1130,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
1127
1130
  };
1128
1131
  exports.transformPlotlyJsonToFunnelChartProps = transformPlotlyJsonToFunnelChartProps;
1129
1132
  var projectPolarToCartesian = function (input) {
1130
- var _a, _b;
1133
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1131
1134
  var projection = tslib_1.__assign({}, input);
1132
1135
  // 1. Find the global min and max radius across all series
1133
1136
  var minRadius = 0;
@@ -1164,6 +1167,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
1164
1167
  projection.data[sindex] = series;
1165
1168
  return "continue";
1166
1169
  }
1170
+ // retrieve polar axis settings
1171
+ var dirMultiplier = ((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.polar) === null || _b === void 0 ? void 0 : _b.angularaxis) === null || _c === void 0 ? void 0 : _c.direction) === 'clockwise' ? -1 : 1;
1172
+ var startAngleInRad = (((_g = (_f = (_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.polar) === null || _e === void 0 ? void 0 : _e.angularaxis) === null || _f === void 0 ? void 0 : _f.rotation) !== null && _g !== void 0 ? _g : 0) * Math.PI) / 180;
1167
1173
  // Compute tick positions if categorical
1168
1174
  var uniqueTheta = [];
1169
1175
  var categorical = false;
@@ -1180,10 +1186,10 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
1180
1186
  if (categorical) {
1181
1187
  var idx = uniqueTheta.indexOf(thetas[ptindex]);
1182
1188
  var step = (2 * Math.PI) / uniqueTheta.length;
1183
- thetaRad = idx * step;
1189
+ thetaRad = startAngleInRad + dirMultiplier * idx * step;
1184
1190
  }
1185
1191
  else {
1186
- thetaRad = (thetas[ptindex] * Math.PI) / 180;
1192
+ thetaRad = startAngleInRad + dirMultiplier * ((thetas[ptindex] * Math.PI) / 180);
1187
1193
  }
1188
1194
  // 5. Shift only the polar origin (not the cartesian)
1189
1195
  var rawRadius = rVals[ptindex];
@@ -1237,7 +1243,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
1237
1243
  }
1238
1244
  }
1239
1245
  // 10. Customize layout for perfect square with absolute positioning
1240
- var size = ((_a = input.layout) === null || _a === void 0 ? void 0 : _a.width) || ((_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) || 500;
1246
+ var size = ((_h = input.layout) === null || _h === void 0 ? void 0 : _h.width) || ((_j = input.layout) === null || _j === void 0 ? void 0 : _j.height) || 500;
1241
1247
  projection.layout = tslib_1.__assign(tslib_1.__assign({}, projection.layout), { width: size, height: size });
1242
1248
  // Attach originX as custom properties
1243
1249
  projection.layout.__polarOriginX = originX !== null && originX !== void 0 ? originX : undefined;
@@ -1721,12 +1727,39 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
1721
1727
  }
1722
1728
  if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1723
1729
  var categoriesInTraceOrder = Array.from(new Set(values));
1724
- result[propName] = categoriesInTraceOrder;
1730
+ result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
1725
1731
  return;
1726
1732
  }
1727
1733
  result[propName] = ax.categoryorder;
1728
1734
  });
1729
1735
  return result;
1730
1736
  };
1737
+ /**
1738
+ * This is experimental. Use it only with valid datetime strings to verify if they conform to the ISO 8601 format.
1739
+ */
1740
+ var isoDateRegex = /^\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?(Z)?)?$/;
1741
+ /**
1742
+ * We want to display localized date and time in the charts, so the useUTC prop is set to false.
1743
+ * But this can sometimes cause the formatters to display the datetime incorrectly.
1744
+ * To work around this issue, we use this function to adjust datetime strings so that they are always interpreted
1745
+ * as local time, allowing the formatters to produce the correct output.
1746
+ *
1747
+ * FIXME: The formatters should always produce a clear and accurate localized output, regardless of the
1748
+ * format used to create the date object.
1749
+ */
1750
+ var parseLocalDate = function (value) {
1751
+ if (typeof value === 'string') {
1752
+ var match = value.match(isoDateRegex);
1753
+ if (match) {
1754
+ if (!match[3]) {
1755
+ value += 'T00:00';
1756
+ }
1757
+ else if (match[6]) {
1758
+ value = value.replace('Z', '');
1759
+ }
1760
+ }
1761
+ }
1762
+ return new Date(value);
1763
+ };
1731
1764
  });
1732
1765
  //# sourceMappingURL=PlotlySchemaAdapter.js.map