@fluentui/react-charting 5.24.2 → 5.24.4

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 (192) hide show
  1. package/CHANGELOG.json +79 -1
  2. package/CHANGELOG.md +28 -2
  3. package/dist/react-charting.d.ts +204 -38
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +65 -12
  7. package/lib/ScatterChart.d.ts +1 -0
  8. package/lib/ScatterChart.js +2 -0
  9. package/lib/ScatterChart.js.map +1 -0
  10. package/lib/components/AreaChart/AreaChart.base.d.ts +1 -0
  11. package/lib/components/AreaChart/AreaChart.base.js +4 -1
  12. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  13. package/lib/components/CommonComponents/CartesianChart.base.js +47 -11
  14. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  15. package/lib/components/CommonComponents/CartesianChart.styles.js +48 -26
  16. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  17. package/lib/components/CommonComponents/CartesianChart.types.d.ts +33 -3
  18. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  19. package/lib/components/DeclarativeChart/DeclarativeChart.js +157 -78
  20. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  21. package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  22. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +9 -1
  23. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  24. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
  25. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +317 -126
  26. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  27. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
  28. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +22 -3
  29. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  30. package/lib/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
  31. package/lib/components/HeatMapChart/HeatMapChart.base.js +95 -37
  32. package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  33. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
  34. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +24 -3
  35. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  36. package/lib/components/ScatterChart/ScatterChart.base.d.ts +7 -0
  37. package/lib/components/ScatterChart/ScatterChart.base.js +482 -0
  38. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -0
  39. package/lib/components/ScatterChart/ScatterChart.d.ts +7 -0
  40. package/lib/components/ScatterChart/ScatterChart.js +10 -0
  41. package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
  42. package/lib/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
  43. package/lib/components/ScatterChart/ScatterChart.styles.js +19 -0
  44. package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -0
  45. package/lib/components/ScatterChart/ScatterChart.types.d.ts +47 -0
  46. package/lib/components/ScatterChart/ScatterChart.types.js +2 -0
  47. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
  48. package/lib/components/ScatterChart/index.d.ts +2 -0
  49. package/lib/components/ScatterChart/index.js +3 -0
  50. package/lib/components/ScatterChart/index.js.map +1 -0
  51. package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  52. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +27 -6
  53. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  54. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  55. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +48 -31
  56. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  57. package/lib/index.d.ts +3 -1
  58. package/lib/index.js +1 -0
  59. package/lib/index.js.map +1 -1
  60. package/lib/types/IDataPoint.d.ts +91 -11
  61. package/lib/types/IDataPoint.js.map +1 -1
  62. package/lib/utilities/SVGTooltipText.d.ts +4 -0
  63. package/lib/utilities/SVGTooltipText.js +1 -2
  64. package/lib/utilities/SVGTooltipText.js.map +1 -1
  65. package/lib/utilities/utilities.d.ts +32 -5
  66. package/lib/utilities/utilities.js +132 -2
  67. package/lib/utilities/utilities.js.map +1 -1
  68. package/lib-amd/ScatterChart.d.ts +1 -0
  69. package/lib-amd/ScatterChart.js +6 -0
  70. package/lib-amd/ScatterChart.js.map +1 -0
  71. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +1 -0
  72. package/lib-amd/components/AreaChart/AreaChart.base.js +4 -1
  73. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  74. package/lib-amd/components/CommonComponents/CartesianChart.base.js +47 -11
  75. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  76. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +48 -26
  77. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  78. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +33 -3
  79. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  80. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +155 -78
  81. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  82. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  83. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
  84. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  85. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
  86. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +327 -134
  87. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  88. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
  89. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -2
  90. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  91. package/lib-amd/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
  92. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +94 -36
  93. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  94. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
  95. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
  96. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  97. package/lib-amd/components/ScatterChart/ScatterChart.base.d.ts +7 -0
  98. package/lib-amd/components/ScatterChart/ScatterChart.base.js +476 -0
  99. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -0
  100. package/lib-amd/components/ScatterChart/ScatterChart.d.ts +7 -0
  101. package/lib-amd/components/ScatterChart/ScatterChart.js +12 -0
  102. package/lib-amd/components/ScatterChart/ScatterChart.js.map +1 -0
  103. package/lib-amd/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
  104. package/lib-amd/components/ScatterChart/ScatterChart.styles.js +23 -0
  105. package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -0
  106. package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +47 -0
  107. package/lib-amd/components/ScatterChart/ScatterChart.types.js +5 -0
  108. package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -0
  109. package/lib-amd/components/ScatterChart/index.d.ts +2 -0
  110. package/lib-amd/components/ScatterChart/index.js +7 -0
  111. package/lib-amd/components/ScatterChart/index.js.map +1 -0
  112. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  113. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +26 -5
  114. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  115. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  116. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +47 -30
  117. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  118. package/lib-amd/index.d.ts +3 -1
  119. package/lib-amd/index.js +3 -2
  120. package/lib-amd/index.js.map +1 -1
  121. package/lib-amd/types/IDataPoint.d.ts +91 -11
  122. package/lib-amd/types/IDataPoint.js.map +1 -1
  123. package/lib-amd/utilities/SVGTooltipText.d.ts +4 -0
  124. package/lib-amd/utilities/SVGTooltipText.js +1 -2
  125. package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
  126. package/lib-amd/utilities/utilities.d.ts +32 -5
  127. package/lib-amd/utilities/utilities.js +135 -2
  128. package/lib-amd/utilities/utilities.js.map +1 -1
  129. package/lib-commonjs/ScatterChart.d.ts +1 -0
  130. package/lib-commonjs/ScatterChart.js +5 -0
  131. package/lib-commonjs/ScatterChart.js.map +1 -0
  132. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +1 -0
  133. package/lib-commonjs/components/AreaChart/AreaChart.base.js +4 -1
  134. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  135. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +47 -11
  136. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  137. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +48 -26
  138. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  139. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +33 -3
  140. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  141. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +157 -78
  142. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  143. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  144. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
  145. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  146. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
  147. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +327 -134
  148. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  149. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
  150. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -2
  151. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  152. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
  153. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +94 -36
  154. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  155. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
  156. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
  157. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  158. package/lib-commonjs/components/ScatterChart/ScatterChart.base.d.ts +7 -0
  159. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +485 -0
  160. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -0
  161. package/lib-commonjs/components/ScatterChart/ScatterChart.d.ts +7 -0
  162. package/lib-commonjs/components/ScatterChart/ScatterChart.js +13 -0
  163. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
  164. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
  165. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +23 -0
  166. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -0
  167. package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +47 -0
  168. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +3 -0
  169. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
  170. package/lib-commonjs/components/ScatterChart/index.d.ts +2 -0
  171. package/lib-commonjs/components/ScatterChart/index.js +6 -0
  172. package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
  173. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  174. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +26 -5
  175. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  176. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  177. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +47 -30
  178. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  179. package/lib-commonjs/index.d.ts +3 -1
  180. package/lib-commonjs/index.js +3 -1
  181. package/lib-commonjs/index.js.map +1 -1
  182. package/lib-commonjs/types/IDataPoint.d.ts +91 -11
  183. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  184. package/lib-commonjs/utilities/SVGTooltipText.d.ts +4 -0
  185. package/lib-commonjs/utilities/SVGTooltipText.js +1 -2
  186. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  187. package/lib-commonjs/utilities/utilities.d.ts +32 -5
  188. package/lib-commonjs/utilities/utilities.js +135 -2
  189. package/lib-commonjs/utilities/utilities.js.map +1 -1
  190. package/package.json +2 -2
  191. package/src/components/CommonComponents/CartesianChart.types.ts +45 -2
  192. package/src/components/ScatterChart/ScatterChart.types.ts +67 -0
@@ -9,7 +9,7 @@ import { Legends } from '../Legends/index';
9
9
  import { CartesianChart, ChartHoverCard, } from '../../index';
10
10
  import { FocusZoneDirection } from '@fluentui/react-focus';
11
11
  import { formatDateToLocaleString } from '@fluentui/chart-utilities';
12
- import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfAxislabels, formatScientificLimitWidth, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, findVSBCNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, getNextGradient, areArraysEqual, calculateLongestLabelWidth, YAxisType, } from '../../utilities/index';
12
+ import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfAxislabels, formatScientificLimitWidth, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, findVSBCNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, getNextGradient, areArraysEqual, calculateLongestLabelWidth, YAxisType, sortAxisCategories, } from '../../utilities/index';
13
13
  import { toImage } from '../../utilities/image-export-utils';
14
14
  var getClassNames = classNamesFunction();
15
15
  var COMPONENT_NAME = 'VERTICAL STACKED BAR CHART';
@@ -603,33 +603,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
603
603
  }
604
604
  });
605
605
  }
606
- if (_this._yAxisType === YAxisType.StringAxis) {
607
- var legendToYValues_1 = {};
608
- _this._points.forEach(function (xPoint) {
609
- xPoint.chartData.forEach(function (bar) {
610
- if (!legendToYValues_1[bar.legend]) {
611
- legendToYValues_1[bar.legend] = ["".concat(bar.data)];
612
- }
613
- else {
614
- legendToYValues_1[bar.legend].push("".concat(bar.data));
615
- }
616
- });
617
- });
618
- var yAxisLabels_1 = new Set();
619
- Object.values(legendToYValues_1).forEach(function (yValues) {
620
- yValues.forEach(function (yVal) {
621
- yAxisLabels_1.add(yVal);
622
- });
623
- });
624
- Object.values(_this._lineObject).forEach(function (linePoints) {
625
- linePoints.forEach(function (linePoint) {
626
- if (!linePoint.useSecondaryYScale) {
627
- yAxisLabels_1.add("".concat(linePoint.y));
628
- }
629
- });
630
- });
631
- _this._yAxisLabels = Array.from(yAxisLabels_1);
632
- }
606
+ _this._yAxisLabels = _this._getOrderedYAxisLabels();
633
607
  };
634
608
  _this._getYDomainMargins = function (containerHeight) {
635
609
  /**
@@ -656,6 +630,49 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
656
630
  }
657
631
  return __assign(__assign({}, _this.margins), { top: _this.margins.top + yAxisTickMarginTop });
658
632
  };
633
+ _this._getOrderedXAxisLabels = function () {
634
+ if (_this._xAxisType !== XAxisTypes.StringAxis) {
635
+ return [];
636
+ }
637
+ return sortAxisCategories(_this._mapCategoryToValues(), _this.props.xAxisCategoryOrder);
638
+ };
639
+ _this._getOrderedYAxisLabels = function () {
640
+ if (_this._yAxisType !== YAxisType.StringAxis) {
641
+ return [];
642
+ }
643
+ return sortAxisCategories(_this._mapCategoryToValues(true), _this.props.yAxisCategoryOrder);
644
+ };
645
+ _this._mapCategoryToValues = function (isYAxis) {
646
+ if (isYAxis === void 0) { isYAxis = false; }
647
+ var categoryToValues = {};
648
+ _this._points.forEach(function (point) {
649
+ var _a;
650
+ point.chartData.forEach(function (bar) {
651
+ var category = (isYAxis ? bar.data : point.xAxisPoint);
652
+ var value = isYAxis ? point.xAxisPoint : bar.data;
653
+ if (!categoryToValues[category]) {
654
+ categoryToValues[category] = [];
655
+ }
656
+ if (typeof value === 'number') {
657
+ categoryToValues[category].push(value);
658
+ }
659
+ });
660
+ (_a = point.lineData) === null || _a === void 0 ? void 0 : _a.forEach(function (linePoint) {
661
+ if (isYAxis && linePoint.useSecondaryYScale) {
662
+ return;
663
+ }
664
+ var category = (isYAxis ? linePoint.y : point.xAxisPoint);
665
+ var value = isYAxis ? point.xAxisPoint : linePoint.y;
666
+ if (!categoryToValues[category]) {
667
+ categoryToValues[category] = [];
668
+ }
669
+ if (typeof value === 'number') {
670
+ categoryToValues[category].push(value);
671
+ }
672
+ });
673
+ });
674
+ return categoryToValues;
675
+ };
659
676
  initializeComponentRef(_this);
660
677
  _this.state = {
661
678
  isCalloutVisible: false,
@@ -758,9 +775,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
758
775
  };
759
776
  VerticalStackedBarChartBase.prototype._createDataSetLayer = function () {
760
777
  var _this = this;
761
- var tempArr = [];
762
778
  var dataset = this._points.map(function (singlePointData) {
763
- tempArr.push(singlePointData.xAxisPoint);
764
779
  if (_this._yAxisType === YAxisType.StringAxis) {
765
780
  return {
766
781
  x: singlePointData.xAxisPoint,
@@ -776,7 +791,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
776
791
  y: total,
777
792
  };
778
793
  });
779
- this._xAxisLabels = tempArr;
794
+ this._xAxisLabels = this._getOrderedXAxisLabels();
780
795
  return dataset;
781
796
  };
782
797
  VerticalStackedBarChartBase.prototype._renderCallout = function (props) {
@@ -988,6 +1003,8 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
988
1003
  VerticalStackedBarChartBase.defaultProps = {
989
1004
  maxBarWidth: 24,
990
1005
  useUTC: true,
1006
+ xAxisCategoryOrder: 'default',
1007
+ yAxisCategoryOrder: 'default',
991
1008
  };
992
1009
  return VerticalStackedBarChartBase;
993
1010
  }(React.Component));