@fluentui/react-charting 5.24.3 → 5.24.5

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 (170) hide show
  1. package/CHANGELOG.json +85 -1
  2. package/CHANGELOG.md +29 -2
  3. package/config/tests.js +0 -12
  4. package/dist/react-charting.d.ts +38 -1
  5. package/dist/react-charting.js +1 -1
  6. package/dist/react-charting.min.js +1 -1
  7. package/etc/react-charting.api.md +8 -1
  8. package/lib/components/AreaChart/AreaChart.base.d.ts +1 -0
  9. package/lib/components/AreaChart/AreaChart.base.js +4 -1
  10. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  11. package/lib/components/CommonComponents/CartesianChart.base.js +14 -13
  12. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  13. package/lib/components/CommonComponents/CartesianChart.styles.js +41 -37
  14. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  15. package/lib/components/CommonComponents/CartesianChart.types.d.ts +12 -2
  16. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  17. package/lib/components/DeclarativeChart/DeclarativeChart.js +38 -16
  18. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  19. package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  20. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +9 -1
  21. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  22. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -3
  23. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +276 -199
  24. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  25. package/lib/components/DonutChart/DonutChart.base.js +1 -0
  26. package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
  27. package/lib/components/DonutChart/DonutChart.styles.js +18 -0
  28. package/lib/components/DonutChart/DonutChart.styles.js.map +1 -1
  29. package/lib/components/DonutChart/DonutChart.types.d.ts +4 -0
  30. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  31. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
  32. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +25 -4
  33. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  34. package/lib/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
  35. package/lib/components/HeatMapChart/HeatMapChart.base.js +95 -37
  36. package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  37. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
  38. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +24 -3
  39. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  40. package/lib/components/ScatterChart/ScatterChart.base.js +84 -55
  41. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  42. package/lib/components/ScatterChart/ScatterChart.styles.js +12 -0
  43. package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -1
  44. package/lib/components/ScatterChart/ScatterChart.types.d.ts +5 -0
  45. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  46. package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  47. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +30 -7
  48. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  49. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  50. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +51 -32
  51. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  52. package/lib/index.d.ts +1 -1
  53. package/lib/index.js.map +1 -1
  54. package/lib/types/IDataPoint.d.ts +18 -0
  55. package/lib/types/IDataPoint.js.map +1 -1
  56. package/lib/utilities/SVGTooltipText.js +3 -3
  57. package/lib/utilities/SVGTooltipText.js.map +1 -1
  58. package/lib/utilities/utilities.d.ts +6 -3
  59. package/lib/utilities/utilities.js +58 -29
  60. package/lib/utilities/utilities.js.map +1 -1
  61. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +1 -0
  62. package/lib-amd/components/AreaChart/AreaChart.base.js +4 -1
  63. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  64. package/lib-amd/components/CommonComponents/CartesianChart.base.js +14 -13
  65. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  66. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +41 -37
  67. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  68. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +12 -2
  69. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  70. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +37 -15
  71. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  72. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  73. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
  74. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  75. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -3
  76. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +276 -199
  77. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  78. package/lib-amd/components/DonutChart/DonutChart.base.js +1 -0
  79. package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
  80. package/lib-amd/components/DonutChart/DonutChart.styles.js +17 -1
  81. package/lib-amd/components/DonutChart/DonutChart.styles.js.map +1 -1
  82. package/lib-amd/components/DonutChart/DonutChart.types.d.ts +4 -0
  83. package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
  84. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
  85. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +24 -3
  86. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  87. package/lib-amd/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
  88. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +94 -36
  89. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  90. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
  91. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
  92. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  93. package/lib-amd/components/ScatterChart/ScatterChart.base.js +83 -54
  94. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  95. package/lib-amd/components/ScatterChart/ScatterChart.styles.js +12 -1
  96. package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -1
  97. package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +5 -0
  98. package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
  99. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  100. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +29 -6
  101. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  102. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  103. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +50 -31
  104. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  105. package/lib-amd/index.d.ts +1 -1
  106. package/lib-amd/index.js.map +1 -1
  107. package/lib-amd/types/IDataPoint.d.ts +18 -0
  108. package/lib-amd/types/IDataPoint.js.map +1 -1
  109. package/lib-amd/utilities/SVGTooltipText.js +3 -3
  110. package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
  111. package/lib-amd/utilities/utilities.d.ts +6 -3
  112. package/lib-amd/utilities/utilities.js +59 -30
  113. package/lib-amd/utilities/utilities.js.map +1 -1
  114. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +1 -0
  115. package/lib-commonjs/components/AreaChart/AreaChart.base.js +4 -1
  116. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  117. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +14 -13
  118. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  119. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +41 -37
  120. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  121. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +12 -2
  122. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  123. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +37 -15
  124. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  125. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  126. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
  127. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  128. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -3
  129. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +276 -198
  130. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  131. package/lib-commonjs/components/DonutChart/DonutChart.base.js +1 -0
  132. package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
  133. package/lib-commonjs/components/DonutChart/DonutChart.styles.js +18 -0
  134. package/lib-commonjs/components/DonutChart/DonutChart.styles.js.map +1 -1
  135. package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +4 -0
  136. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  137. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
  138. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +24 -3
  139. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  140. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
  141. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +94 -36
  142. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  143. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
  144. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
  145. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  146. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +83 -54
  147. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  148. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +12 -0
  149. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -1
  150. package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +5 -0
  151. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  152. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  153. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +29 -6
  154. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  155. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  156. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +50 -31
  157. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  158. package/lib-commonjs/index.d.ts +1 -1
  159. package/lib-commonjs/index.js.map +1 -1
  160. package/lib-commonjs/types/IDataPoint.d.ts +18 -0
  161. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  162. package/lib-commonjs/utilities/SVGTooltipText.js +3 -3
  163. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  164. package/lib-commonjs/utilities/utilities.d.ts +6 -3
  165. package/lib-commonjs/utilities/utilities.js +59 -30
  166. package/lib-commonjs/utilities/utilities.js.map +1 -1
  167. package/package.json +2 -2
  168. package/src/components/CommonComponents/CartesianChart.types.ts +20 -1
  169. package/src/components/DonutChart/DonutChart.types.ts +5 -0
  170. package/src/components/ScatterChart/ScatterChart.types.ts +7 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.getGridProperties = exports.isNonPlotType = 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 = exports.SINGLE_REPEAT = exports.NON_PLOT_KEY_PREFIX = 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");
@@ -11,6 +11,9 @@ var utilities_1 = require("../../utilities/utilities");
11
11
  var chart_utilities_1 = require("@fluentui/chart-utilities");
12
12
  var d3_shape_1 = require("d3-shape");
13
13
  var PlotlyColorAdapter_1 = require("./PlotlyColorAdapter");
14
+ var d3_color_1 = require("d3-color");
15
+ exports.NON_PLOT_KEY_PREFIX = 'nonplot_';
16
+ exports.SINGLE_REPEAT = 'repeat(1, 1fr)';
14
17
  var dashOptions = {
15
18
  dot: {
16
19
  strokeDasharray: '1, 5',
@@ -58,6 +61,47 @@ function getTitles(layout) {
58
61
  };
59
62
  return titles;
60
63
  }
64
+ var getXAxisTickFormat = function (series, layout) {
65
+ var xAxis = getXAxisProperties(series, layout);
66
+ if (xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat) {
67
+ return {
68
+ tickFormat: xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat,
69
+ };
70
+ }
71
+ return {};
72
+ };
73
+ var getYAxisTickFormat = function (series, layout) {
74
+ var yAxis = getYAxisProperties(series, layout);
75
+ if (yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat) {
76
+ return {
77
+ yAxisTickFormat: (0, d3_format_1.format)(yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat),
78
+ };
79
+ }
80
+ return {};
81
+ };
82
+ var getYMinMaxValues = function (series, layout) {
83
+ var _a;
84
+ var range = (_a = getYAxisProperties(series, layout)) === null || _a === void 0 ? void 0 : _a.range;
85
+ if (range && range.length === 2) {
86
+ return {
87
+ yMinValue: range[0],
88
+ yMaxValue: range[1],
89
+ };
90
+ }
91
+ return {};
92
+ };
93
+ var getYAxisProperties = function (series, layout) {
94
+ return layout === null || layout === void 0 ? void 0 : layout.yaxis;
95
+ };
96
+ var getXAxisProperties = function (series, layout) {
97
+ return layout === null || layout === void 0 ? void 0 : layout.xaxis;
98
+ };
99
+ var getFormattedCalloutYData = function (yVal, yAxisFormat) {
100
+ if (typeof (yAxisFormat === null || yAxisFormat === void 0 ? void 0 : yAxisFormat.yAxisTickFormat) === 'function' && typeof yVal === 'number') {
101
+ return yAxisFormat.yAxisTickFormat(yVal);
102
+ }
103
+ return (0, chart_utilities_1.formatToLocaleString)(yVal);
104
+ };
61
105
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
106
  var correctYearMonth = function (xValues) {
63
107
  var presentYear = new Date().getFullYear();
@@ -208,7 +252,7 @@ var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, colorMap, co
208
252
  chartTitle: chartTitle,
209
253
  chartData: Object.values(mapLegendToDataPoint),
210
254
  },
211
- hideLegend: ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false ? true : false,
255
+ hideLegend: isMultiPlot || ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false,
212
256
  width: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.width,
213
257
  height: height,
214
258
  innerRadius: innerRadius,
@@ -226,6 +270,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
226
270
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
227
271
  var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
228
272
  var colorScale = undefined;
273
+ var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
229
274
  input.data.forEach(function (series, index1) {
230
275
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
231
276
  if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
@@ -249,7 +294,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
249
294
  var rangeXValues = series.x.slice(rangeStart, rangeEnd);
250
295
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
251
296
  rangeXValues.forEach(function (x, index2) {
252
- var _a, _b, _c, _d;
297
+ var _a, _b, _c, _d, _e, _f;
253
298
  if (!mapXToDataPoints[x]) {
254
299
  mapXToDataPoints[x] = {
255
300
  xAxisPoint: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber),
@@ -264,12 +309,15 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
264
309
  ? (_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]
265
310
  : 0)
266
311
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
312
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index2);
267
313
  var yVal = rangeYValues[index2];
314
+ var yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
268
315
  if (series.type === 'bar') {
269
316
  mapXToDataPoints[x].chartData.push({
270
317
  legend: legend,
271
318
  data: yVal,
272
- color: color,
319
+ color: (_e = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color,
320
+ yAxisCalloutData: yAxisCalloutData,
273
321
  });
274
322
  if (typeof yVal === 'number') {
275
323
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -283,9 +331,10 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
283
331
  legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
284
332
  legendShape: legendShape,
285
333
  y: yVal,
286
- color: lineColor,
334
+ color: (_f = (0, d3_color_1.rgb)(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
287
335
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
288
336
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
337
+ yAxisCalloutData: yAxisCalloutData,
289
338
  });
290
339
  if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
291
340
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -295,8 +344,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
295
344
  });
296
345
  });
297
346
  });
298
- var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
299
- 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 });
347
+ return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(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, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat);
300
348
  };
301
349
  exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
302
350
  var createColorScale = function (layout, series) {
@@ -321,6 +369,7 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
321
369
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
322
370
  var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
323
371
  var colorScale = undefined;
372
+ var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
324
373
  input.data.forEach(function (series, index1) {
325
374
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
326
375
  if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
@@ -332,7 +381,7 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
332
381
  // extract colors for each series only once
333
382
  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);
334
383
  (_m = series.x) === null || _m === void 0 ? void 0 : _m.forEach(function (x, xIndex) {
335
- var _a, _b, _c, _d, _e;
384
+ var _a, _b, _c, _d, _e, _f;
336
385
  if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
337
386
  return;
338
387
  }
@@ -346,20 +395,22 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
346
395
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
347
396
  ? (_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]
348
397
  : 0)
349
- : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
398
+ : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, xIndex, legend, colorMap, isDarkTheme);
399
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, xIndex);
400
+ var yVal = series.y[xIndex];
350
401
  mapXToDataPoints[x].series.push({
351
402
  key: legend,
352
- data: series.y[xIndex],
403
+ data: yVal,
353
404
  xAxisCalloutData: x,
354
- color: color,
405
+ color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
355
406
  legend: legend,
356
407
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
408
+ yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
357
409
  });
358
410
  }
359
411
  });
360
412
  });
361
- var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
362
- 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 });
413
+ return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(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', mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat);
363
414
  };
364
415
  exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
365
416
  var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -408,7 +459,7 @@ var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colo
408
459
  return yVal;
409
460
  });
410
461
  xBins.forEach(function (bin, index) {
411
- var _a, _b, _c, _d;
462
+ var _a, _b, _c, _d, _e;
412
463
  var legend = legends[seriesIdx];
413
464
  // resolve color for each legend's bars from the colorscale or extracted colors
414
465
  var color = colorScale
@@ -416,27 +467,14 @@ var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colo
416
467
  ? (_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]
417
468
  : 0)
418
469
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
470
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
419
471
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
420
- vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
472
+ 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
421
473
  ? {}
422
474
  : { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
423
475
  });
424
476
  });
425
- var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
426
- return {
427
- data: vbcData,
428
- width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width,
429
- height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350,
430
- supportNegativeData: true,
431
- chartTitle: chartTitle,
432
- xAxisTitle: xAxisTitle,
433
- yAxisTitle: yAxisTitle,
434
- mode: 'histogram',
435
- hideTickOverlap: true,
436
- maxBarWidth: 50,
437
- hideLegend: hideLegend,
438
- roundCorners: true,
439
- };
477
+ return tslib_1.__assign(tslib_1.__assign(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, mode: 'histogram', hideTickOverlap: true, maxBarWidth: 50, hideLegend: hideLegend, roundCorners: true }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout));
440
478
  };
441
479
  exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
442
480
  var transformPlotlyJsonToAreaChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -452,8 +490,9 @@ var transformPlotlyJsonToScatterChartProps = function (input, isMultiPlot, color
452
490
  };
453
491
  exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
454
492
  var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
455
- var _a, _b, _c, _d, _e, _f, _g;
493
+ var _a, _b, _c, _d;
456
494
  var isScatterMarkers = [
495
+ 'markers',
457
496
  'text+markers',
458
497
  'markers+text',
459
498
  'lines+markers',
@@ -464,7 +503,8 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
464
503
  var isScatterChart = chartType === 'scatter';
465
504
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
466
505
  var mode = 'tonexty';
467
- var _h = getLegendProps(input.data, input.layout, isMultiPlot), legends = _h.legends, hideLegend = _h.hideLegend;
506
+ var _e = getLegendProps(input.data, input.layout, isMultiPlot), legends = _e.legends, hideLegend = _e.hideLegend;
507
+ var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
468
508
  var chartData = input.data
469
509
  .map(function (series, index) {
470
510
  var _a, _b, _c, _d, _e, _f, _g;
@@ -483,12 +523,13 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
483
523
  var legend = legends[index];
484
524
  // resolve color for each legend's lines from the extracted colors
485
525
  var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
526
+ var seriesOpacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
486
527
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
487
528
  var lineOptions = getLineOptions(series.line);
488
529
  var legendShape = getLegendShape(series);
489
530
  var validXYRanges = (0, exports.getValidXYRanges)(series);
490
531
  return validXYRanges.map(function (_a, rangeIdx) {
491
- var _b;
532
+ var _b, _c;
492
533
  var rangeStart = _a[0], rangeEnd = _a[1];
493
534
  var rangeXValues = xValues.slice(rangeStart, rangeEnd);
494
535
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
@@ -501,35 +542,38 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
501
542
  legendShape: legendShape,
502
543
  data: rangeXValues.map(function (x, i) {
503
544
  var _a, _b;
504
- return (tslib_1.__assign(tslib_1.__assign({ x: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber), y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
545
+ return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ x: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber), y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
505
546
  ? { markerSize: markerSizes[i] }
506
547
  : typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
507
548
  ? { markerSize: series.marker.size }
508
- : {})), (textValues ? { text: textValues[i] } : {})));
549
+ : {})), (textValues ? { text: textValues[i] } : {})), { yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat) }));
509
550
  }),
510
- color: seriesColor,
551
+ color: (_c = (0, d3_color_1.rgb)(seriesColor).copy({ opacity: seriesOpacity }).formatHex8()) !== null && _c !== void 0 ? _c : seriesColor,
511
552
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
512
553
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
513
554
  };
514
555
  });
515
556
  })
516
557
  .flat();
517
- var yMinMaxValues = (0, utilities_1.findNumericMinMaxOfY)(chartData);
518
- var _j = getTitles(input.layout), chartTitle = _j.chartTitle, xAxisTitle = _j.xAxisTitle, yAxisTitle = _j.yAxisTitle;
558
+ var yMinMax = getYMinMaxValues(input.data[0], input.layout);
559
+ if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
560
+ var yMinMaxValues = (0, utilities_1.findNumericMinMaxOfY)(chartData);
561
+ yMinMax.yMinValue = yMinMaxValues.startValue;
562
+ yMinMax.yMaxValue = yMinMaxValues.endValue;
563
+ }
519
564
  var numDataPoints = chartData.reduce(function (total, lineChartPoints) { return total + lineChartPoints.data.length; }, 0);
520
565
  var chartProps = {
521
- chartTitle: chartTitle,
522
566
  lineChartData: chartData,
523
567
  };
524
568
  var scatterChartProps = {
525
- chartTitle: chartTitle,
526
569
  scatterChartData: chartData,
527
570
  };
571
+ var commonProps = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ supportNegativeData: true }, secondaryYAxisValues), { 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 }), getTitles(input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat);
528
572
  if (isAreaChart) {
529
- 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 });
573
+ return tslib_1.__assign({ data: chartProps, mode: mode }, commonProps);
530
574
  }
531
575
  else {
532
- 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 });
576
+ return tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax);
533
577
  }
534
578
  };
535
579
  var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -550,7 +594,7 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
550
594
  var legend = legends[index];
551
595
  return series.y
552
596
  .map(function (yValue, i) {
553
- var _a, _b, _c, _d, _e;
597
+ var _a, _b, _c, _d, _e, _f;
554
598
  if ((0, chart_utilities_1.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, chart_utilities_1.isInvalidValue)(yValue)) {
555
599
  return null;
556
600
  }
@@ -560,19 +604,17 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
560
604
  ? (_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]
561
605
  : 0)
562
606
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
607
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
563
608
  return {
564
609
  x: series.x[i],
565
610
  y: yValue,
566
611
  legend: legend,
567
- color: color,
612
+ color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
568
613
  };
569
614
  })
570
615
  .filter(function (point) { return point !== null; });
571
616
  })
572
- .reverse()
573
- .flat()
574
- //reversing the order to invert the Y bars order as required by plotly.
575
- .reverse();
617
+ .flat();
576
618
  var chartHeight = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 450;
577
619
  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;
578
620
  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;
@@ -581,25 +623,9 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
581
623
  var scalingFactor = 0.01;
582
624
  var gapFactor = 1 / (1 + scalingFactor * numberOfRows);
583
625
  var barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
584
- var _t = getTitles(input.layout), chartTitle = _t.chartTitle, xAxisTitle = _t.xAxisTitle, yAxisTitle = _t.yAxisTitle;
585
- return {
586
- data: chartData,
587
- chartTitle: chartTitle,
588
- xAxisTitle: xAxisTitle,
589
- yAxisTitle: yAxisTitle,
590
- secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
626
+ return tslib_1.__assign(tslib_1.__assign({ data: chartData, secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
591
627
  ? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
592
- : ((_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) || '',
593
- barHeight: barHeight,
594
- showYAxisLables: true,
595
- height: chartHeight,
596
- width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width,
597
- hideTickOverlap: true,
598
- hideLegend: hideLegend,
599
- noOfCharsToTruncate: 20,
600
- showYAxisLablesTooltip: true,
601
- roundCorners: true,
602
- };
628
+ : ((_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 }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout));
603
629
  };
604
630
  exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
605
631
  var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -714,23 +740,7 @@ var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap,
714
740
  var rangeValuesForColorScale = Array.isArray(colorscale)
715
741
  ? colorscale.map(function (arr) { return arr[1]; })
716
742
  : defaultRange;
717
- var _9 = getTitles(input.layout), chartTitle = _9.chartTitle, xAxisTitle = _9.xAxisTitle, yAxisTitle = _9.yAxisTitle;
718
- return {
719
- data: [heatmapData],
720
- domainValuesForColorScale: domainValuesForColorScale,
721
- rangeValuesForColorScale: rangeValuesForColorScale,
722
- hideLegend: true,
723
- showYAxisLables: true,
724
- chartTitle: chartTitle,
725
- xAxisTitle: xAxisTitle,
726
- yAxisTitle: yAxisTitle,
727
- sortOrder: 'none',
728
- width: (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.width,
729
- height: (_8 = (_7 = input.layout) === null || _7 === void 0 ? void 0 : _7.height) !== null && _8 !== void 0 ? _8 : 350,
730
- hideTickOverlap: true,
731
- noOfCharsToTruncate: 20,
732
- showYAxisLablesTooltip: true,
733
- };
743
+ return tslib_1.__assign(tslib_1.__assign({ data: [heatmapData], domainValuesForColorScale: domainValuesForColorScale, rangeValuesForColorScale: rangeValuesForColorScale, hideLegend: true, showYAxisLables: true, 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 }, getTitles(input.layout)), getAxisCategoryOrderProps([firstData], input.layout));
734
744
  };
735
745
  exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
736
746
  var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -1192,26 +1202,44 @@ var getLegendShape = function (series) {
1192
1202
  }
1193
1203
  return 'default';
1194
1204
  };
1195
- var getAllupLegendsProps = function (input, colorMap, colorwayType, isDarkTheme) {
1205
+ var getAllupLegendsProps = function (input, colorMap, colorwayType, traceInfo, isDarkTheme) {
1196
1206
  var allupLegends = [];
1197
1207
  // reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
1198
1208
  var toShowLegend = input.data.reduce(function (acc, series) {
1199
- return acc || series.showlegend === true;
1209
+ return (acc || series.showlegend === true || series.showlegend === undefined);
1200
1210
  }, false);
1201
1211
  if (toShowLegend) {
1202
1212
  input.data.forEach(function (series, index) {
1203
- var _a, _b, _c, _d, _e;
1204
- var name = series.legendgroup;
1205
- var color = ((_a = series.line) === null || _a === void 0 ? void 0 : _a.color) || ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color);
1206
- var legendShape = getLegendShape(series);
1207
- 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);
1208
- if (name !== undefined && allupLegends.some(function (group) { return group.title === name; }) === false) {
1209
- allupLegends.push({
1210
- title: name,
1211
- color: resolvedColor,
1212
- shape: legendShape,
1213
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1214
+ if (traceInfo[index].type === 'donut') {
1215
+ var pieSeries = series;
1216
+ var colors_2 = (0, PlotlyColorAdapter_1.extractColor)((_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_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, (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.piecolorway) !== null && _g !== void 0 ? _g : (_h = pieSeries === null || pieSeries === void 0 ? void 0 : pieSeries.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme);
1217
+ (_j = pieSeries.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, labelIndex) {
1218
+ var legend = "".concat(label);
1219
+ // resolve color for each legend from the extracted colors
1220
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(colors_2, labelIndex, legend, colorMap, isDarkTheme);
1221
+ if (legend !== '' && allupLegends.some(function (group) { return group.title === legend; }) === false) {
1222
+ allupLegends.push({
1223
+ title: legend,
1224
+ color: color,
1225
+ });
1226
+ }
1213
1227
  });
1214
1228
  }
1229
+ else if ((0, exports.isNonPlotType)(traceInfo[index].type) === false) {
1230
+ var plotSeries = series;
1231
+ var name_1 = plotSeries.legendgroup;
1232
+ var color = ((_k = plotSeries.line) === null || _k === void 0 ? void 0 : _k.color) || ((_l = plotSeries.marker) === null || _l === void 0 ? void 0 : _l.color);
1233
+ var legendShape = getLegendShape(plotSeries);
1234
+ var resolvedColor = (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, color, colorMap, isDarkTheme);
1235
+ if (name_1 !== undefined && name_1 !== '' && allupLegends.some(function (group) { return group.title === name_1; }) === false) {
1236
+ allupLegends.push({
1237
+ title: name_1,
1238
+ color: resolvedColor,
1239
+ shape: legendShape,
1240
+ });
1241
+ }
1242
+ }
1215
1243
  });
1216
1244
  }
1217
1245
  return {
@@ -1274,154 +1302,204 @@ var getIndexFromKey = function (key, pattern) {
1274
1302
  var normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
1275
1303
  return parseInt(normalizedKey, 10) - 1;
1276
1304
  };
1277
- var getGridProperties = function (layout, isMultiPlot) {
1305
+ var isNonPlotType = function (chartType) {
1306
+ return ['donut', 'sankey', 'pie'].includes(chartType);
1307
+ };
1308
+ exports.isNonPlotType = isNonPlotType;
1309
+ var getGridProperties = function (schema, isMultiPlot, validTracesInfo) {
1278
1310
  var _a;
1279
- var gridX = [];
1280
- var gridY = [];
1311
+ var domainX = [];
1312
+ var domainY = [];
1313
+ var cartesianDomains = 0;
1281
1314
  var annotations = {};
1282
1315
  var templateRows = '1fr';
1283
1316
  var templateColumns = '1fr';
1284
1317
  var gridLayout = {};
1285
- if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
1286
- return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
1287
- }
1288
- if (!layout.xaxis || !layout.yaxis) {
1289
- return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
1290
- }
1291
1318
  if (!isMultiPlot) {
1292
1319
  return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
1293
1320
  }
1294
- Object.keys(layout).forEach(function (key) {
1295
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1296
- if (key.startsWith('xaxis')) {
1297
- var index = getIndexFromKey(key, 'xaxis');
1298
- var anchor = (_b = (_a = layout[key]) === null || _a === void 0 ? void 0 : _a.anchor) !== null && _b !== void 0 ? _b : 'y';
1299
- var anchorIndex = getIndexFromKey(anchor, 'y');
1300
- if (index !== anchorIndex) {
1301
- throw new Error("Invalid layout: xaxis ".concat(index + 1, " anchor should be y").concat(anchorIndex + 1));
1321
+ var layout = schema === null || schema === void 0 ? void 0 : schema.layout;
1322
+ if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
1323
+ Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach(function (key) {
1324
+ var _a, _b, _c, _d, _e;
1325
+ if (key.startsWith('xaxis')) {
1326
+ var index = getIndexFromKey(key, 'xaxis');
1327
+ var anchor = (_b = (_a = layout[key]) === null || _a === void 0 ? void 0 : _a.anchor) !== null && _b !== void 0 ? _b : 'y';
1328
+ var anchorIndex = getIndexFromKey(anchor, 'y');
1329
+ if (index !== anchorIndex) {
1330
+ throw new Error("Invalid layout: xaxis ".concat(index + 1, " anchor should be y").concat(anchorIndex + 1));
1331
+ }
1332
+ var xAxisLayout = layout[key];
1333
+ var domainXInfo = {
1334
+ start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
1335
+ end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1,
1336
+ };
1337
+ domainX.push(domainXInfo);
1302
1338
  }
1303
- gridX[index] = (_d = (_c = layout[key]) === null || _c === void 0 ? void 0 : _c.domain) !== null && _d !== void 0 ? _d : [];
1304
- }
1305
- else if (key.startsWith('yaxis')) {
1306
- var index = getIndexFromKey(key, 'yaxis');
1307
- var anchor = (_f = (_e = layout[key]) === null || _e === void 0 ? void 0 : _e.anchor) !== null && _f !== void 0 ? _f : 'x';
1308
- var anchorIndex = getIndexFromKey(anchor, 'x');
1309
- if (index !== anchorIndex) {
1310
- if ((index === 1 && anchorIndex === 0) || ((_g = layout.yaxis2) === null || _g === void 0 ? void 0 : _g.side) === 'right') {
1311
- // Special case for secondary y axis where yaxis2 can anchor to x1
1312
- return { templateRows: templateRows, templateColumns: templateColumns };
1339
+ else if (key.startsWith('yaxis')) {
1340
+ var index = getIndexFromKey(key, 'yaxis');
1341
+ var anchor = (_d = (_c = layout[key]) === null || _c === void 0 ? void 0 : _c.anchor) !== null && _d !== void 0 ? _d : 'x';
1342
+ var anchorIndex = getIndexFromKey(anchor, 'x');
1343
+ if (index !== anchorIndex) {
1344
+ if ((index === 1 && anchorIndex === 0) || ((_e = layout.yaxis2) === null || _e === void 0 ? void 0 : _e.side) === 'right') {
1345
+ // Special case for secondary y axis where yaxis2 can anchor to x1
1346
+ return { templateRows: templateRows, templateColumns: templateColumns };
1347
+ }
1348
+ throw new Error("Invalid layout: yaxis ".concat(index + 1, " anchor should be x").concat(anchorIndex + 1));
1313
1349
  }
1314
- throw new Error("Invalid layout: yaxis ".concat(index + 1, " anchor should be x").concat(anchorIndex + 1));
1350
+ var yAxisLayout = layout[key];
1351
+ var domainYInfo = {
1352
+ start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
1353
+ end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1,
1354
+ };
1355
+ domainY.push(domainYInfo);
1315
1356
  }
1316
- gridY[index] = (_j = (_h = layout[key]) === null || _h === void 0 ? void 0 : _h.domain) !== null && _j !== void 0 ? _j : [];
1317
- }
1318
- });
1319
- (_a = layout.annotations) === null || _a === void 0 ? void 0 : _a.forEach(function (annotation) {
1320
- var xMatches = gridX.flatMap(function (interval, idx) {
1321
- return (annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval[1] ? [idx] : [];
1322
1357
  });
1323
- var yMatch = gridY.findIndex(function (interval, yIndex) {
1324
- return xMatches.includes(yIndex) &&
1325
- (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval[0] &&
1326
- (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval[1];
1327
- });
1328
- if (yMatch !== -1) {
1329
- if (annotations[yMatch] === undefined) {
1330
- annotations[yMatch] = {};
1331
- }
1332
- if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1333
- annotations[yMatch].yAnnotation = annotation.text;
1334
- }
1335
- else {
1336
- annotations[yMatch].xAnnotation = annotation.text;
1337
- }
1358
+ }
1359
+ cartesianDomains = domainX.length; // Assuming that the number of x and y axes is the same
1360
+ validTracesInfo.forEach(function (trace, index) {
1361
+ var _a, _b, _c, _d, _e;
1362
+ if ((0, exports.isNonPlotType)(trace.type)) {
1363
+ var series = (_a = schema === null || schema === void 0 ? void 0 : schema.data) === null || _a === void 0 ? void 0 : _a[index];
1364
+ var domainXInfo = {
1365
+ start: ((_b = series.domain) === null || _b === void 0 ? void 0 : _b.x) ? series.domain.x[0] : 0,
1366
+ end: ((_c = series.domain) === null || _c === void 0 ? void 0 : _c.x) ? series.domain.x[1] : 1,
1367
+ };
1368
+ var domainYInfo = {
1369
+ start: ((_d = series.domain) === null || _d === void 0 ? void 0 : _d.y) ? series.domain.y[0] : 0,
1370
+ end: ((_e = series.domain) === null || _e === void 0 ? void 0 : _e.y) ? series.domain.y[1] : 1,
1371
+ };
1372
+ domainX.push(domainXInfo);
1373
+ domainY.push(domainYInfo);
1338
1374
  }
1339
1375
  });
1340
- if (gridX.length > 0) {
1376
+ if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
1377
+ (_a = layout.annotations) === null || _a === void 0 ? void 0 : _a.forEach(function (annotation) {
1378
+ var xMatches = domainX.flatMap(function (interval, idx) {
1379
+ return (annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval.start && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval.end ? [idx] : [];
1380
+ });
1381
+ var yMatch = domainY.findIndex(function (interval, yIndex) {
1382
+ return xMatches.includes(yIndex) &&
1383
+ (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval.start &&
1384
+ (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval.end;
1385
+ });
1386
+ if (yMatch !== -1) {
1387
+ if (annotations[yMatch] === undefined) {
1388
+ annotations[yMatch] = {};
1389
+ }
1390
+ if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1391
+ annotations[yMatch].yAnnotation = annotation.text;
1392
+ }
1393
+ else {
1394
+ annotations[yMatch].xAnnotation = annotation.text;
1395
+ }
1396
+ }
1397
+ });
1398
+ }
1399
+ if (domainX.length > 0) {
1341
1400
  var uniqueXIntervals_1 = new Map();
1342
- gridX.forEach(function (interval) {
1343
- var key = "".concat(interval[0], "-").concat(interval[1]);
1401
+ domainX.forEach(function (interval) {
1402
+ var key = "".concat(interval.start, "-").concat(interval.end);
1344
1403
  if (!uniqueXIntervals_1.has(key)) {
1345
1404
  uniqueXIntervals_1.set(key, interval);
1346
1405
  }
1347
1406
  });
1348
- var minXInterval_1 = Math.min.apply(Math, Array.from(uniqueXIntervals_1.values()).map(function (interval) { return interval[1] - interval[0]; }));
1349
- templateColumns = Array.from(uniqueXIntervals_1.values())
1350
- .map(function (interval) { return "".concat((interval[1] - interval[0]) / minXInterval_1, "fr"); })
1351
- .join(' ');
1352
- var columnNumber_1 = 1;
1353
- var lastIntervalEnd_1 = 0;
1354
- gridX.forEach(function (interval, index) {
1355
- if (interval.length === 0) {
1356
- return;
1357
- }
1358
- var cellName = "x".concat(index === 0 ? '' : index + 1);
1407
+ var sortedXStart_1 = Array.from(uniqueXIntervals_1.values())
1408
+ .map(function (interval) { return interval.start; })
1409
+ .sort();
1410
+ templateColumns = "repeat(".concat(sortedXStart_1.length, ", 1fr)");
1411
+ domainX.forEach(function (interval, index) {
1412
+ var cellName = index >= cartesianDomains
1413
+ ? "".concat(exports.NON_PLOT_KEY_PREFIX).concat(index - cartesianDomains + 1)
1414
+ : "x".concat(index === 0 ? '' : index + 1);
1415
+ var columnIndex = sortedXStart_1.findIndex(function (start) { return start === interval.start; });
1416
+ var columnNumber = columnIndex + 1; // Column numbers are 1-based
1359
1417
  var annotationProps = annotations[index];
1360
1418
  var xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
1361
- if (interval[0] < lastIntervalEnd_1) {
1362
- columnNumber_1 = 1;
1363
- }
1364
- lastIntervalEnd_1 = interval[1];
1365
1419
  var row = {
1366
1420
  row: -1,
1367
- column: columnNumber_1,
1421
+ column: columnNumber,
1368
1422
  xAnnotation: xAnnotation,
1423
+ xDomain: interval,
1424
+ yDomain: { start: 0, end: 1 }, // Default yDomain for x-axis
1369
1425
  };
1370
1426
  gridLayout[cellName] = row;
1371
- columnNumber_1 += 1;
1372
1427
  });
1373
1428
  }
1374
- var numColumns = Math.max.apply(Math, Object.values(gridLayout).map(function (cell) { var _a; return (_a = cell.column) !== null && _a !== void 0 ? _a : 0; }));
1375
- var columnFill = {};
1376
- for (var i = 1; i <= numColumns; i++) {
1377
- columnFill[i] = { row: 1, fillDomain: 0 };
1378
- }
1379
- if (gridY.length > 0) {
1429
+ if (domainY.length > 0) {
1380
1430
  var uniqueYIntervals_1 = new Map();
1381
- gridY.forEach(function (interval) {
1382
- var key = "".concat(interval[0], "-").concat(interval[1]);
1431
+ domainY.forEach(function (interval) {
1432
+ var key = "".concat(interval.start, "-").concat(interval.end);
1383
1433
  if (!uniqueYIntervals_1.has(key)) {
1384
1434
  uniqueYIntervals_1.set(key, interval);
1385
1435
  }
1386
1436
  });
1387
- var minYInterval_1 = Math.min.apply(Math, Array.from(uniqueYIntervals_1.values()).map(function (interval) { return interval[1] - interval[0]; }));
1388
- templateRows = Array.from(uniqueYIntervals_1.values())
1389
- .map(function (interval) { return "".concat((interval[1] - interval[0]) / minYInterval_1, "fr"); })
1390
- .join(' ');
1391
- gridY.forEach(function (interval, index) {
1392
- if (interval.length === 0) {
1393
- return;
1394
- }
1395
- var cellName = "x".concat(index === 0 ? '' : index + 1);
1437
+ var sortedYStart_1 = Array.from(uniqueYIntervals_1.values())
1438
+ .map(function (interval) { return interval.start; })
1439
+ .sort();
1440
+ var numberOfRows_1 = sortedYStart_1.length;
1441
+ templateRows = "repeat(".concat(numberOfRows_1, ", 1fr)");
1442
+ domainY.forEach(function (interval, index) {
1443
+ var cellName = index >= cartesianDomains
1444
+ ? "".concat(exports.NON_PLOT_KEY_PREFIX).concat(index - cartesianDomains + 1)
1445
+ : "x".concat(index === 0 ? '' : index + 1);
1446
+ var rowIndex = sortedYStart_1.findIndex(function (start) { return start === interval.start; });
1447
+ var rowNumber = numberOfRows_1 - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
1396
1448
  var annotationProps = annotations[index];
1397
1449
  var yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
1398
1450
  var cell = gridLayout[cellName];
1399
1451
  if (cell !== undefined) {
1400
- cell.row = columnFill[cell.column].row;
1452
+ cell.row = rowNumber;
1401
1453
  cell.yAnnotation = yAnnotation;
1454
+ cell.yDomain = interval;
1402
1455
  }
1403
- columnFill[cell.column].fillDomain = interval[1];
1404
- columnFill[cell.column].row += 1;
1405
1456
  });
1406
1457
  }
1407
- // reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
1408
- var reversedGridLayout = {};
1409
- // find the maximum row number
1410
- var maxRowNumber = Math.max.apply(Math, Object.values(gridLayout).map(function (cell) { var _a; return (_a = cell.row) !== null && _a !== void 0 ? _a : 0; }));
1411
- // iterate over the gridLayout and reverse the row numbers
1412
- Object.keys(gridLayout).forEach(function (key) {
1413
- var cell = gridLayout[key];
1414
- if (cell.row !== undefined) {
1415
- // reverse the row number
1416
- cell.row = maxRowNumber - cell.row + 1;
1417
- }
1418
- reversedGridLayout[key] = cell;
1419
- });
1420
1458
  return {
1421
1459
  templateRows: templateRows,
1422
1460
  templateColumns: templateColumns,
1423
- layout: reversedGridLayout,
1461
+ layout: gridLayout,
1424
1462
  };
1425
1463
  };
1426
1464
  exports.getGridProperties = getGridProperties;
1465
+ /**
1466
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
1467
+ */
1468
+ var getAxisCategoryOrderProps = function (data, layout) {
1469
+ var result = {};
1470
+ var axesById = {
1471
+ x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
1472
+ y: layout === null || layout === void 0 ? void 0 : layout.yaxis,
1473
+ };
1474
+ Object.keys(axesById).forEach(function (axId) {
1475
+ var ax = axesById[axId];
1476
+ var axLetter = axId[0];
1477
+ var propName = "".concat(axLetter, "AxisCategoryOrder");
1478
+ var values = [];
1479
+ data.forEach(function (series) {
1480
+ var _a;
1481
+ (_a = series[axLetter]) === null || _a === void 0 ? void 0 : _a.forEach(function (val) {
1482
+ if (!(0, chart_utilities_1.isInvalidValue)(val)) {
1483
+ values.push(val);
1484
+ }
1485
+ });
1486
+ });
1487
+ 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));
1488
+ if (!isAxisTypeCategory) {
1489
+ return;
1490
+ }
1491
+ var isValidArray = (0, chart_utilities_1.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
1492
+ if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
1493
+ result[propName] = ax.categoryarray;
1494
+ return;
1495
+ }
1496
+ if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1497
+ var categoriesInTraceOrder = Array.from(new Set(values));
1498
+ result[propName] = categoriesInTraceOrder;
1499
+ return;
1500
+ }
1501
+ result[propName] = ax.categoryorder;
1502
+ });
1503
+ return result;
1504
+ };
1427
1505
  //# sourceMappingURL=PlotlySchemaAdapter.js.map