@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
@@ -594,33 +594,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
594
594
  }
595
595
  });
596
596
  }
597
- if (_this._yAxisType === index_3.YAxisType.StringAxis) {
598
- var legendToYValues_1 = {};
599
- _this._points.forEach(function (xPoint) {
600
- xPoint.chartData.forEach(function (bar) {
601
- if (!legendToYValues_1[bar.legend]) {
602
- legendToYValues_1[bar.legend] = ["".concat(bar.data)];
603
- }
604
- else {
605
- legendToYValues_1[bar.legend].push("".concat(bar.data));
606
- }
607
- });
608
- });
609
- var yAxisLabels_1 = new Set();
610
- Object.values(legendToYValues_1).forEach(function (yValues) {
611
- yValues.forEach(function (yVal) {
612
- yAxisLabels_1.add(yVal);
613
- });
614
- });
615
- Object.values(_this._lineObject).forEach(function (linePoints) {
616
- linePoints.forEach(function (linePoint) {
617
- if (!linePoint.useSecondaryYScale) {
618
- yAxisLabels_1.add("".concat(linePoint.y));
619
- }
620
- });
621
- });
622
- _this._yAxisLabels = Array.from(yAxisLabels_1);
623
- }
597
+ _this._yAxisLabels = _this._getOrderedYAxisLabels();
624
598
  };
625
599
  _this._getYDomainMargins = function (containerHeight) {
626
600
  /**
@@ -647,6 +621,49 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
647
621
  }
648
622
  return tslib_1.__assign(tslib_1.__assign({}, _this.margins), { top: _this.margins.top + yAxisTickMarginTop });
649
623
  };
624
+ _this._getOrderedXAxisLabels = function () {
625
+ if (_this._xAxisType !== index_3.XAxisTypes.StringAxis) {
626
+ return [];
627
+ }
628
+ return (0, index_3.sortAxisCategories)(_this._mapCategoryToValues(), _this.props.xAxisCategoryOrder);
629
+ };
630
+ _this._getOrderedYAxisLabels = function () {
631
+ if (_this._yAxisType !== index_3.YAxisType.StringAxis) {
632
+ return [];
633
+ }
634
+ return (0, index_3.sortAxisCategories)(_this._mapCategoryToValues(true), _this.props.yAxisCategoryOrder);
635
+ };
636
+ _this._mapCategoryToValues = function (isYAxis) {
637
+ if (isYAxis === void 0) { isYAxis = false; }
638
+ var categoryToValues = {};
639
+ _this._points.forEach(function (point) {
640
+ var _a;
641
+ point.chartData.forEach(function (bar) {
642
+ var category = (isYAxis ? bar.data : point.xAxisPoint);
643
+ var value = isYAxis ? point.xAxisPoint : bar.data;
644
+ if (!categoryToValues[category]) {
645
+ categoryToValues[category] = [];
646
+ }
647
+ if (typeof value === 'number') {
648
+ categoryToValues[category].push(value);
649
+ }
650
+ });
651
+ (_a = point.lineData) === null || _a === void 0 ? void 0 : _a.forEach(function (linePoint) {
652
+ if (isYAxis && linePoint.useSecondaryYScale) {
653
+ return;
654
+ }
655
+ var category = (isYAxis ? linePoint.y : point.xAxisPoint);
656
+ var value = isYAxis ? point.xAxisPoint : linePoint.y;
657
+ if (!categoryToValues[category]) {
658
+ categoryToValues[category] = [];
659
+ }
660
+ if (typeof value === 'number') {
661
+ categoryToValues[category].push(value);
662
+ }
663
+ });
664
+ });
665
+ return categoryToValues;
666
+ };
650
667
  (0, Utilities_1.initializeComponentRef)(_this);
651
668
  _this.state = {
652
669
  isCalloutVisible: false,
@@ -749,9 +766,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
749
766
  };
750
767
  VerticalStackedBarChartBase.prototype._createDataSetLayer = function () {
751
768
  var _this = this;
752
- var tempArr = [];
753
769
  var dataset = this._points.map(function (singlePointData) {
754
- tempArr.push(singlePointData.xAxisPoint);
755
770
  if (_this._yAxisType === index_3.YAxisType.StringAxis) {
756
771
  return {
757
772
  x: singlePointData.xAxisPoint,
@@ -767,7 +782,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
767
782
  y: total,
768
783
  };
769
784
  });
770
- this._xAxisLabels = tempArr;
785
+ this._xAxisLabels = this._getOrderedXAxisLabels();
771
786
  return dataset;
772
787
  };
773
788
  VerticalStackedBarChartBase.prototype._renderCallout = function (props) {
@@ -979,6 +994,8 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
979
994
  VerticalStackedBarChartBase.defaultProps = {
980
995
  maxBarWidth: 24,
981
996
  useUTC: true,
997
+ xAxisCategoryOrder: 'default',
998
+ yAxisCategoryOrder: 'default',
982
999
  };
983
1000
  return VerticalStackedBarChartBase;
984
1001
  }(React.Component));