@fluentui/react-charts 0.0.0-nightly-20250826-2140.1 → 0.0.0-nightly-20250828-0408.1

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 (158) hide show
  1. package/CHANGELOG.md +48 -15
  2. package/dist/index.d.ts +15 -1
  3. package/lib/components/AreaChart/AreaChart.js +4 -1
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -2
  6. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  7. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -15
  8. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  9. package/lib/components/ChartTable/ChartTable.js +87 -6
  10. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  11. package/lib/components/CommonComponents/CartesianChart.js +24 -24
  12. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  13. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +17 -14
  14. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  15. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +6 -33
  16. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  17. package/lib/components/DeclarativeChart/DeclarativeChart.js +42 -16
  18. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  19. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +20 -1
  20. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  21. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +502 -259
  22. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  23. package/lib/components/DonutChart/DonutChart.js +6 -1
  24. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  25. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  26. package/lib/components/DonutChart/useDonutChartStyles.styles.js +21 -4
  27. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  28. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
  29. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  30. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +23 -4
  31. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  32. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +4 -17
  33. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  34. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +4 -21
  35. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  36. package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
  37. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  38. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
  39. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  40. package/lib/components/LineChart/LineChart.js +128 -82
  41. package/lib/components/LineChart/LineChart.js.map +1 -1
  42. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  43. package/lib/components/LineChart/useLineChartStyles.styles.js +23 -10
  44. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  45. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +4 -21
  46. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  47. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +12 -25
  48. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  49. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -12
  50. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  51. package/lib/components/ScatterChart/ScatterChart.js +86 -59
  52. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  53. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  54. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +27 -7
  55. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  56. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +8 -14
  57. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  58. package/lib/components/VerticalBarChart/VerticalBarChart.js +27 -4
  59. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  60. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +8 -6
  61. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  62. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +5 -19
  63. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  64. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +61 -44
  65. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  66. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +7 -6
  67. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  68. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +4 -19
  69. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  70. package/lib/utilities/Common.styles.js +47 -0
  71. package/lib/utilities/Common.styles.js.map +1 -0
  72. package/lib/utilities/Common.styles.raw.js +47 -0
  73. package/lib/utilities/Common.styles.raw.js.map +1 -0
  74. package/lib/utilities/SVGTooltipText.js.map +1 -1
  75. package/lib/utilities/index.js +1 -0
  76. package/lib/utilities/index.js.map +1 -1
  77. package/lib/utilities/scatterpolar-utils.js +52 -0
  78. package/lib/utilities/scatterpolar-utils.js.map +1 -0
  79. package/lib/utilities/utilities.js +32 -37
  80. package/lib/utilities/utilities.js.map +1 -1
  81. package/lib-commonjs/components/AreaChart/AreaChart.js +4 -1
  82. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  83. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  84. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -14
  85. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  86. package/lib-commonjs/components/ChartTable/ChartTable.js +87 -6
  87. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  88. package/lib-commonjs/components/CommonComponents/CartesianChart.js +24 -24
  89. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  90. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +15 -13
  91. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  92. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -32
  93. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  94. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +41 -15
  95. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  96. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +23 -1
  97. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  98. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +509 -257
  99. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  100. package/lib-commonjs/components/DonutChart/DonutChart.js +6 -1
  101. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  102. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  103. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +32 -4
  104. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  105. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
  106. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  107. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -3
  108. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  109. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -19
  110. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  111. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -20
  112. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  113. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
  114. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  115. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
  116. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  117. package/lib-commonjs/components/LineChart/LineChart.js +127 -81
  118. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  119. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  120. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +30 -9
  121. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  122. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +2 -20
  123. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  124. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +23 -33
  125. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  126. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +1 -12
  127. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  128. package/lib-commonjs/components/ScatterChart/ScatterChart.js +85 -58
  129. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  130. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  131. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +37 -5
  132. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  133. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +7 -13
  134. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  135. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +26 -3
  136. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  137. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +5 -3
  138. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  139. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -17
  140. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  141. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +60 -43
  142. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  143. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +5 -3
  144. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  145. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -18
  146. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  147. package/lib-commonjs/utilities/Common.styles.js +71 -0
  148. package/lib-commonjs/utilities/Common.styles.js.map +1 -0
  149. package/lib-commonjs/utilities/Common.styles.raw.js +71 -0
  150. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -0
  151. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  152. package/lib-commonjs/utilities/index.js +1 -0
  153. package/lib-commonjs/utilities/index.js.map +1 -1
  154. package/lib-commonjs/utilities/scatterpolar-utils.js +67 -0
  155. package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -0
  156. package/lib-commonjs/utilities/utilities.js +28 -40
  157. package/lib-commonjs/utilities/utilities.js.map +1 -1
  158. package/package.json +12 -12
@@ -23,7 +23,11 @@ const _chartutilities = require("@fluentui/chart-utilities");
23
23
  const barGapMultiplier = 0.2;
24
24
  const barGapMin = 1;
25
25
  const MIN_DOMAIN_MARGIN = 8;
26
- const VerticalStackedBarChart = (props)=>{
26
+ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((props = {
27
+ xAxisCategoryOrder: 'default',
28
+ yAxisCategoryOrder: 'default',
29
+ data: []
30
+ }, forwardedRef)=>{
27
31
  var _props_legendProps;
28
32
  const _isRtl = (0, _index1.useRtl)();
29
33
  const _createLegendsForLine = (data)=>_getLineLegends(data);
@@ -252,9 +256,7 @@ const VerticalStackedBarChart = (props)=>{
252
256
  _initYAxisParams();
253
257
  }
254
258
  function _createDataSetLayer() {
255
- const tempArr = [];
256
259
  const dataset = _points.map((singlePointData)=>{
257
- tempArr.push(singlePointData.xAxisPoint);
258
260
  if (_yAxisType === _index1.YAxisType.StringAxis) {
259
261
  return {
260
262
  x: singlePointData.xAxisPoint,
@@ -270,7 +272,7 @@ const VerticalStackedBarChart = (props)=>{
270
272
  y: total
271
273
  };
272
274
  });
273
- _xAxisLabels = tempArr;
275
+ _xAxisLabels = _getOrderedXAxisLabels();
274
276
  return dataset;
275
277
  }
276
278
  function _onLegendHover(legendTitle) {
@@ -305,16 +307,16 @@ const VerticalStackedBarChart = (props)=>{
305
307
  }
306
308
  }
307
309
  /**
308
- * This function checks if the given legend is highlighted or not.
309
- * A legend can be highlighted in 2 ways:
310
- * 1. selection: if the user clicks on it
311
- * 2. hovering: if there is no selected legend and the user hovers over it
312
- */ function _isLegendHighlighted(legendTitle) {
310
+ * This function checks if the given legend is highlighted or not.
311
+ * A legend can be highlighted in 2 ways:
312
+ * 1. selection: if the user clicks on it
313
+ * 2. hovering: if there is no selected legend and the user hovers over it
314
+ */ function _isLegendHighlighted(legendTitle) {
313
315
  return _getHighlightedLegend().includes(legendTitle);
314
316
  }
315
317
  /**
316
- * This function checks if none of the legends is selected or hovered.
317
- */ function _noLegendHighlighted() {
318
+ * This function checks if none of the legends is selected or hovered.
319
+ */ function _noLegendHighlighted() {
318
320
  return _getHighlightedLegend().length === 0;
319
321
  }
320
322
  function _getAriaLabel(singleChartData, point, isLinePoint) {
@@ -955,40 +957,13 @@ const VerticalStackedBarChart = (props)=>{
955
957
  }
956
958
  });
957
959
  }
958
- if (_yAxisType === _index1.YAxisType.StringAxis) {
959
- const legendToYValues = {};
960
- _points.forEach((xPoint)=>{
961
- xPoint.chartData.forEach((bar)=>{
962
- if (!legendToYValues[bar.legend]) {
963
- legendToYValues[bar.legend] = [
964
- `${bar.data}`
965
- ];
966
- } else {
967
- legendToYValues[bar.legend].push(`${bar.data}`);
968
- }
969
- });
970
- });
971
- const yAxisLabels = new Set();
972
- Object.values(legendToYValues).forEach((yValues)=>{
973
- yValues.forEach((yVal)=>{
974
- yAxisLabels.add(yVal);
975
- });
976
- });
977
- Object.values(_lineObject).forEach((linePoints)=>{
978
- linePoints.forEach((linePoint)=>{
979
- if (!linePoint.useSecondaryYScale) {
980
- yAxisLabels.add(`${linePoint.y}`);
981
- }
982
- });
983
- });
984
- _yAxisLabels = Array.from(yAxisLabels);
985
- }
960
+ _yAxisLabels = _getOrderedYAxisLabels();
986
961
  }
987
962
  function _getYDomainMargins(containerHeight) {
988
963
  /**
989
- * Specifies the extra top margin to apply above the highest y-axis tick label.
990
- * Useful when stacked bars extend beyond the combined height of all y-axis labels (or categories).
991
- */ let yAxisTickMarginTop = 0;
964
+ * Specifies the extra top margin to apply above the highest y-axis tick label.
965
+ * Useful when stacked bars extend beyond the combined height of all y-axis labels (or categories).
966
+ */ let yAxisTickMarginTop = 0;
992
967
  /** Total height available to render the bars */ const totalHeight = containerHeight - _margins.bottom - _margins.top;
993
968
  if (_yAxisType === _index1.YAxisType.StringAxis) {
994
969
  /** Maximum height of the stacked bars, expressed in multiples of the height of a y-axis label (or category) */ let maxBarHeightInLabels = 0;
@@ -1007,6 +982,48 @@ const VerticalStackedBarChart = (props)=>{
1007
982
  top: _margins.top + yAxisTickMarginTop
1008
983
  };
1009
984
  }
985
+ function _getOrderedXAxisLabels() {
986
+ if (_xAxisType !== _index1.XAxisTypes.StringAxis) {
987
+ return [];
988
+ }
989
+ return (0, _index1.sortAxisCategories)(_mapCategoryToValues(), props.xAxisCategoryOrder);
990
+ }
991
+ function _getOrderedYAxisLabels() {
992
+ if (_yAxisType !== _index1.YAxisType.StringAxis) {
993
+ return [];
994
+ }
995
+ return (0, _index1.sortAxisCategories)(_mapCategoryToValues(true), props.yAxisCategoryOrder);
996
+ }
997
+ function _mapCategoryToValues(isYAxis = false) {
998
+ const categoryToValues = {};
999
+ _points.forEach((point)=>{
1000
+ var _point_lineData;
1001
+ point.chartData.forEach((bar)=>{
1002
+ const category = isYAxis ? bar.data : point.xAxisPoint;
1003
+ const value = isYAxis ? point.xAxisPoint : bar.data;
1004
+ if (!categoryToValues[category]) {
1005
+ categoryToValues[category] = [];
1006
+ }
1007
+ if (typeof value === 'number') {
1008
+ categoryToValues[category].push(value);
1009
+ }
1010
+ });
1011
+ (_point_lineData = point.lineData) === null || _point_lineData === void 0 ? void 0 : _point_lineData.forEach((linePoint)=>{
1012
+ if (isYAxis && linePoint.useSecondaryYScale) {
1013
+ return;
1014
+ }
1015
+ const category = isYAxis ? linePoint.y : point.xAxisPoint;
1016
+ const value = isYAxis ? point.xAxisPoint : linePoint.y;
1017
+ if (!categoryToValues[category]) {
1018
+ categoryToValues[category] = [];
1019
+ }
1020
+ if (typeof value === 'number') {
1021
+ categoryToValues[category].push(value);
1022
+ }
1023
+ });
1024
+ });
1025
+ return categoryToValues;
1026
+ }
1010
1027
  if (!_isChartEmpty()) {
1011
1028
  _adjustProps();
1012
1029
  const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
@@ -1081,5 +1098,5 @@ const VerticalStackedBarChart = (props)=>{
1081
1098
  },
1082
1099
  "aria-label": 'Graph has no data to display'
1083
1100
  });
1084
- };
1101
+ });
1085
1102
  VerticalStackedBarChart.displayName = 'VerticalStackedBarChart';