@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
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.isStringArray = exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.resolveXAxisPoint = exports._getGaugeAxisColor = exports.correctYearMonth = exports.isMonthArray = void 0;
3
+ exports.getGridProperties = exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.getAllupLegendsProps = exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToLineChartProps = exports.transformPlotlyJsonToAreaChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.resolveXAxisPoint = exports._getGaugeAxisColor = exports.correctYearMonth = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var d3_array_1 = require("d3-array");
6
6
  var d3_scale_1 = require("d3-scale");
@@ -9,9 +9,9 @@ var colors_1 = require("../../utilities/colors");
9
9
  var index_1 = require("../GaugeChart/index");
10
10
  var utilities_1 = require("../../utilities/utilities");
11
11
  var chart_utilities_1 = require("@fluentui/chart-utilities");
12
- var d3_time_format_1 = require("d3-time-format");
13
12
  var d3_shape_1 = require("d3-shape");
14
13
  var PlotlyColorAdapter_1 = require("./PlotlyColorAdapter");
14
+ var d3_color_1 = require("d3-color");
15
15
  var dashOptions = {
16
16
  dot: {
17
17
  strokeDasharray: '1, 5',
@@ -50,17 +50,6 @@ var dashOptions = {
50
50
  lineBorderWidth: '4',
51
51
  },
52
52
  };
53
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
54
- var isMonth = function (possiblyMonthValue) {
55
- var parseFullMonth = (0, d3_time_format_1.timeParse)('%B');
56
- var parseShortMonth = (0, d3_time_format_1.timeParse)('%b');
57
- return parseFullMonth(possiblyMonthValue) !== null || parseShortMonth(possiblyMonthValue) !== null;
58
- };
59
- var isMonthArray = function (data) {
60
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
61
- return (0, chart_utilities_1.isArrayOfType)(data, function (value) { return isMonth(value) || value === null; });
62
- };
63
- exports.isMonthArray = isMonthArray;
64
53
  function getTitles(layout) {
65
54
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
66
55
  var titles = {
@@ -108,8 +97,9 @@ var correctYearMonth = function (xValues) {
108
97
  return xValues;
109
98
  };
110
99
  exports.correctYearMonth = correctYearMonth;
111
- var usesSecondaryYScale = function (series) {
112
- return series.yaxis === 'y2';
100
+ var usesSecondaryYScale = function (series, layout) {
101
+ var _a, _b;
102
+ return series.yaxis === 'y2' && (((_a = layout === null || layout === void 0 ? void 0 : layout.yaxis2) === null || _a === void 0 ? void 0 : _a.anchor) === 'x' || ((_b = layout === null || layout === void 0 ? void 0 : layout.yaxis2) === null || _b === void 0 ? void 0 : _b.side) === 'right');
113
103
  };
114
104
  var getSecondaryYAxisValues = function (data, layout, maxAllowedMinY, minAllowedMaxY) {
115
105
  var _a, _b, _c, _d;
@@ -117,7 +107,7 @@ var getSecondaryYAxisValues = function (data, layout, maxAllowedMinY, minAllowed
117
107
  var yMinValue;
118
108
  var yMaxValue;
119
109
  data.forEach(function (series) {
120
- if (usesSecondaryYScale(series)) {
110
+ if (usesSecondaryYScale(series, layout)) {
121
111
  containsSecondaryYAxis = true;
122
112
  var yValues = series.y;
123
113
  if (yValues) {
@@ -176,7 +166,7 @@ var resolveXAxisPoint = function (x, isXYearCategory, isXString, isXDate, isXNum
176
166
  return x;
177
167
  };
178
168
  exports.resolveXAxisPoint = resolveXAxisPoint;
179
- var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, isDarkTheme) {
169
+ var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
180
170
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
181
171
  var firstData = input.data[0];
182
172
  // extract colors for each series only once
@@ -229,13 +219,13 @@ var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, i
229
219
  };
230
220
  };
231
221
  exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
232
- var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
222
+ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
233
223
  var _a, _b, _c;
234
224
  var mapXToDataPoints = {};
235
225
  var yMaxValue = 0;
236
226
  var yMinValue = 0;
237
227
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
238
- var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
228
+ var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
239
229
  var colorScale = undefined;
240
230
  input.data.forEach(function (series, index1) {
241
231
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
@@ -252,7 +242,7 @@ var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayType, is
252
242
  var extractedLineColors = (0, PlotlyColorAdapter_1.extractColor)((_p = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.template) === null || _o === void 0 ? void 0 : _o.layout) === null || _p === void 0 ? void 0 : _p.colorway, colorwayType, (_q = series.line) === null || _q === void 0 ? void 0 : _q.color, colorMap, isDarkTheme);
253
243
  var xValues = series.x;
254
244
  var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
255
- var isXString = (0, exports.isStringArray)(xValues);
245
+ var isXString = (0, chart_utilities_1.isStringArray)(xValues);
256
246
  var isXNumber = (0, chart_utilities_1.isNumberArray)(xValues);
257
247
  var validXYRanges = (0, exports.getValidXYRanges)(series);
258
248
  validXYRanges.forEach(function (_a, rangeIdx) {
@@ -275,12 +265,13 @@ var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayType, is
275
265
  ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index2 % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
276
266
  : 0)
277
267
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
268
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index2);
278
269
  var yVal = rangeYValues[index2];
279
270
  if (series.type === 'bar') {
280
271
  mapXToDataPoints[x].chartData.push({
281
272
  legend: legend,
282
273
  data: yVal,
283
- color: color,
274
+ color: (_e = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color,
284
275
  });
285
276
  if (typeof yVal === 'number') {
286
277
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -289,21 +280,16 @@ var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayType, is
289
280
  else if (series.type === 'scatter' || !!fallbackVSBC) {
290
281
  var lineColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
291
282
  var lineOptions = getLineOptions(series.line);
292
- var dashType = ((_e = series.line) === null || _e === void 0 ? void 0 : _e.dash) || 'solid';
293
- var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot'
294
- ? 'dottedLine'
295
- : ((_f = series.mode) === null || _f === void 0 ? void 0 : _f.includes('markers'))
296
- ? 'circle'
297
- : 'default';
283
+ var legendShape = getLegendShape(series);
298
284
  mapXToDataPoints[x].lineData.push({
299
285
  legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
300
286
  legendShape: legendShape,
301
287
  y: yVal,
302
- color: lineColor,
288
+ color: (_f = (0, d3_color_1.rgb)(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
303
289
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
304
- useSecondaryYScale: usesSecondaryYScale(series),
290
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
305
291
  });
306
- if (!usesSecondaryYScale(series) && typeof yVal === 'number') {
292
+ if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
307
293
  yMaxValue = Math.max(yMaxValue, yVal);
308
294
  yMinValue = Math.min(yMinValue, yVal);
309
295
  }
@@ -312,7 +298,7 @@ var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayType, is
312
298
  });
313
299
  });
314
300
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
315
- return tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), 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, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true });
301
+ return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), 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, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true }), getAxisCategoryOrderProps(input.data, input.layout));
316
302
  };
317
303
  exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
318
304
  var createColorScale = function (layout, series) {
@@ -331,11 +317,11 @@ var createColorScale = function (layout, series) {
331
317
  var scaleColors = scale.map(function (item) { return item[1]; });
332
318
  return (0, d3_scale_1.scaleLinear)().domain(scaleDomain).range(scaleColors);
333
319
  };
334
- var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
320
+ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
335
321
  var _a, _b, _c;
336
322
  var mapXToDataPoints = {};
337
323
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
338
- var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
324
+ var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
339
325
  var colorScale = undefined;
340
326
  input.data.forEach(function (series, index1) {
341
327
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
@@ -348,7 +334,7 @@ var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, is
348
334
  // extract colors for each series only once
349
335
  var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, colorwayType, (_l = series.marker) === null || _l === void 0 ? void 0 : _l.color, colorMap, isDarkTheme);
350
336
  (_m = series.x) === null || _m === void 0 ? void 0 : _m.forEach(function (x, xIndex) {
351
- var _a, _b, _c, _d, _e;
337
+ var _a, _b, _c, _d, _e, _f;
352
338
  if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
353
339
  return;
354
340
  }
@@ -362,26 +348,27 @@ var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, is
362
348
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
363
349
  ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[xIndex % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
364
350
  : 0)
365
- : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
351
+ : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, xIndex, legend, colorMap, isDarkTheme);
352
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, xIndex);
366
353
  mapXToDataPoints[x].series.push({
367
354
  key: legend,
368
355
  data: series.y[xIndex],
369
356
  xAxisCalloutData: x,
370
- color: color,
357
+ color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
371
358
  legend: legend,
372
- useSecondaryYScale: usesSecondaryYScale(series),
359
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
373
360
  });
374
361
  }
375
362
  });
376
363
  });
377
364
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
378
- return tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), 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', chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true });
365
+ return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), 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', chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true }), getAxisCategoryOrderProps(input.data, input.layout));
379
366
  };
380
367
  exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
381
- var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
368
+ var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
382
369
  var _a, _b, _c;
383
370
  var vbcData = [];
384
- var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
371
+ var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
385
372
  var colorScale = undefined;
386
373
  input.data.forEach(function (series, seriesIdx) {
387
374
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
@@ -406,7 +393,7 @@ var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayType, isD
406
393
  xValues.push(xVal);
407
394
  yValues.push(yVal);
408
395
  });
409
- var isXString = (0, exports.isStringArray)(xValues);
396
+ var isXString = (0, chart_utilities_1.isStringArray)(xValues);
410
397
  // TODO: In case of a single bin, add an empty bin of the same size to prevent the
411
398
  // default bar width from being used and ensure the bar spans the full intended range.
412
399
  var xBins = createBins(xValues, (_m = series.xbins) === null || _m === void 0 ? void 0 : _m.start, (_o = series.xbins) === null || _o === void 0 ? void 0 : _o.end, (_p = series.xbins) === null || _p === void 0 ? void 0 : _p.size);
@@ -424,7 +411,7 @@ var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayType, isD
424
411
  return yVal;
425
412
  });
426
413
  xBins.forEach(function (bin, index) {
427
- var _a, _b, _c, _d;
414
+ var _a, _b, _c, _d, _e;
428
415
  var legend = legends[seriesIdx];
429
416
  // resolve color for each legend's bars from the colorscale or extracted colors
430
417
  var color = colorScale
@@ -432,37 +419,47 @@ var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayType, isD
432
419
  ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
433
420
  : 0)
434
421
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
422
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
435
423
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
436
- vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
424
+ vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (_e = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color }, (isXString
437
425
  ? {}
438
426
  : { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
439
427
  });
440
428
  });
441
429
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
442
- return {
443
- data: vbcData,
444
- width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width,
445
- height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350,
446
- supportNegativeData: true,
447
- chartTitle: chartTitle,
448
- xAxisTitle: xAxisTitle,
449
- yAxisTitle: yAxisTitle,
450
- mode: 'histogram',
451
- hideTickOverlap: true,
452
- maxBarWidth: 50,
453
- hideLegend: hideLegend,
454
- roundCorners: true,
455
- };
430
+ return tslib_1.__assign({ data: vbcData, 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, supportNegativeData: true, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'histogram', hideTickOverlap: true, maxBarWidth: 50, hideLegend: hideLegend, roundCorners: true }, getAxisCategoryOrderProps(input.data, input.layout));
456
431
  };
457
432
  exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
458
- var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, isScatterMarkers, colorMap, colorwayType, isDarkTheme) {
459
- var _a, _b, _c, _d, _e, _f;
433
+ var transformPlotlyJsonToAreaChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
434
+ return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'area', colorMap, colorwayType, isDarkTheme);
435
+ };
436
+ exports.transformPlotlyJsonToAreaChartProps = transformPlotlyJsonToAreaChartProps;
437
+ var transformPlotlyJsonToLineChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
438
+ return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'line', colorMap, colorwayType, isDarkTheme);
439
+ };
440
+ exports.transformPlotlyJsonToLineChartProps = transformPlotlyJsonToLineChartProps;
441
+ var transformPlotlyJsonToScatterChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
442
+ return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
443
+ };
444
+ exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
445
+ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
446
+ var _a, _b, _c, _d, _e, _f, _g;
447
+ var isScatterMarkers = [
448
+ 'markers',
449
+ 'text+markers',
450
+ 'markers+text',
451
+ 'lines+markers',
452
+ 'markers+line',
453
+ 'text+lines+markers',
454
+ ].includes((_a = input.data[0]) === null || _a === void 0 ? void 0 : _a.mode);
455
+ var isAreaChart = chartType === 'area';
456
+ var isScatterChart = chartType === 'scatter';
460
457
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
461
458
  var mode = 'tonexty';
462
- var _g = getLegendProps(input.data, input.layout), legends = _g.legends, hideLegend = _g.hideLegend;
459
+ var _h = getLegendProps(input.data, input.layout, isMultiPlot), legends = _h.legends, hideLegend = _h.hideLegend;
463
460
  var chartData = input.data
464
461
  .map(function (series, index) {
465
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
462
+ var _a, _b, _c, _d, _e, _f, _g;
466
463
  var colors = isScatterMarkers
467
464
  ? ((_a = series === null || series === void 0 ? void 0 : series.mode) === null || _a === void 0 ? void 0 : _a.includes('line'))
468
465
  ? (_b = series.line) === null || _b === void 0 ? void 0 : _b.color
@@ -471,25 +468,20 @@ var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, isSca
471
468
  // extract colors for each series only once
472
469
  var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, colorwayType, colors, colorMap, isDarkTheme);
473
470
  var xValues = series.x;
474
- var isXString = (0, exports.isStringArray)(xValues);
471
+ var isXString = (0, chart_utilities_1.isStringArray)(xValues);
475
472
  var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
476
473
  var isXNumber = (0, chart_utilities_1.isNumberArray)(xValues);
477
- // string case is not possible for scatter chart as it is already filtered out in declarative chart
478
- var isXYearCategory = false;
474
+ var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
479
475
  var legend = legends[index];
480
476
  // resolve color for each legend's lines from the extracted colors
481
477
  var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
478
+ var seriesOpacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
482
479
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
483
480
  var lineOptions = getLineOptions(series.line);
484
- var dashType = ((_h = series.line) === null || _h === void 0 ? void 0 : _h.dash) || 'solid';
485
- var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot'
486
- ? 'dottedLine'
487
- : ((_j = series.mode) === null || _j === void 0 ? void 0 : _j.includes('markers'))
488
- ? 'circle'
489
- : 'default';
481
+ var legendShape = getLegendShape(series);
490
482
  var validXYRanges = (0, exports.getValidXYRanges)(series);
491
483
  return validXYRanges.map(function (_a, rangeIdx) {
492
- var _b;
484
+ var _b, _c;
493
485
  var rangeStart = _a[0], rangeEnd = _a[1];
494
486
  var rangeXValues = xValues.slice(rangeStart, rangeEnd);
495
487
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
@@ -508,31 +500,34 @@ var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, isSca
508
500
  ? { markerSize: series.marker.size }
509
501
  : {})), (textValues ? { text: textValues[i] } : {})));
510
502
  }),
511
- color: seriesColor,
503
+ color: (_c = (0, d3_color_1.rgb)(seriesColor).copy({ opacity: seriesOpacity }).formatHex8()) !== null && _c !== void 0 ? _c : seriesColor,
512
504
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
513
- useSecondaryYScale: usesSecondaryYScale(series),
505
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
514
506
  };
515
507
  });
516
508
  })
517
509
  .flat();
518
510
  var yMinMaxValues = (0, utilities_1.findNumericMinMaxOfY)(chartData);
519
- var _h = getTitles(input.layout), chartTitle = _h.chartTitle, xAxisTitle = _h.xAxisTitle, yAxisTitle = _h.yAxisTitle;
511
+ var _j = getTitles(input.layout), chartTitle = _j.chartTitle, xAxisTitle = _j.xAxisTitle, yAxisTitle = _j.yAxisTitle;
520
512
  var numDataPoints = chartData.reduce(function (total, lineChartPoints) { return total + lineChartPoints.data.length; }, 0);
521
513
  var chartProps = {
522
514
  chartTitle: chartTitle,
523
515
  lineChartData: chartData,
524
516
  };
517
+ var scatterChartProps = {
518
+ chartTitle: chartTitle,
519
+ scatterChartData: chartData,
520
+ };
525
521
  if (isAreaChart) {
526
- return tslib_1.__assign(tslib_1.__assign({ data: chartProps, supportNegativeData: true, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle }, secondaryYAxisValues), { mode: mode, 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, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000 });
522
+ return tslib_1.__assign(tslib_1.__assign({ data: chartProps, supportNegativeData: true, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle }, secondaryYAxisValues), { mode: mode, width: (_b = input.layout) === null || _b === void 0 ? void 0 : _b.width, height: (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 350, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000 });
527
523
  }
528
524
  else {
529
- return tslib_1.__assign(tslib_1.__assign({ data: chartProps, supportNegativeData: true, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle }, secondaryYAxisValues), { roundedTicks: true, yMinValue: yMinMaxValues.startValue, yMaxValue: yMinMaxValues.endValue, width: (_d = input.layout) === null || _d === void 0 ? void 0 : _d.width, height: (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : 350, hideTickOverlap: true, enableReflow: false, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000 });
525
+ return tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, supportNegativeData: true, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle }, secondaryYAxisValues), { roundedTicks: true, yMinValue: yMinMaxValues.startValue, yMaxValue: yMinMaxValues.endValue, width: (_e = input.layout) === null || _e === void 0 ? void 0 : _e.width, height: (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : 350, hideTickOverlap: true, enableReflow: false, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000 });
530
526
  }
531
527
  };
532
- exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
533
- var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, colorwayType, isDarkTheme) {
528
+ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
534
529
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
535
- var _s = getLegendProps(input.data, input.layout), legends = _s.legends, hideLegend = _s.hideLegend;
530
+ var _s = getLegendProps(input.data, input.layout, isMultiPlot), legends = _s.legends, hideLegend = _s.hideLegend;
536
531
  var colorScale = undefined;
537
532
  var chartData = input.data
538
533
  .map(function (series, index) {
@@ -548,7 +543,7 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap,
548
543
  var legend = legends[index];
549
544
  return series.y
550
545
  .map(function (yValue, i) {
551
- var _a, _b, _c, _d, _e;
546
+ var _a, _b, _c, _d, _e, _f;
552
547
  if ((0, chart_utilities_1.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, chart_utilities_1.isInvalidValue)(yValue)) {
553
548
  return null;
554
549
  }
@@ -558,19 +553,17 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap,
558
553
  ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[i % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
559
554
  : 0)
560
555
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
556
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
561
557
  return {
562
558
  x: series.x[i],
563
559
  y: yValue,
564
560
  legend: legend,
565
- color: color,
561
+ color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
566
562
  };
567
563
  })
568
564
  .filter(function (point) { return point !== null; });
569
565
  })
570
- .reverse()
571
- .flat()
572
- //reversing the order to invert the Y bars order as required by plotly.
573
- .reverse();
566
+ .flat();
574
567
  var chartHeight = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 450;
575
568
  var margin = (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.margin) === null || _d === void 0 ? void 0 : _d.l) !== null && _e !== void 0 ? _e : 0;
576
569
  var padding = (_h = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.margin) === null || _g === void 0 ? void 0 : _g.pad) !== null && _h !== void 0 ? _h : 0;
@@ -580,27 +573,12 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap,
580
573
  var gapFactor = 1 / (1 + scalingFactor * numberOfRows);
581
574
  var barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
582
575
  var _t = getTitles(input.layout), chartTitle = _t.chartTitle, xAxisTitle = _t.xAxisTitle, yAxisTitle = _t.yAxisTitle;
583
- return {
584
- data: chartData,
585
- chartTitle: chartTitle,
586
- xAxisTitle: xAxisTitle,
587
- yAxisTitle: yAxisTitle,
588
- secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
576
+ return tslib_1.__assign({ data: chartData, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
589
577
  ? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
590
- : ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '',
591
- barHeight: barHeight,
592
- showYAxisLables: true,
593
- height: chartHeight,
594
- width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width,
595
- hideTickOverlap: true,
596
- hideLegend: hideLegend,
597
- noOfCharsToTruncate: 20,
598
- showYAxisLablesTooltip: true,
599
- roundCorners: true,
600
- };
578
+ : ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '', barHeight: barHeight, showYAxisLables: true, height: chartHeight, width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true }, getAxisCategoryOrderProps(input.data, input.layout));
601
579
  };
602
580
  exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
603
- var transformPlotlyJsonToHeatmapProps = function (input) {
581
+ var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
604
582
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
605
583
  var firstData = input.data[0];
606
584
  var heatmapDataPoints = [];
@@ -620,8 +598,8 @@ var transformPlotlyJsonToHeatmapProps = function (input) {
620
598
  yValues_1.push(firstData.y[index]);
621
599
  zValues_1.push(zVal);
622
600
  });
623
- var isXString_1 = (0, exports.isStringArray)(xValues_1);
624
- var isYString_1 = (0, exports.isStringArray)(yValues_1);
601
+ var isXString_1 = (0, chart_utilities_1.isStringArray)(xValues_1);
602
+ var isYString_1 = (0, chart_utilities_1.isStringArray)(yValues_1);
625
603
  var xBins_1 = createBins(xValues_1, (_b = firstData.xbins) === null || _b === void 0 ? void 0 : _b.start, (_c = firstData.xbins) === null || _c === void 0 ? void 0 : _c.end, (_d = firstData.xbins) === null || _d === void 0 ? void 0 : _d.size);
626
604
  var yBins_1 = createBins(yValues_1, (_e = firstData.ybins) === null || _e === void 0 ? void 0 : _e.start, (_f = firstData.ybins) === null || _f === void 0 ? void 0 : _f.end, (_g = firstData.ybins) === null || _g === void 0 ? void 0 : _g.size);
627
605
  var zBins_1 = yBins_1.map(function () { return xBins_1.map(function () { return []; }); });
@@ -713,25 +691,10 @@ var transformPlotlyJsonToHeatmapProps = function (input) {
713
691
  ? colorscale.map(function (arr) { return arr[1]; })
714
692
  : defaultRange;
715
693
  var _9 = getTitles(input.layout), chartTitle = _9.chartTitle, xAxisTitle = _9.xAxisTitle, yAxisTitle = _9.yAxisTitle;
716
- return {
717
- data: [heatmapData],
718
- domainValuesForColorScale: domainValuesForColorScale,
719
- rangeValuesForColorScale: rangeValuesForColorScale,
720
- hideLegend: true,
721
- showYAxisLables: true,
722
- chartTitle: chartTitle,
723
- xAxisTitle: xAxisTitle,
724
- yAxisTitle: yAxisTitle,
725
- sortOrder: 'none',
726
- width: (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.width,
727
- height: (_8 = (_7 = input.layout) === null || _7 === void 0 ? void 0 : _7.height) !== null && _8 !== void 0 ? _8 : 350,
728
- hideTickOverlap: true,
729
- noOfCharsToTruncate: 20,
730
- showYAxisLablesTooltip: true,
731
- };
694
+ return tslib_1.__assign({ data: [heatmapData], domainValuesForColorScale: domainValuesForColorScale, rangeValuesForColorScale: rangeValuesForColorScale, hideLegend: true, showYAxisLables: true, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, sortOrder: 'none', width: (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.width, height: (_8 = (_7 = input.layout) === null || _7 === void 0 ? void 0 : _7.height) !== null && _8 !== void 0 ? _8 : 350, hideTickOverlap: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true }, getAxisCategoryOrderProps([firstData], input.layout));
732
695
  };
733
696
  exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
734
- var transformPlotlyJsonToSankeyProps = function (input, colorMap, colorwayType, isDarkTheme) {
697
+ var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
735
698
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
736
699
  var _m = input.data[0], link = _m.link, node = _m.node;
737
700
  var validLinks = ((_a = link === null || link === void 0 ? void 0 : link.value) !== null && _a !== void 0 ? _a : [])
@@ -779,7 +742,7 @@ var transformPlotlyJsonToSankeyProps = function (input, colorMap, colorwayType,
779
742
  };
780
743
  };
781
744
  exports.transformPlotlyJsonToSankeyProps = transformPlotlyJsonToSankeyProps;
782
- var transformPlotlyJsonToGaugeProps = function (input, colorMap, colorwayType, isDarkTheme) {
745
+ var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
783
746
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
784
747
  var firstData = input.data[0];
785
748
  var stepsColors = ((_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) ? firstData.gauge.steps.map(function (step) { return step.color; }) : undefined;
@@ -879,7 +842,7 @@ var formatValue = function (value, colIndex, cells) {
879
842
  }
880
843
  return "".concat(prefix !== null && prefix !== void 0 ? prefix : '').concat(formatted).concat(suffix !== null && suffix !== void 0 ? suffix : '');
881
844
  };
882
- var transformPlotlyJsonToChartTableProps = function (input, colorMap, isDarkTheme) {
845
+ var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
883
846
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
884
847
  var tableData = input.data[0];
885
848
  var normalizeHeaders = function (values, header) {
@@ -1085,12 +1048,6 @@ function getLineOptions(line) {
1085
1048
  }
1086
1049
  return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
1087
1050
  }
1088
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1089
- var isStringArray = function (arr) {
1090
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1091
- return (0, chart_utilities_1.isArrayOfType)(arr, function (value) { return typeof value === 'string' || value === null; });
1092
- };
1093
- exports.isStringArray = isStringArray;
1094
1051
  // TODO: Use binary search to find the appropriate bin for numeric value.
1095
1052
  var findBinIndex = function (bins, value, isString) {
1096
1053
  if (typeof value === 'undefined' || value === null) {
@@ -1114,7 +1071,7 @@ var createBins = function (data, binStart, binEnd, binSize) {
1114
1071
  if (!data || data.length === 0) {
1115
1072
  return [];
1116
1073
  }
1117
- if ((0, exports.isStringArray)(data)) {
1074
+ if ((0, chart_utilities_1.isStringArray)(data)) {
1118
1075
  var categories_1 = Array.from(new Set(data));
1119
1076
  var start = typeof binStart === 'number' ? Math.ceil(binStart) : 0;
1120
1077
  var stop_1 = typeof binEnd === 'number' ? Math.floor(binEnd) + 1 : categories_1.length;
@@ -1185,7 +1142,48 @@ var precisionRound = function (value, precision) {
1185
1142
  var factor = Math.pow(10, precision);
1186
1143
  return Math.round(value * factor) / factor;
1187
1144
  };
1188
- var getLegendProps = function (data, layout) {
1145
+ var getLegendShape = function (series) {
1146
+ var _a, _b;
1147
+ var dashType = ((_a = series.line) === null || _a === void 0 ? void 0 : _a.dash) || 'solid';
1148
+ if (dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot') {
1149
+ return 'dottedLine';
1150
+ }
1151
+ else if ((_b = series.mode) === null || _b === void 0 ? void 0 : _b.includes('markers')) {
1152
+ return 'circle';
1153
+ }
1154
+ return 'default';
1155
+ };
1156
+ var getAllupLegendsProps = function (input, colorMap, colorwayType, isDarkTheme) {
1157
+ var allupLegends = [];
1158
+ // reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
1159
+ var toShowLegend = input.data.reduce(function (acc, series) {
1160
+ return acc || series.showlegend === true;
1161
+ }, false);
1162
+ if (toShowLegend) {
1163
+ input.data.forEach(function (series, index) {
1164
+ var _a, _b, _c, _d, _e;
1165
+ var name = series.legendgroup;
1166
+ var color = ((_a = series.line) === null || _a === void 0 ? void 0 : _a.color) || ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color);
1167
+ var legendShape = getLegendShape(series);
1168
+ var resolvedColor = (0, PlotlyColorAdapter_1.extractColor)((_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, colorwayType, color, colorMap, isDarkTheme);
1169
+ if (name !== undefined && allupLegends.some(function (group) { return group.title === name; }) === false) {
1170
+ allupLegends.push({
1171
+ title: name,
1172
+ color: resolvedColor,
1173
+ shape: legendShape,
1174
+ });
1175
+ }
1176
+ });
1177
+ }
1178
+ return {
1179
+ legends: allupLegends,
1180
+ centerLegends: true,
1181
+ enabledWrapLines: true,
1182
+ canSelectMultipleLegends: true,
1183
+ };
1184
+ };
1185
+ exports.getAllupLegendsProps = getAllupLegendsProps;
1186
+ var getLegendProps = function (data, layout, isMultiPlot) {
1189
1187
  var legends = [];
1190
1188
  if (data.length === 1) {
1191
1189
  legends.push(data[0].name || '');
@@ -1195,10 +1193,11 @@ var getLegendProps = function (data, layout) {
1195
1193
  legends.push(series.name || "Series ".concat(index + 1));
1196
1194
  });
1197
1195
  }
1198
- var hideLegends = data.every(function (series) { return series.showlegend === false; });
1196
+ var hideLegendsData = data.every(function (series) { return series.showlegend === false; });
1197
+ var hideLegendsInferred = (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false || ((layout === null || layout === void 0 ? void 0 : layout.showlegend) !== true && legends.length < 2);
1199
1198
  return {
1200
1199
  legends: legends,
1201
- hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false || ((layout === null || layout === void 0 ? void 0 : layout.showlegend) !== true && legends.length < 2) ? true : hideLegends,
1200
+ hideLegend: isMultiPlot || hideLegendsInferred || hideLegendsData,
1202
1201
  };
1203
1202
  };
1204
1203
  var getNumberAtIndexOrDefault = function (data, index) {
@@ -1232,4 +1231,198 @@ var getValidXYRanges = function (series) {
1232
1231
  return ranges;
1233
1232
  };
1234
1233
  exports.getValidXYRanges = getValidXYRanges;
1234
+ var getIndexFromKey = function (key, pattern) {
1235
+ var normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
1236
+ return parseInt(normalizedKey, 10) - 1;
1237
+ };
1238
+ var getGridProperties = function (layout, isMultiPlot) {
1239
+ var _a;
1240
+ var gridX = [];
1241
+ var gridY = [];
1242
+ var annotations = {};
1243
+ var templateRows = '1fr';
1244
+ var templateColumns = '1fr';
1245
+ var gridLayout = {};
1246
+ if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
1247
+ return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
1248
+ }
1249
+ if (!layout.xaxis || !layout.yaxis) {
1250
+ return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
1251
+ }
1252
+ if (!isMultiPlot) {
1253
+ return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
1254
+ }
1255
+ Object.keys(layout).forEach(function (key) {
1256
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1257
+ if (key.startsWith('xaxis')) {
1258
+ var index = getIndexFromKey(key, 'xaxis');
1259
+ var anchor = (_b = (_a = layout[key]) === null || _a === void 0 ? void 0 : _a.anchor) !== null && _b !== void 0 ? _b : 'y';
1260
+ var anchorIndex = getIndexFromKey(anchor, 'y');
1261
+ if (index !== anchorIndex) {
1262
+ throw new Error("Invalid layout: xaxis ".concat(index + 1, " anchor should be y").concat(anchorIndex + 1));
1263
+ }
1264
+ gridX[index] = (_d = (_c = layout[key]) === null || _c === void 0 ? void 0 : _c.domain) !== null && _d !== void 0 ? _d : [];
1265
+ }
1266
+ else if (key.startsWith('yaxis')) {
1267
+ var index = getIndexFromKey(key, 'yaxis');
1268
+ var anchor = (_f = (_e = layout[key]) === null || _e === void 0 ? void 0 : _e.anchor) !== null && _f !== void 0 ? _f : 'x';
1269
+ var anchorIndex = getIndexFromKey(anchor, 'x');
1270
+ if (index !== anchorIndex) {
1271
+ if ((index === 1 && anchorIndex === 0) || ((_g = layout.yaxis2) === null || _g === void 0 ? void 0 : _g.side) === 'right') {
1272
+ // Special case for secondary y axis where yaxis2 can anchor to x1
1273
+ return { templateRows: templateRows, templateColumns: templateColumns };
1274
+ }
1275
+ throw new Error("Invalid layout: yaxis ".concat(index + 1, " anchor should be x").concat(anchorIndex + 1));
1276
+ }
1277
+ gridY[index] = (_j = (_h = layout[key]) === null || _h === void 0 ? void 0 : _h.domain) !== null && _j !== void 0 ? _j : [];
1278
+ }
1279
+ });
1280
+ (_a = layout.annotations) === null || _a === void 0 ? void 0 : _a.forEach(function (annotation) {
1281
+ var xMatches = gridX.flatMap(function (interval, idx) {
1282
+ return (annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval[1] ? [idx] : [];
1283
+ });
1284
+ var yMatch = gridY.findIndex(function (interval, yIndex) {
1285
+ return xMatches.includes(yIndex) &&
1286
+ (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval[0] &&
1287
+ (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval[1];
1288
+ });
1289
+ if (yMatch !== -1) {
1290
+ if (annotations[yMatch] === undefined) {
1291
+ annotations[yMatch] = {};
1292
+ }
1293
+ if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1294
+ annotations[yMatch].yAnnotation = annotation.text;
1295
+ }
1296
+ else {
1297
+ annotations[yMatch].xAnnotation = annotation.text;
1298
+ }
1299
+ }
1300
+ });
1301
+ if (gridX.length > 0) {
1302
+ var uniqueXIntervals_1 = new Map();
1303
+ gridX.forEach(function (interval) {
1304
+ var key = "".concat(interval[0], "-").concat(interval[1]);
1305
+ if (!uniqueXIntervals_1.has(key)) {
1306
+ uniqueXIntervals_1.set(key, interval);
1307
+ }
1308
+ });
1309
+ var minXInterval_1 = Math.min.apply(Math, Array.from(uniqueXIntervals_1.values()).map(function (interval) { return interval[1] - interval[0]; }));
1310
+ templateColumns = Array.from(uniqueXIntervals_1.values())
1311
+ .map(function (interval) { return "".concat((interval[1] - interval[0]) / minXInterval_1, "fr"); })
1312
+ .join(' ');
1313
+ var columnNumber_1 = 1;
1314
+ var lastIntervalEnd_1 = 0;
1315
+ gridX.forEach(function (interval, index) {
1316
+ if (interval.length === 0) {
1317
+ return;
1318
+ }
1319
+ var cellName = "x".concat(index === 0 ? '' : index + 1);
1320
+ var annotationProps = annotations[index];
1321
+ var xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
1322
+ if (interval[0] < lastIntervalEnd_1) {
1323
+ columnNumber_1 = 1;
1324
+ }
1325
+ lastIntervalEnd_1 = interval[1];
1326
+ var row = {
1327
+ row: -1,
1328
+ column: columnNumber_1,
1329
+ xAnnotation: xAnnotation,
1330
+ };
1331
+ gridLayout[cellName] = row;
1332
+ columnNumber_1 += 1;
1333
+ });
1334
+ }
1335
+ var numColumns = Math.max.apply(Math, Object.values(gridLayout).map(function (cell) { var _a; return (_a = cell.column) !== null && _a !== void 0 ? _a : 0; }));
1336
+ var columnFill = {};
1337
+ for (var i = 1; i <= numColumns; i++) {
1338
+ columnFill[i] = { row: 1, fillDomain: 0 };
1339
+ }
1340
+ if (gridY.length > 0) {
1341
+ var uniqueYIntervals_1 = new Map();
1342
+ gridY.forEach(function (interval) {
1343
+ var key = "".concat(interval[0], "-").concat(interval[1]);
1344
+ if (!uniqueYIntervals_1.has(key)) {
1345
+ uniqueYIntervals_1.set(key, interval);
1346
+ }
1347
+ });
1348
+ var minYInterval_1 = Math.min.apply(Math, Array.from(uniqueYIntervals_1.values()).map(function (interval) { return interval[1] - interval[0]; }));
1349
+ templateRows = Array.from(uniqueYIntervals_1.values())
1350
+ .map(function (interval) { return "".concat((interval[1] - interval[0]) / minYInterval_1, "fr"); })
1351
+ .join(' ');
1352
+ gridY.forEach(function (interval, index) {
1353
+ if (interval.length === 0) {
1354
+ return;
1355
+ }
1356
+ var cellName = "x".concat(index === 0 ? '' : index + 1);
1357
+ var annotationProps = annotations[index];
1358
+ var yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
1359
+ var cell = gridLayout[cellName];
1360
+ if (cell !== undefined) {
1361
+ cell.row = columnFill[cell.column].row;
1362
+ cell.yAnnotation = yAnnotation;
1363
+ }
1364
+ columnFill[cell.column].fillDomain = interval[1];
1365
+ columnFill[cell.column].row += 1;
1366
+ });
1367
+ }
1368
+ // reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
1369
+ var reversedGridLayout = {};
1370
+ // find the maximum row number
1371
+ var maxRowNumber = Math.max.apply(Math, Object.values(gridLayout).map(function (cell) { var _a; return (_a = cell.row) !== null && _a !== void 0 ? _a : 0; }));
1372
+ // iterate over the gridLayout and reverse the row numbers
1373
+ Object.keys(gridLayout).forEach(function (key) {
1374
+ var cell = gridLayout[key];
1375
+ if (cell.row !== undefined) {
1376
+ // reverse the row number
1377
+ cell.row = maxRowNumber - cell.row + 1;
1378
+ }
1379
+ reversedGridLayout[key] = cell;
1380
+ });
1381
+ return {
1382
+ templateRows: templateRows,
1383
+ templateColumns: templateColumns,
1384
+ layout: reversedGridLayout,
1385
+ };
1386
+ };
1387
+ exports.getGridProperties = getGridProperties;
1388
+ /**
1389
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
1390
+ */
1391
+ var getAxisCategoryOrderProps = function (data, layout) {
1392
+ var result = {};
1393
+ var axesById = {
1394
+ x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
1395
+ y: layout === null || layout === void 0 ? void 0 : layout.yaxis,
1396
+ };
1397
+ Object.keys(axesById).forEach(function (axId) {
1398
+ var ax = axesById[axId];
1399
+ var axLetter = axId[0];
1400
+ var propName = "".concat(axLetter, "AxisCategoryOrder");
1401
+ var values = [];
1402
+ data.forEach(function (series) {
1403
+ var _a;
1404
+ (_a = series[axLetter]) === null || _a === void 0 ? void 0 : _a.forEach(function (val) {
1405
+ if (!(0, chart_utilities_1.isInvalidValue)(val)) {
1406
+ values.push(val);
1407
+ }
1408
+ });
1409
+ });
1410
+ var isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || ((0, chart_utilities_1.isStringArray)(values) && !(0, chart_utilities_1.isNumberArray)(values) && !(0, chart_utilities_1.isDateArray)(values));
1411
+ if (!isAxisTypeCategory) {
1412
+ return;
1413
+ }
1414
+ var isValidArray = (0, chart_utilities_1.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
1415
+ if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
1416
+ result[propName] = ax.categoryarray;
1417
+ return;
1418
+ }
1419
+ if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1420
+ var categoriesInTraceOrder = Array.from(new Set(values));
1421
+ result[propName] = categoriesInTraceOrder;
1422
+ return;
1423
+ }
1424
+ result[propName] = ax.categoryorder;
1425
+ });
1426
+ return result;
1427
+ };
1235
1428
  //# sourceMappingURL=PlotlySchemaAdapter.js.map