@fluentui/react-charts 0.0.0-nightly-20250826-2140.1 → 0.0.0-nightly-20250827-0407.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/CHANGELOG.md +48 -15
  2. package/dist/index.d.ts +15 -1
  3. package/lib/components/AreaChart/AreaChart.js +4 -1
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -2
  6. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  7. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -15
  8. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  9. package/lib/components/ChartTable/ChartTable.js +87 -6
  10. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  11. package/lib/components/CommonComponents/CartesianChart.js +24 -24
  12. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  13. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +17 -14
  14. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  15. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +6 -33
  16. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  17. package/lib/components/DeclarativeChart/DeclarativeChart.js +42 -16
  18. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  19. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +20 -1
  20. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  21. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +493 -259
  22. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  23. package/lib/components/DonutChart/DonutChart.js +6 -1
  24. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  25. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  26. package/lib/components/DonutChart/useDonutChartStyles.styles.js +21 -4
  27. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  28. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
  29. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  30. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +23 -4
  31. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  32. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +4 -17
  33. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  34. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +4 -21
  35. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  36. package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
  37. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  38. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
  39. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  40. package/lib/components/LineChart/LineChart.js +137 -82
  41. package/lib/components/LineChart/LineChart.js.map +1 -1
  42. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  43. package/lib/components/LineChart/useLineChartStyles.styles.js +23 -10
  44. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  45. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +4 -21
  46. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  47. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +12 -25
  48. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  49. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -12
  50. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  51. package/lib/components/ScatterChart/ScatterChart.js +95 -59
  52. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  53. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  54. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +27 -7
  55. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  56. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +8 -14
  57. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  58. package/lib/components/VerticalBarChart/VerticalBarChart.js +27 -4
  59. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  60. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +8 -6
  61. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  62. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +5 -19
  63. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  64. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +61 -44
  65. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  66. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +7 -6
  67. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  68. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +4 -19
  69. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  70. package/lib/utilities/Common.styles.js +47 -0
  71. package/lib/utilities/Common.styles.js.map +1 -0
  72. package/lib/utilities/Common.styles.raw.js +47 -0
  73. package/lib/utilities/Common.styles.raw.js.map +1 -0
  74. package/lib/utilities/SVGTooltipText.js.map +1 -1
  75. package/lib/utilities/index.js +1 -0
  76. package/lib/utilities/index.js.map +1 -1
  77. package/lib/utilities/scatterpolar-utils.js +63 -0
  78. package/lib/utilities/scatterpolar-utils.js.map +1 -0
  79. package/lib/utilities/utilities.js +32 -37
  80. package/lib/utilities/utilities.js.map +1 -1
  81. package/lib-commonjs/components/AreaChart/AreaChart.js +4 -1
  82. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  83. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  84. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -14
  85. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  86. package/lib-commonjs/components/ChartTable/ChartTable.js +87 -6
  87. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  88. package/lib-commonjs/components/CommonComponents/CartesianChart.js +24 -24
  89. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  90. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +15 -13
  91. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  92. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -32
  93. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  94. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +41 -15
  95. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  96. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +23 -1
  97. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  98. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +500 -257
  99. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  100. package/lib-commonjs/components/DonutChart/DonutChart.js +6 -1
  101. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  102. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  103. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +32 -4
  104. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  105. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
  106. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  107. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -3
  108. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  109. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -19
  110. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  111. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -20
  112. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  113. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
  114. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  115. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
  116. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  117. package/lib-commonjs/components/LineChart/LineChart.js +136 -81
  118. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  119. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  120. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +30 -9
  121. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  122. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +2 -20
  123. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  124. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +23 -33
  125. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  126. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +1 -12
  127. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  128. package/lib-commonjs/components/ScatterChart/ScatterChart.js +94 -58
  129. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  130. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  131. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +37 -5
  132. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  133. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +7 -13
  134. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  135. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +26 -3
  136. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  137. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +5 -3
  138. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  139. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -17
  140. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  141. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +60 -43
  142. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  143. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +5 -3
  144. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  145. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -18
  146. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  147. package/lib-commonjs/utilities/Common.styles.js +71 -0
  148. package/lib-commonjs/utilities/Common.styles.js.map +1 -0
  149. package/lib-commonjs/utilities/Common.styles.raw.js +71 -0
  150. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -0
  151. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  152. package/lib-commonjs/utilities/index.js +1 -0
  153. package/lib-commonjs/utilities/index.js.map +1 -1
  154. package/lib-commonjs/utilities/scatterpolar-utils.js +78 -0
  155. package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -0
  156. package/lib-commonjs/utilities/utilities.js +28 -40
  157. package/lib-commonjs/utilities/utilities.js.map +1 -1
  158. package/package.json +12 -12
@@ -9,6 +9,12 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ NON_PLOT_KEY_PREFIX: function() {
13
+ return NON_PLOT_KEY_PREFIX;
14
+ },
15
+ SINGLE_REPEAT: function() {
16
+ return SINGLE_REPEAT;
17
+ },
12
18
  _getGaugeAxisColor: function() {
13
19
  return _getGaugeAxisColor;
14
20
  },
@@ -30,6 +36,9 @@ _export(exports, {
30
36
  getValidXYRanges: function() {
31
37
  return getValidXYRanges;
32
38
  },
39
+ isNonPlotType: function() {
40
+ return isNonPlotType;
41
+ },
33
42
  projectPolarToCartesian: function() {
34
43
  return projectPolarToCartesian;
35
44
  },
@@ -84,6 +93,8 @@ const _chartutilities = require("@fluentui/chart-utilities");
84
93
  const _d3shape = require("d3-shape");
85
94
  const _PlotlyColorAdapter = require("./PlotlyColorAdapter");
86
95
  const _d3color = require("d3-color");
96
+ const NON_PLOT_KEY_PREFIX = 'nonplot_';
97
+ const SINGLE_REPEAT = 'repeat(1, 1fr)';
87
98
  const dashOptions = {
88
99
  dot: {
89
100
  strokeDasharray: '1, 5',
@@ -132,6 +143,47 @@ function getTitles(layout) {
132
143
  };
133
144
  return titles;
134
145
  }
146
+ const getXAxisTickFormat = (series, layout)=>{
147
+ const xAxis = getXAxisProperties(series, layout);
148
+ if (xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat) {
149
+ return {
150
+ tickFormat: xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat
151
+ };
152
+ }
153
+ return {};
154
+ };
155
+ const getYAxisTickFormat = (series, layout)=>{
156
+ const yAxis = getYAxisProperties(series, layout);
157
+ if (yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat) {
158
+ return {
159
+ yAxisTickFormat: (0, _d3format.format)(yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat)
160
+ };
161
+ }
162
+ return {};
163
+ };
164
+ const getYMinMaxValues = (series, layout)=>{
165
+ var _getYAxisProperties;
166
+ const range = (_getYAxisProperties = getYAxisProperties(series, layout)) === null || _getYAxisProperties === void 0 ? void 0 : _getYAxisProperties.range;
167
+ if (range && range.length === 2) {
168
+ return {
169
+ yMinValue: range[0],
170
+ yMaxValue: range[1]
171
+ };
172
+ }
173
+ return {};
174
+ };
175
+ const getYAxisProperties = (series, layout)=>{
176
+ return layout === null || layout === void 0 ? void 0 : layout.yaxis;
177
+ };
178
+ const getXAxisProperties = (series, layout)=>{
179
+ return layout === null || layout === void 0 ? void 0 : layout.xaxis;
180
+ };
181
+ const getFormattedCalloutYData = (yVal, yAxisFormat)=>{
182
+ if (typeof (yAxisFormat === null || yAxisFormat === void 0 ? void 0 : yAxisFormat.yAxisTickFormat) === 'function' && typeof yVal === 'number') {
183
+ return yAxisFormat.yAxisTickFormat(yVal);
184
+ }
185
+ return (0, _chartutilities.formatToLocaleString)(yVal);
186
+ };
135
187
  const correctYearMonth = (xValues)=>{
136
188
  const presentYear = new Date().getFullYear();
137
189
  if (xValues.length > 0 && Array.isArray(xValues[0])) {
@@ -275,7 +327,7 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
275
327
  chartTitle,
276
328
  chartData: Object.values(mapLegendToDataPoint)
277
329
  },
278
- hideLegend: ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false ? true : false,
330
+ hideLegend: isMultiPlot || ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false,
279
331
  width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
280
332
  height,
281
333
  innerRadius,
@@ -294,17 +346,16 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
294
346
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
295
347
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
296
348
  let colorScale = undefined;
349
+ const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
297
350
  let yMinValue = 0;
298
351
  input.data.forEach((series, index1)=>{
299
- var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _input_layout_template_layout1, _input_layout_template1, _input_layout2, _series_line;
300
- if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[0]) === 'number') {
301
- colorScale = createColorScale(input.layout, series);
302
- }
352
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_line;
353
+ colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
303
354
  const isXYearCategory = (0, _chartutilities.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
304
355
  // extract bar colors for each series only once
305
- const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
356
+ const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
306
357
  // extract line colors for each series only once
307
- const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template1 = _input_layout2.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
358
+ const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
308
359
  const xValues = series.x;
309
360
  const isXDate = (0, _chartutilities.isDateArray)(xValues);
310
361
  const isXString = (0, _chartutilities.isStringArray)(xValues);
@@ -327,6 +378,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
327
378
  const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
328
379
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
329
380
  const yVal = rangeYValues[index2];
381
+ const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
330
382
  if (series.type === 'bar') {
331
383
  var _rgb_copy_formatHex8;
332
384
  mapXToDataPoints[x].chartData.push({
@@ -334,7 +386,8 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
334
386
  data: yVal,
335
387
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
336
388
  opacity
337
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
389
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
390
+ yAxisCalloutData
338
391
  });
339
392
  if (typeof yVal === 'number') {
340
393
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -356,7 +409,8 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
356
409
  ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
357
410
  mode: series.mode
358
411
  },
359
- useSecondaryYScale: usesSecondaryYScale(series, input.layout)
412
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
413
+ yAxisCalloutData
360
414
  });
361
415
  if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
362
416
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -367,7 +421,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
367
421
  });
368
422
  });
369
423
  });
370
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
371
424
  const vsbcData = Object.values(mapXToDataPoints);
372
425
  var _input_layout_height;
373
426
  return {
@@ -377,9 +430,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
377
430
  barWidth: 'auto',
378
431
  yMaxValue,
379
432
  yMinValue,
380
- chartTitle,
381
- xAxisTitle,
382
- yAxisTitle,
383
433
  mode: 'plotly',
384
434
  ...secondaryYAxisValues,
385
435
  wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
@@ -389,36 +439,27 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
389
439
  roundCorners: true,
390
440
  showYAxisLables: true,
391
441
  noOfCharsToTruncate: 20,
392
- showYAxisLablesTooltip: true
442
+ showYAxisLablesTooltip: true,
443
+ ...getTitles(input.layout),
444
+ ...getXAxisTickFormat(input.data[0], input.layout),
445
+ ...yAxisTickFormat,
446
+ ...getAxisCategoryOrderProps(input.data, input.layout),
447
+ ...getBarProps(input.data, input.layout),
448
+ ...getYMinMaxValues(input.data[0], input.layout)
393
449
  };
394
450
  };
395
- const createColorScale = (layout, series)=>{
396
- var _layout_coloraxis, _series_marker, _layout_coloraxis1, _layout_coloraxis2;
397
- const scale = layout === null || layout === void 0 ? void 0 : (_layout_coloraxis = layout.coloraxis) === null || _layout_coloraxis === void 0 ? void 0 : _layout_coloraxis.colorscale;
398
- const colorValues = (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color;
399
- var _layout_coloraxis_cmin, _layout_coloraxis_cmax;
400
- const [dMin, dMax] = [
401
- (_layout_coloraxis_cmin = layout === null || layout === void 0 ? void 0 : (_layout_coloraxis1 = layout.coloraxis) === null || _layout_coloraxis1 === void 0 ? void 0 : _layout_coloraxis1.cmin) !== null && _layout_coloraxis_cmin !== void 0 ? _layout_coloraxis_cmin : Math.min(...colorValues),
402
- (_layout_coloraxis_cmax = layout === null || layout === void 0 ? void 0 : (_layout_coloraxis2 = layout.coloraxis) === null || _layout_coloraxis2 === void 0 ? void 0 : _layout_coloraxis2.cmax) !== null && _layout_coloraxis_cmax !== void 0 ? _layout_coloraxis_cmax : Math.max(...colorValues)
403
- ];
404
- // Normalize colorscale domain to actual data domain
405
- const scaleDomain = scale.map(([pos])=>dMin + pos * (dMax - dMin));
406
- const scaleColors = scale.map((item)=>item[1]);
407
- return (0, _d3scale.scaleLinear)().domain(scaleDomain).range(scaleColors);
408
- };
409
451
  const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
410
452
  var _input_layout, _input_layout1, _gvbcData_;
411
453
  const mapXToDataPoints = {};
412
454
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
413
455
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
414
456
  let colorScale = undefined;
457
+ const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
415
458
  input.data.forEach((series, index1)=>{
416
- var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _series_x;
417
- if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[0]) === 'number') {
418
- colorScale = createColorScale(input.layout, series);
419
- }
459
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_x;
460
+ colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
420
461
  // extract colors for each series only once
421
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
462
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
422
463
  (_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x.forEach((x, index2)=>{
423
464
  var _series_y;
424
465
  if ((0, _chartutilities.isInvalidValue)(x) || (0, _chartutilities.isInvalidValue)((_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index2])) {
@@ -434,23 +475,24 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
434
475
  var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
435
476
  const legend = legends[index1];
436
477
  // resolve color for each legend's bars from the colorscale or extracted colors
437
- const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
478
+ const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index2, legend, colorMap, isDarkTheme);
438
479
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
480
+ const yVal = series.y[index2];
439
481
  var _rgb_copy_formatHex8;
440
482
  mapXToDataPoints[x].series.push({
441
483
  key: legend,
442
- data: series.y[index2],
484
+ data: yVal,
443
485
  xAxisCalloutData: x,
444
486
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
445
487
  opacity
446
488
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
447
489
  legend,
448
- useSecondaryYScale: usesSecondaryYScale(series, input.layout)
490
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
491
+ yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
449
492
  });
450
493
  }
451
494
  });
452
495
  });
453
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
454
496
  const gvbcData = Object.values(mapXToDataPoints);
455
497
  var _input_layout_height;
456
498
  return {
@@ -458,15 +500,18 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
458
500
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
459
501
  height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
460
502
  barWidth: 'auto',
461
- chartTitle,
462
- xAxisTitle,
463
- yAxisTitle,
464
503
  mode: 'plotly',
465
504
  ...secondaryYAxisValues,
466
505
  hideTickOverlap: true,
467
506
  wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
468
507
  hideLegend,
469
- roundCorners: true
508
+ roundCorners: true,
509
+ ...getTitles(input.layout),
510
+ ...getYMinMaxValues(input.data[0], input.layout),
511
+ ...getXAxisTickFormat(input.data[0], input.layout),
512
+ ...yAxisTickFormat,
513
+ ...getAxisCategoryOrderProps(input.data, input.layout),
514
+ ...getBarProps(input.data, input.layout)
470
515
  };
471
516
  };
472
517
  const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -475,15 +520,13 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
475
520
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
476
521
  let colorScale = undefined;
477
522
  input.data.forEach((series, seriesIdx)=>{
478
- var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _series_xbins, _series_xbins1, _series_xbins2;
523
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_xbins, _series_xbins1, _series_xbins2;
479
524
  if (!series.x) {
480
525
  return;
481
526
  }
482
- if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[0]) === 'number') {
483
- colorScale = createColorScale(input.layout, series);
484
- }
527
+ colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
485
528
  // extract colors for each series only once
486
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
529
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
487
530
  const xValues = [];
488
531
  const yValues = [];
489
532
  series.x.forEach((xVal, index)=>{
@@ -532,21 +575,20 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
532
575
  });
533
576
  });
534
577
  });
535
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
536
578
  var _input_layout_height;
537
579
  return {
538
580
  data: vbcData,
539
581
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
540
582
  height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
541
- chartTitle,
542
- xAxisTitle,
543
- yAxisTitle,
544
583
  mode: 'histogram',
545
584
  hideTickOverlap: true,
546
585
  wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
547
586
  maxBarWidth: 50,
548
587
  hideLegend,
549
- roundCorners: true
588
+ roundCorners: true,
589
+ ...getTitles(input.layout),
590
+ ...getYMinMaxValues(input.data[0], input.layout),
591
+ ...getAxisCategoryOrderProps(input.data, input.layout)
550
592
  };
551
593
  };
552
594
  const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -559,19 +601,23 @@ const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, co
559
601
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
560
602
  };
561
603
  const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
562
- var _input_data_;
604
+ var _input_data_, _input_layout, _input_layout1;
563
605
  const isScatterMarkers = [
606
+ 'text',
607
+ 'markers',
564
608
  'text+markers',
565
609
  'markers+text',
566
610
  'lines+markers',
567
611
  'markers+line',
568
- 'text+lines+markers'
612
+ 'text+lines+markers',
613
+ 'lines+markers+text'
569
614
  ].includes((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.mode);
570
615
  const isAreaChart = chartType === 'area';
571
616
  const isScatterChart = chartType === 'scatter';
572
617
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
573
618
  let mode = 'tonexty';
574
619
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
620
+ const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
575
621
  const chartData = input.data.map((series, index)=>{
576
622
  var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
577
623
  const colors = isScatterMarkers ? (series === null || series === void 0 ? void 0 : (_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('line')) ? (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color : (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color : (_series_line1 = series.line) === null || _series_line1 === void 0 ? void 0 : _series_line1.color;
@@ -587,11 +633,12 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
587
633
  const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
588
634
  const seriesOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
589
635
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
590
- const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) ? getLineOptions(series.line) : undefined;
636
+ // if mode contains 'text', we prioritize showing the text over curving the line
637
+ const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
591
638
  const legendShape = getLegendShape(series);
592
639
  const validXYRanges = getValidXYRanges(series);
593
640
  return validXYRanges.map(([rangeStart, rangeEnd], rangeIdx)=>{
594
- var _series_marker;
641
+ var _series_marker, _input_layout, _input_layout_polar_angularaxis, _input_layout_polar, _input_layout1, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout2;
595
642
  const rangeXValues = xValues.slice(rangeStart, rangeEnd);
596
643
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
597
644
  const markerSizes = (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? series.marker.size.slice(rangeStart, rangeEnd) : [];
@@ -612,7 +659,8 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
612
659
  } : {},
613
660
  ...textValues ? {
614
661
  text: textValues[i]
615
- } : {}
662
+ } : {},
663
+ yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat)
616
664
  };
617
665
  }),
618
666
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(seriesColor).copy({
@@ -620,58 +668,58 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
620
668
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : seriesColor,
621
669
  lineOptions: {
622
670
  ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
623
- mode: series.mode
671
+ mode: series.type !== 'scatterpolar' ? series.mode : 'scatterpolar',
672
+ // originXOffset is not typed on Layout, but may be present in input.layout as a part of projection of
673
+ // scatter polar coordingates to cartesian coordinates
674
+ ...series.type === 'scatterpolar' ? {
675
+ originXOffset: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.__polarOriginX,
676
+ direction: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_polar = _input_layout1.polar) === null || _input_layout_polar === void 0 ? void 0 : (_input_layout_polar_angularaxis = _input_layout_polar.angularaxis) === null || _input_layout_polar_angularaxis === void 0 ? void 0 : _input_layout_polar_angularaxis.direction,
677
+ rotation: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_polar1 = _input_layout2.polar) === null || _input_layout_polar1 === void 0 ? void 0 : (_input_layout_polar_angularaxis1 = _input_layout_polar1.angularaxis) === null || _input_layout_polar_angularaxis1 === void 0 ? void 0 : _input_layout_polar_angularaxis1.rotation
678
+ } : {}
624
679
  },
625
680
  useSecondaryYScale: usesSecondaryYScale(series, input.layout)
626
681
  };
627
682
  });
628
683
  }).flat();
629
- const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
630
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
684
+ const yMinMax = getYMinMaxValues(input.data[0], input.layout);
685
+ if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
686
+ const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
687
+ yMinMax.yMinValue = yMinMaxValues.startValue;
688
+ yMinMax.yMaxValue = yMinMaxValues.endValue;
689
+ }
631
690
  const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
632
691
  const chartProps = {
633
- chartTitle,
634
692
  lineChartData: chartData
635
693
  };
636
694
  const scatterChartProps = {
637
- chartTitle,
638
695
  scatterChartData: chartData
639
696
  };
697
+ var _input_layout_height;
698
+ const commonProps = {
699
+ supportNegativeData: true,
700
+ ...secondaryYAxisValues,
701
+ width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
702
+ height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
703
+ hideTickOverlap: true,
704
+ hideLegend,
705
+ useUTC: false,
706
+ optimizeLargeData: numDataPoints > 1000,
707
+ ...getTitles(input.layout),
708
+ ...getXAxisTickFormat(input.data[0], input.layout),
709
+ ...yAxisTickFormat
710
+ };
640
711
  if (isAreaChart) {
641
- var _input_layout, _input_layout1;
642
- var _input_layout_height;
643
712
  return {
644
713
  data: chartProps,
645
- supportNegativeData: true,
646
- xAxisTitle,
647
- yAxisTitle,
648
- ...secondaryYAxisValues,
649
714
  mode,
650
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
651
- height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
652
- hideTickOverlap: true,
653
- useUTC: false,
654
- hideLegend,
655
- optimizeLargeData: numDataPoints > 1000
715
+ ...commonProps
656
716
  };
657
717
  } else {
658
- var _input_layout2, _input_layout3;
659
- var _input_layout_height1;
660
718
  return {
661
719
  data: isScatterChart ? scatterChartProps : chartProps,
662
- supportNegativeData: true,
663
- xAxisTitle,
664
- yAxisTitle,
665
- ...secondaryYAxisValues,
666
720
  roundedTicks: true,
667
- yMinValue: yMinMaxValues.startValue,
668
- yMaxValue: yMinMaxValues.endValue,
669
- width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
670
- height: (_input_layout_height1 = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height1 !== void 0 ? _input_layout_height1 : 350,
671
- hideTickOverlap: true,
672
- useUTC: false,
673
- hideLegend,
674
- optimizeLargeData: numDataPoints > 1000
721
+ ...commonProps,
722
+ ...yMinMax
675
723
  };
676
724
  }
677
725
  };
@@ -680,12 +728,10 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
680
728
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
681
729
  let colorScale = undefined;
682
730
  const chartData = input.data.map((series, index)=>{
683
- var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3;
684
- if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[0]) === 'number') {
685
- colorScale = createColorScale(input.layout, series);
686
- }
731
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker;
732
+ colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
687
733
  // extract colors for each series only once
688
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
734
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
689
735
  const legend = legends[index];
690
736
  return series.y.map((yValue, i)=>{
691
737
  var _series_x, _series_marker, _series_marker1, _series_marker_color, _series_marker2;
@@ -705,8 +751,7 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
705
751
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
706
752
  };
707
753
  }).filter((point)=>point !== null);
708
- }).reverse().flat() //reversing the order to invert the Y bars order as required by plotly.
709
- .reverse();
754
+ }).flat();
710
755
  var _input_layout_height;
711
756
  const chartHeight = (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 450;
712
757
  var _input_layout_margin_l;
@@ -718,12 +763,8 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
718
763
  const scalingFactor = 0.01;
719
764
  const gapFactor = 1 / (1 + scalingFactor * numberOfRows);
720
765
  const barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
721
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
722
766
  return {
723
767
  data: chartData,
724
- chartTitle,
725
- xAxisTitle,
726
- yAxisTitle,
727
768
  secondaryYAxistitle: typeof ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_yaxis2 = _input_layout3.yaxis2) === null || _input_layout_yaxis2 === void 0 ? void 0 : _input_layout_yaxis2.title) === 'string' ? (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_yaxis21 = _input_layout4.yaxis2) === null || _input_layout_yaxis21 === void 0 ? void 0 : _input_layout_yaxis21.title : ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_yaxis22 = _input_layout5.yaxis2) === null || _input_layout_yaxis22 === void 0 ? void 0 : (_input_layout_yaxis2_title = _input_layout_yaxis22.title) === null || _input_layout_yaxis2_title === void 0 ? void 0 : _input_layout_yaxis2_title.text) || '',
728
769
  barHeight,
729
770
  showYAxisLables: true,
@@ -733,7 +774,10 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
733
774
  noOfCharsToTruncate: 20,
734
775
  showYAxisLablesTooltip: true,
735
776
  hideLegend,
736
- roundCorners: true
777
+ roundCorners: true,
778
+ ...getTitles(input.layout),
779
+ ...getAxisCategoryOrderProps(input.data, input.layout),
780
+ ...getBarProps(input.data, input.layout, true)
737
781
  };
738
782
  };
739
783
  const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -846,7 +890,6 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
846
890
  }
847
891
  const domainValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
848
892
  const rangeValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[1]) : defaultRange;
849
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
850
893
  var _input_layout_height;
851
894
  return {
852
895
  data: [
@@ -856,16 +899,17 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
856
899
  rangeValuesForColorScale,
857
900
  hideLegend: true,
858
901
  showYAxisLables: true,
859
- chartTitle,
860
- xAxisTitle,
861
- yAxisTitle,
862
902
  sortOrder: 'none',
863
903
  width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
864
904
  height: (_input_layout_height = (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
865
905
  hideTickOverlap: true,
866
906
  noOfCharsToTruncate: 20,
867
907
  showYAxisLablesTooltip: true,
868
- wrapXAxisLables: true
908
+ wrapXAxisLables: true,
909
+ ...getTitles(input.layout),
910
+ ...getAxisCategoryOrderProps([
911
+ firstData
912
+ ], input.layout)
869
913
  };
870
914
  };
871
915
  const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -1014,7 +1058,7 @@ const formatValue = (value, colIndex, cells)=>{
1014
1058
  return `${prefix !== null && prefix !== void 0 ? prefix : ''}${formatted}${suffix !== null && suffix !== void 0 ? suffix : ''}`;
1015
1059
  };
1016
1060
  const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1017
- var _tableData_cells, _input_layout_template_data, _input_layout_template, _input_layout, _input_layout_font, _input_layout1, _tableData_header, _tableData_header1, _input_layout_template_data1, _input_layout_template1, _input_layout2, _input_layout3, _input_layout4;
1061
+ var _tableData_cells, _input_layout_template_data_table_, _input_layout_template_data_table, _input_layout_template_data, _input_layout_template, _input_layout, _input_layout_font, _input_layout1, _tableData_header, _input_layout_template_data1, _input_layout_template1, _input_layout2, _input_layout3, _input_layout4;
1018
1062
  const tableData = input.data[0];
1019
1063
  const normalizeHeaders = (values, header)=>{
1020
1064
  const cleanedValues = Array.isArray(values[0]) ? values.map((row)=>row.map((cell)=>cleanText(cell)).filter(Boolean).join(' ')) : values.map((cell)=>cleanText(cell));
@@ -1023,7 +1067,8 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
1023
1067
  const fontColorRaw = header === null || header === void 0 ? void 0 : (_header_font = header.font) === null || _header_font === void 0 ? void 0 : _header_font.color;
1024
1068
  let fontColor;
1025
1069
  if (Array.isArray(fontColorRaw)) {
1026
- const colorEntry = fontColorRaw[colIndex];
1070
+ var _fontColorRaw_colIndex;
1071
+ const colorEntry = (_fontColorRaw_colIndex = fontColorRaw[colIndex]) !== null && _fontColorRaw_colIndex !== void 0 ? _fontColorRaw_colIndex : fontColorRaw[0];
1027
1072
  if (Array.isArray(colorEntry)) {
1028
1073
  fontColor = typeof colorEntry[0] === 'string' ? colorEntry[0] : undefined;
1029
1074
  } else if (typeof colorEntry === 'string') {
@@ -1035,15 +1080,20 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
1035
1080
  const fontSizeRaw = header === null || header === void 0 ? void 0 : (_header_font1 = header.font) === null || _header_font1 === void 0 ? void 0 : _header_font1.size;
1036
1081
  let fontSize;
1037
1082
  if (Array.isArray(fontSizeRaw)) {
1038
- fontSize = Array.isArray(fontSizeRaw[0]) ? fontSizeRaw[0][colIndex] : fontSizeRaw[colIndex];
1083
+ var _fontSizeRaw_colIndex;
1084
+ const fontSizeEntry = (_fontSizeRaw_colIndex = fontSizeRaw[colIndex]) !== null && _fontSizeRaw_colIndex !== void 0 ? _fontSizeRaw_colIndex : fontSizeRaw[0];
1085
+ var _fontSizeRaw__colIndex;
1086
+ fontSize = Array.isArray(fontSizeRaw[0]) ? (_fontSizeRaw__colIndex = fontSizeRaw[0][colIndex]) !== null && _fontSizeRaw__colIndex !== void 0 ? _fontSizeRaw__colIndex : fontSizeRaw[0][0] : typeof fontSizeEntry === 'number' ? fontSizeEntry : undefined;
1039
1087
  } else if (typeof fontSizeRaw === 'number') {
1040
1088
  fontSize = fontSizeRaw;
1041
1089
  }
1042
1090
  const updatedColIndex = colIndex >= 1 ? 1 : 0;
1043
1091
  const fillColorRaw = header === null || header === void 0 ? void 0 : (_header_fill = header.fill) === null || _header_fill === void 0 ? void 0 : _header_fill.color;
1044
- const backgroundColor = Array.isArray(fillColorRaw) ? fillColorRaw[updatedColIndex] : fillColorRaw;
1092
+ var _fillColorRaw_updatedColIndex;
1093
+ const backgroundColor = Array.isArray(fillColorRaw) ? (_fillColorRaw_updatedColIndex = fillColorRaw[updatedColIndex]) !== null && _fillColorRaw_updatedColIndex !== void 0 ? _fillColorRaw_updatedColIndex : fillColorRaw[0] : fillColorRaw;
1045
1094
  const textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
1046
- const textAlign = Array.isArray(textAlignRaw) ? textAlignRaw[colIndex] : textAlignRaw;
1095
+ var _textAlignRaw_colIndex;
1096
+ const textAlign = Array.isArray(textAlignRaw) ? (_textAlignRaw_colIndex = textAlignRaw[colIndex]) !== null && _textAlignRaw_colIndex !== void 0 ? _textAlignRaw_colIndex : textAlignRaw[0] : textAlignRaw;
1047
1097
  const style = {
1048
1098
  ...typeof fontColor === 'string' ? {
1049
1099
  color: fontColor
@@ -1066,7 +1116,7 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
1066
1116
  };
1067
1117
  var _tableData_cells_values;
1068
1118
  const columns = (_tableData_cells_values = (_tableData_cells = tableData.cells) === null || _tableData_cells === void 0 ? void 0 : _tableData_cells.values) !== null && _tableData_cells_values !== void 0 ? _tableData_cells_values : [];
1069
- const cells = tableData.cells.font ? tableData.cells : (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template.data) === null || _input_layout_template_data === void 0 ? void 0 : _input_layout_template_data.table[0].cells;
1119
+ const cells = tableData.cells && Object.keys(tableData.cells).length > 0 ? tableData.cells : (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template.data) === null || _input_layout_template_data === void 0 ? void 0 : (_input_layout_template_data_table = _input_layout_template_data.table) === null || _input_layout_template_data_table === void 0 ? void 0 : (_input_layout_template_data_table_ = _input_layout_template_data_table[0]) === null || _input_layout_template_data_table_ === void 0 ? void 0 : _input_layout_template_data_table_.cells;
1070
1120
  const rows = columns[0].map((_, rowIndex)=>columns.map((col, colIndex)=>{
1071
1121
  var _cells_font, _cells_font1, _cells_fill;
1072
1122
  const cellValue = col[rowIndex];
@@ -1075,7 +1125,8 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
1075
1125
  const rawFontColor = cells === null || cells === void 0 ? void 0 : (_cells_font = cells.font) === null || _cells_font === void 0 ? void 0 : _cells_font.color;
1076
1126
  let fontColor;
1077
1127
  if (Array.isArray(rawFontColor)) {
1078
- const entry = rawFontColor[colIndex];
1128
+ var _rawFontColor_colIndex;
1129
+ const entry = (_rawFontColor_colIndex = rawFontColor[colIndex]) !== null && _rawFontColor_colIndex !== void 0 ? _rawFontColor_colIndex : rawFontColor[0];
1079
1130
  const colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1080
1131
  fontColor = typeof colorValue === 'string' ? colorValue : undefined;
1081
1132
  } else if (typeof rawFontColor === 'string') {
@@ -1084,7 +1135,8 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
1084
1135
  const rawFontSize = cells === null || cells === void 0 ? void 0 : (_cells_font1 = cells.font) === null || _cells_font1 === void 0 ? void 0 : _cells_font1.size;
1085
1136
  let fontSize;
1086
1137
  if (Array.isArray(rawFontSize)) {
1087
- const entry = rawFontSize[colIndex];
1138
+ var _rawFontSize_colIndex;
1139
+ const entry = (_rawFontSize_colIndex = rawFontSize[colIndex]) !== null && _rawFontSize_colIndex !== void 0 ? _rawFontSize_colIndex : rawFontSize[0];
1088
1140
  const fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1089
1141
  fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
1090
1142
  } else if (typeof rawFontSize === 'number') {
@@ -1094,13 +1146,15 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
1094
1146
  const rawBackgroundColor = cells === null || cells === void 0 ? void 0 : (_cells_fill = cells.fill) === null || _cells_fill === void 0 ? void 0 : _cells_fill.color;
1095
1147
  let backgroundColor;
1096
1148
  if (Array.isArray(rawBackgroundColor)) {
1097
- const entry = rawBackgroundColor[updatedColIndex];
1149
+ var _rawBackgroundColor_updatedColIndex;
1150
+ const entry = (_rawBackgroundColor_updatedColIndex = rawBackgroundColor[updatedColIndex]) !== null && _rawBackgroundColor_updatedColIndex !== void 0 ? _rawBackgroundColor_updatedColIndex : rawBackgroundColor[0];
1098
1151
  const colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1099
1152
  backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
1100
1153
  } else if (typeof rawBackgroundColor === 'string') {
1101
1154
  backgroundColor = rawBackgroundColor;
1102
1155
  }
1103
- const rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? cells.align[colIndex] : cells === null || cells === void 0 ? void 0 : cells.align;
1156
+ var _cells_align_colIndex;
1157
+ const rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? (_cells_align_colIndex = cells.align[colIndex]) !== null && _cells_align_colIndex !== void 0 ? _cells_align_colIndex : cells.align[0] : cells === null || cells === void 0 ? void 0 : cells.align;
1104
1158
  const textAlign = rawTextAlign;
1105
1159
  const style = {
1106
1160
  ...fontColor ? {
@@ -1130,7 +1184,7 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
1130
1184
  };
1131
1185
  var _tableData_header_values;
1132
1186
  return {
1133
- headers: normalizeHeaders((_tableData_header_values = (_tableData_header = tableData.header) === null || _tableData_header === void 0 ? void 0 : _tableData_header.values) !== null && _tableData_header_values !== void 0 ? _tableData_header_values : [], ((_tableData_header1 = tableData.header) === null || _tableData_header1 === void 0 ? void 0 : _tableData_header1.font) ? tableData.header : (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template1 = _input_layout2.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template1.data) === null || _input_layout_template_data1 === void 0 ? void 0 : _input_layout_template_data1.table[0].header),
1187
+ headers: normalizeHeaders((_tableData_header_values = (_tableData_header = tableData.header) === null || _tableData_header === void 0 ? void 0 : _tableData_header.values) !== null && _tableData_header_values !== void 0 ? _tableData_header_values : [], tableData.header && Object.keys(tableData.header).length > 0 ? tableData.header : (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template1 = _input_layout2.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template1.data) === null || _input_layout_template_data1 === void 0 ? void 0 : _input_layout_template_data1.table[0].header),
1134
1188
  rows,
1135
1189
  width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
1136
1190
  height: (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height,
@@ -1138,27 +1192,133 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
1138
1192
  };
1139
1193
  };
1140
1194
  const projectPolarToCartesian = (input)=>{
1195
+ var _input_layout, _input_layout1;
1141
1196
  const projection = {
1142
1197
  ...input
1143
1198
  };
1199
+ // 1. Find the global min and max radius across all series
1200
+ let minRadius = 0;
1201
+ let maxRadius = 0;
1144
1202
  for(let sindex = 0; sindex < input.data.length; sindex++){
1145
- var _series_r;
1203
+ const rVals = input.data[sindex].r;
1204
+ if (rVals && (0, _chartutilities.isArrayOrTypedArray)(rVals)) {
1205
+ for(let ptindex = 0; ptindex < rVals.length; ptindex++){
1206
+ if (!(0, _chartutilities.isInvalidValue)(rVals[ptindex])) {
1207
+ minRadius = Math.min(minRadius, rVals[ptindex]);
1208
+ maxRadius = Math.max(maxRadius, rVals[ptindex]);
1209
+ }
1210
+ }
1211
+ }
1212
+ }
1213
+ // 2. If there are negative radii, compute the shift
1214
+ const radiusShift = minRadius < 0 ? -minRadius : 0;
1215
+ // 3. Project all points and create a perfect square domain
1216
+ const allX = [];
1217
+ const allY = [];
1218
+ let originX = null;
1219
+ for(let sindex = 0; sindex < input.data.length; sindex++){
1220
+ var _input_layout_polar_angularaxis, _input_layout_polar, _input_layout2, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout3;
1146
1221
  const series = input.data[sindex];
1222
+ // If scatterpolar, set text to theta values as strings
1223
+ if (series.type === 'scatterpolar' && Array.isArray(series.theta)) {
1224
+ series.text = series.theta.map((v)=>String(v));
1225
+ }
1147
1226
  series.x = [];
1148
1227
  series.y = [];
1149
- var _series_r_length;
1150
- for(let ptindex = 0; ptindex < ((_series_r_length = (_series_r = series.r) === null || _series_r === void 0 ? void 0 : _series_r.length) !== null && _series_r_length !== void 0 ? _series_r_length : 0); ptindex++){
1151
- var _series_theta, _series_r1;
1152
- if ((0, _chartutilities.isInvalidValue)((_series_theta = series.theta) === null || _series_theta === void 0 ? void 0 : _series_theta[ptindex]) || (0, _chartutilities.isInvalidValue)((_series_r1 = series.r) === null || _series_r1 === void 0 ? void 0 : _series_r1[ptindex])) {
1228
+ const thetas = series.theta;
1229
+ const rVals = series.r;
1230
+ // Skip if rVals or thetas are not arrays
1231
+ if (!(0, _chartutilities.isArrayOrTypedArray)(rVals) || !(0, _chartutilities.isArrayOrTypedArray)(thetas)) {
1232
+ projection.data[sindex] = series;
1233
+ continue;
1234
+ }
1235
+ // retrieve polar axis settings
1236
+ const dirMultiplier = ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_polar = _input_layout2.polar) === null || _input_layout_polar === void 0 ? void 0 : (_input_layout_polar_angularaxis = _input_layout_polar.angularaxis) === null || _input_layout_polar_angularaxis === void 0 ? void 0 : _input_layout_polar_angularaxis.direction) === 'clockwise' ? -1 : 1;
1237
+ var _input_layout_polar_angularaxis_rotation;
1238
+ const startAngleInRad = ((_input_layout_polar_angularaxis_rotation = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_polar1 = _input_layout3.polar) === null || _input_layout_polar1 === void 0 ? void 0 : (_input_layout_polar_angularaxis1 = _input_layout_polar1.angularaxis) === null || _input_layout_polar_angularaxis1 === void 0 ? void 0 : _input_layout_polar_angularaxis1.rotation) !== null && _input_layout_polar_angularaxis_rotation !== void 0 ? _input_layout_polar_angularaxis_rotation : 0) * Math.PI / 180;
1239
+ // Compute tick positions if categorical
1240
+ let uniqueTheta = [];
1241
+ let categorical = false;
1242
+ if (!(0, _chartutilities.isNumberArray)(thetas)) {
1243
+ uniqueTheta = Array.from(new Set(thetas));
1244
+ categorical = true;
1245
+ }
1246
+ for(let ptindex = 0; ptindex < rVals.length; ptindex++){
1247
+ if ((0, _chartutilities.isInvalidValue)(thetas === null || thetas === void 0 ? void 0 : thetas[ptindex]) || (0, _chartutilities.isInvalidValue)(rVals === null || rVals === void 0 ? void 0 : rVals[ptindex])) {
1153
1248
  continue;
1154
1249
  }
1155
- const thetaRad = series.theta[ptindex] * Math.PI / 180;
1156
- const radius = series.r[ptindex];
1157
- series.x.push(radius * Math.cos(thetaRad));
1158
- series.y.push(radius * Math.sin(thetaRad));
1250
+ // 4. Map theta to angle in radians
1251
+ let thetaRad;
1252
+ if (categorical) {
1253
+ const idx = uniqueTheta.indexOf(thetas[ptindex]);
1254
+ const step = 2 * Math.PI / uniqueTheta.length;
1255
+ thetaRad = startAngleInRad + dirMultiplier * idx * step;
1256
+ } else {
1257
+ thetaRad = startAngleInRad + dirMultiplier * (thetas[ptindex] * Math.PI / 180);
1258
+ }
1259
+ // 5. Shift only the polar origin (not the cartesian)
1260
+ const rawRadius = rVals[ptindex];
1261
+ const polarRadius = rawRadius + radiusShift; // Only for projection
1262
+ // 6. Calculate cartesian coordinates (with shifted polar origin)
1263
+ const x = polarRadius * Math.cos(thetaRad);
1264
+ const y = polarRadius * Math.sin(thetaRad);
1265
+ // Calculate the cartesian coordinates of the original polar origin (0,0)
1266
+ // This is the point that should be mapped to (0,0) in cartesian coordinates
1267
+ if (sindex === 0 && ptindex === 0) {
1268
+ // For polar origin (r=0, θ=0), cartesian coordinates are (0,0)
1269
+ // But since we shifted the radius by radiusShift, the cartesian origin is at (radiusShift, 0)
1270
+ originX = radiusShift;
1271
+ }
1272
+ series.x.push(x);
1273
+ series.y.push(y);
1274
+ allX.push(x);
1275
+ allY.push(y);
1276
+ }
1277
+ // Map text to each data point for downstream chart rendering
1278
+ if (series.x && series.y) {
1279
+ series.data = series.x.map((xVal, idx)=>({
1280
+ x: xVal,
1281
+ y: series.y[idx],
1282
+ ...series.text ? {
1283
+ text: series.text[idx]
1284
+ } : {}
1285
+ }));
1159
1286
  }
1160
1287
  projection.data[sindex] = series;
1161
1288
  }
1289
+ // 7. Recenter all cartesian coordinates
1290
+ if (originX !== null) {
1291
+ for(let sindex = 0; sindex < projection.data.length; sindex++){
1292
+ const series = projection.data[sindex];
1293
+ if (series.x && series.y) {
1294
+ series.x = series.x.map((v)=>v - originX);
1295
+ }
1296
+ }
1297
+ // Also recenter allX for normalization
1298
+ for(let i = 0; i < allX.length; i++){
1299
+ allX[i] = allX[i] - originX;
1300
+ }
1301
+ }
1302
+ // 8. Find the maximum absolute value among all x and y
1303
+ let maxAbs = Math.max(...allX.map(Math.abs), ...allY.map(Math.abs));
1304
+ maxAbs = maxAbs === 0 ? 1 : maxAbs;
1305
+ // 9. Rescale all points so that the largest |x| or |y| is 0.5
1306
+ for(let sindex = 0; sindex < projection.data.length; sindex++){
1307
+ const series = projection.data[sindex];
1308
+ if (series.x && series.y) {
1309
+ series.x = series.x.map((v)=>v / (2 * maxAbs));
1310
+ series.y = series.y.map((v)=>v / (2 * maxAbs));
1311
+ }
1312
+ }
1313
+ // 10. Customize layout for perfect square with absolute positioning
1314
+ const size = ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width) || ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) || 500;
1315
+ projection.layout = {
1316
+ ...projection.layout,
1317
+ width: size,
1318
+ height: size
1319
+ };
1320
+ // Attach originX as custom properties
1321
+ projection.layout.__polarOriginX = originX !== null && originX !== void 0 ? originX : undefined;
1162
1322
  return projection;
1163
1323
  };
1164
1324
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1333,25 +1493,44 @@ const getLegendShape = (series)=>{
1333
1493
  }
1334
1494
  return 'default';
1335
1495
  };
1336
- const getAllupLegendsProps = (input, colorMap, colorwayType, isDarkTheme)=>{
1496
+ const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, isDarkTheme)=>{
1337
1497
  const allupLegends = [];
1338
1498
  // reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
1339
1499
  const toShowLegend = input.data.reduce((acc, series)=>{
1340
- return acc || series.showlegend === true;
1500
+ return acc || series.showlegend === true || series.showlegend === undefined;
1341
1501
  }, false);
1342
1502
  if (toShowLegend) {
1343
1503
  input.data.forEach((series, index)=>{
1344
- var _series_line, _series_marker, _input_layout_template_layout, _input_layout_template, _input_layout;
1345
- const name = series.legendgroup;
1346
- const color = ((_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color) || ((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color);
1347
- const legendShape = getLegendShape(series);
1348
- const resolvedColor = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, color, colorMap, isDarkTheme);
1349
- if (name !== undefined && allupLegends.some((group)=>group.title === name) === false) {
1350
- allupLegends.push({
1351
- title: name,
1352
- color: resolvedColor,
1353
- shape: legendShape
1504
+ if (traceInfo[index].type === 'donut') {
1505
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker, _pieSeries_labels;
1506
+ const pieSeries = series;
1507
+ var _input_layout_piecolorway, _input_layout_piecolorway1;
1508
+ const colors = (0, _PlotlyColorAdapter.extractColor)((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : pieSeries === null || pieSeries === void 0 ? void 0 : (_pieSeries_marker = pieSeries.marker) === null || _pieSeries_marker === void 0 ? void 0 : _pieSeries_marker.colors, colorMap, isDarkTheme);
1509
+ (_pieSeries_labels = pieSeries.labels) === null || _pieSeries_labels === void 0 ? void 0 : _pieSeries_labels.forEach((label, labelIndex)=>{
1510
+ const legend = `${label}`;
1511
+ // resolve color for each legend from the extracted colors
1512
+ const color = (0, _PlotlyColorAdapter.resolveColor)(colors, labelIndex, legend, colorMap, isDarkTheme);
1513
+ if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
1514
+ allupLegends.push({
1515
+ title: legend,
1516
+ color
1517
+ });
1518
+ }
1354
1519
  });
1520
+ } else if (isNonPlotType(traceInfo[index].type) === false) {
1521
+ var _plotSeries_line, _plotSeries_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout3;
1522
+ const plotSeries = series;
1523
+ const name = plotSeries.legendgroup;
1524
+ const color = ((_plotSeries_line = plotSeries.line) === null || _plotSeries_line === void 0 ? void 0 : _plotSeries_line.color) || ((_plotSeries_marker = plotSeries.marker) === null || _plotSeries_marker === void 0 ? void 0 : _plotSeries_marker.color);
1525
+ const legendShape = getLegendShape(plotSeries);
1526
+ const resolvedColor = (0, _PlotlyColorAdapter.extractColor)((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_template1 = _input_layout3.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, color, colorMap, isDarkTheme);
1527
+ if (name !== undefined && name !== '' && allupLegends.some((group)=>group.title === name) === false) {
1528
+ allupLegends.push({
1529
+ title: name,
1530
+ color: resolvedColor,
1531
+ shape: legendShape
1532
+ });
1533
+ }
1355
1534
  }
1356
1535
  });
1357
1536
  }
@@ -1417,28 +1596,21 @@ const getIndexFromKey = (key, pattern)=>{
1417
1596
  const normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
1418
1597
  return parseInt(normalizedKey, 10) - 1;
1419
1598
  };
1420
- const getGridProperties = (layout, isMultiPlot)=>{
1421
- var _layout_annotations;
1422
- const gridX = [];
1423
- const gridY = [];
1599
+ const isNonPlotType = (chartType)=>{
1600
+ return [
1601
+ 'donut',
1602
+ 'sankey',
1603
+ 'pie'
1604
+ ].includes(chartType);
1605
+ };
1606
+ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
1607
+ const domainX = [];
1608
+ const domainY = [];
1609
+ let cartesianDomains = 0;
1424
1610
  const annotations = {};
1425
1611
  let templateRows = '1fr';
1426
1612
  let templateColumns = '1fr';
1427
1613
  const gridLayout = {};
1428
- if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
1429
- return {
1430
- templateRows,
1431
- templateColumns,
1432
- layout: gridLayout
1433
- };
1434
- }
1435
- if (!layout.xaxis || !layout.yaxis) {
1436
- return {
1437
- templateRows,
1438
- templateColumns,
1439
- layout: gridLayout
1440
- };
1441
- }
1442
1614
  if (!isMultiPlot) {
1443
1615
  return {
1444
1616
  templateRows,
@@ -1446,143 +1618,214 @@ const getGridProperties = (layout, isMultiPlot)=>{
1446
1618
  layout: gridLayout
1447
1619
  };
1448
1620
  }
1449
- Object.keys(layout).forEach((key)=>{
1450
- if (key.startsWith('xaxis')) {
1451
- var _layout_key, _layout_key1;
1452
- const index = getIndexFromKey(key, 'xaxis');
1453
- var _layout_key_anchor;
1454
- const anchor = (_layout_key_anchor = (_layout_key = layout[key]) === null || _layout_key === void 0 ? void 0 : _layout_key.anchor) !== null && _layout_key_anchor !== void 0 ? _layout_key_anchor : 'y';
1455
- const anchorIndex = getIndexFromKey(anchor, 'y');
1456
- if (index !== anchorIndex) {
1457
- throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
1458
- }
1459
- var _layout_key_domain;
1460
- gridX[index] = (_layout_key_domain = (_layout_key1 = layout[key]) === null || _layout_key1 === void 0 ? void 0 : _layout_key1.domain) !== null && _layout_key_domain !== void 0 ? _layout_key_domain : [];
1461
- } else if (key.startsWith('yaxis')) {
1462
- var _layout_key2, _layout_key3;
1463
- const index = getIndexFromKey(key, 'yaxis');
1464
- var _layout_key_anchor1;
1465
- const anchor = (_layout_key_anchor1 = (_layout_key2 = layout[key]) === null || _layout_key2 === void 0 ? void 0 : _layout_key2.anchor) !== null && _layout_key_anchor1 !== void 0 ? _layout_key_anchor1 : 'x';
1466
- const anchorIndex = getIndexFromKey(anchor, 'x');
1467
- if (index !== anchorIndex) {
1468
- var _layout_yaxis2;
1469
- if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
1470
- // Special case for secondary y axis where yaxis2 can anchor to x1
1471
- return {
1472
- templateRows,
1473
- templateColumns
1474
- };
1621
+ const layout = schema === null || schema === void 0 ? void 0 : schema.layout;
1622
+ if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
1623
+ Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
1624
+ if (key.startsWith('xaxis')) {
1625
+ var _layout_key;
1626
+ const index = getIndexFromKey(key, 'xaxis');
1627
+ var _layout_key_anchor;
1628
+ const anchor = (_layout_key_anchor = (_layout_key = layout[key]) === null || _layout_key === void 0 ? void 0 : _layout_key.anchor) !== null && _layout_key_anchor !== void 0 ? _layout_key_anchor : 'y';
1629
+ const anchorIndex = getIndexFromKey(anchor, 'y');
1630
+ if (index !== anchorIndex) {
1631
+ throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
1475
1632
  }
1476
- throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
1633
+ const xAxisLayout = layout[key];
1634
+ const domainXInfo = {
1635
+ start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
1636
+ end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1
1637
+ };
1638
+ domainX.push(domainXInfo);
1639
+ } else if (key.startsWith('yaxis')) {
1640
+ var _layout_key1;
1641
+ const index = getIndexFromKey(key, 'yaxis');
1642
+ var _layout_key_anchor1;
1643
+ const anchor = (_layout_key_anchor1 = (_layout_key1 = layout[key]) === null || _layout_key1 === void 0 ? void 0 : _layout_key1.anchor) !== null && _layout_key_anchor1 !== void 0 ? _layout_key_anchor1 : 'x';
1644
+ const anchorIndex = getIndexFromKey(anchor, 'x');
1645
+ if (index !== anchorIndex) {
1646
+ var _layout_yaxis2;
1647
+ if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
1648
+ // Special case for secondary y axis where yaxis2 can anchor to x1
1649
+ return {
1650
+ templateRows,
1651
+ templateColumns
1652
+ };
1653
+ }
1654
+ throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
1655
+ }
1656
+ const yAxisLayout = layout[key];
1657
+ const domainYInfo = {
1658
+ start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
1659
+ end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1
1660
+ };
1661
+ domainY.push(domainYInfo);
1477
1662
  }
1478
- var _layout_key_domain1;
1479
- gridY[index] = (_layout_key_domain1 = (_layout_key3 = layout[key]) === null || _layout_key3 === void 0 ? void 0 : _layout_key3.domain) !== null && _layout_key_domain1 !== void 0 ? _layout_key_domain1 : [];
1663
+ });
1664
+ }
1665
+ cartesianDomains = domainX.length; // Assuming that the number of x and y axes is the same
1666
+ validTracesInfo.forEach((trace, index)=>{
1667
+ if (isNonPlotType(trace.type)) {
1668
+ var _schema_data, _series_domain, _series_domain1, _series_domain2, _series_domain3;
1669
+ const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
1670
+ const domainXInfo = {
1671
+ start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
1672
+ end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1
1673
+ };
1674
+ const domainYInfo = {
1675
+ start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
1676
+ end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1
1677
+ };
1678
+ domainX.push(domainXInfo);
1679
+ domainY.push(domainYInfo);
1480
1680
  }
1481
1681
  });
1482
- (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
1483
- const xMatches = gridX.flatMap((interval, idx)=>(annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval[1] ? [
1484
- idx
1485
- ] : []);
1486
- const yMatch = gridY.findIndex((interval, yIndex)=>xMatches.includes(yIndex) && (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval[1]);
1487
- if (yMatch !== -1) {
1488
- if (annotations[yMatch] === undefined) {
1489
- annotations[yMatch] = {};
1490
- }
1491
- if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1492
- annotations[yMatch].yAnnotation = annotation.text;
1493
- } else {
1494
- annotations[yMatch].xAnnotation = annotation.text;
1682
+ if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
1683
+ var _layout_annotations;
1684
+ (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
1685
+ const xMatches = domainX.flatMap((interval, idx)=>(annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval.start && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval.end ? [
1686
+ idx
1687
+ ] : []);
1688
+ const yMatch = domainY.findIndex((interval, yIndex)=>xMatches.includes(yIndex) && (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval.start && (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval.end);
1689
+ if (yMatch !== -1) {
1690
+ if (annotations[yMatch] === undefined) {
1691
+ annotations[yMatch] = {};
1692
+ }
1693
+ if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1694
+ annotations[yMatch].yAnnotation = annotation.text;
1695
+ } else {
1696
+ annotations[yMatch].xAnnotation = annotation.text;
1697
+ }
1495
1698
  }
1496
- }
1497
- });
1498
- if (gridX.length > 0) {
1699
+ });
1700
+ }
1701
+ if (domainX.length > 0) {
1499
1702
  const uniqueXIntervals = new Map();
1500
- gridX.forEach((interval)=>{
1501
- const key = `${interval[0]}-${interval[1]}`;
1703
+ domainX.forEach((interval)=>{
1704
+ const key = `${interval.start}-${interval.end}`;
1502
1705
  if (!uniqueXIntervals.has(key)) {
1503
1706
  uniqueXIntervals.set(key, interval);
1504
1707
  }
1505
1708
  });
1506
- const minXInterval = Math.min(...Array.from(uniqueXIntervals.values()).map((interval)=>interval[1] - interval[0]));
1507
- templateColumns = Array.from(uniqueXIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minXInterval}fr`).join(' ');
1508
- let columnNumber = 1;
1509
- let lastIntervalEnd = 0;
1510
- gridX.forEach((interval, index)=>{
1511
- if (interval.length === 0) {
1512
- return;
1513
- }
1514
- const cellName = `x${index === 0 ? '' : index + 1}`;
1709
+ const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
1710
+ templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
1711
+ domainX.forEach((interval, index)=>{
1712
+ const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
1713
+ const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
1714
+ const columnNumber = columnIndex + 1; // Column numbers are 1-based
1515
1715
  const annotationProps = annotations[index];
1516
1716
  const xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
1517
- if (interval[0] < lastIntervalEnd) {
1518
- columnNumber = 1;
1519
- }
1520
- lastIntervalEnd = interval[1];
1521
1717
  const row = {
1522
1718
  row: -1,
1523
1719
  column: columnNumber,
1524
- xAnnotation
1720
+ xAnnotation,
1721
+ xDomain: interval,
1722
+ yDomain: {
1723
+ start: 0,
1724
+ end: 1
1725
+ }
1525
1726
  };
1526
1727
  gridLayout[cellName] = row;
1527
- columnNumber += 1;
1528
1728
  });
1529
1729
  }
1530
- const numColumns = Math.max(...Object.values(gridLayout).map((cell)=>{
1531
- var _cell_column;
1532
- return (_cell_column = cell.column) !== null && _cell_column !== void 0 ? _cell_column : 0;
1533
- }));
1534
- const columnFill = {};
1535
- for(let i = 1; i <= numColumns; i++){
1536
- columnFill[i] = {
1537
- row: 1,
1538
- fillDomain: 0
1539
- };
1540
- }
1541
- if (gridY.length > 0) {
1730
+ if (domainY.length > 0) {
1542
1731
  const uniqueYIntervals = new Map();
1543
- gridY.forEach((interval)=>{
1544
- const key = `${interval[0]}-${interval[1]}`;
1732
+ domainY.forEach((interval)=>{
1733
+ const key = `${interval.start}-${interval.end}`;
1545
1734
  if (!uniqueYIntervals.has(key)) {
1546
1735
  uniqueYIntervals.set(key, interval);
1547
1736
  }
1548
1737
  });
1549
- const minYInterval = Math.min(...Array.from(uniqueYIntervals.values()).map((interval)=>interval[1] - interval[0]));
1550
- templateRows = Array.from(uniqueYIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minYInterval}fr`).join(' ');
1551
- gridY.forEach((interval, index)=>{
1552
- if (interval.length === 0) {
1553
- return;
1554
- }
1555
- const cellName = `x${index === 0 ? '' : index + 1}`;
1738
+ const sortedYStart = Array.from(uniqueYIntervals.values()).map((interval)=>interval.start).sort();
1739
+ const numberOfRows = sortedYStart.length;
1740
+ templateRows = `repeat(${numberOfRows}, 1fr)`;
1741
+ domainY.forEach((interval, index)=>{
1742
+ const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
1743
+ const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
1744
+ const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
1556
1745
  const annotationProps = annotations[index];
1557
1746
  const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
1558
1747
  const cell = gridLayout[cellName];
1559
1748
  if (cell !== undefined) {
1560
- cell.row = columnFill[cell.column].row;
1749
+ cell.row = rowNumber;
1561
1750
  cell.yAnnotation = yAnnotation;
1751
+ cell.yDomain = interval;
1562
1752
  }
1563
- columnFill[cell.column].fillDomain = interval[1];
1564
- columnFill[cell.column].row += 1;
1565
1753
  });
1566
1754
  }
1567
- // reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
1568
- const reversedGridLayout = {};
1569
- // find the maximum row number
1570
- const maxRowNumber = Math.max(...Object.values(gridLayout).map((cell)=>{
1571
- var _cell_row;
1572
- return (_cell_row = cell.row) !== null && _cell_row !== void 0 ? _cell_row : 0;
1573
- }));
1574
- // iterate over the gridLayout and reverse the row numbers
1575
- Object.keys(gridLayout).forEach((key)=>{
1576
- const cell = gridLayout[key];
1577
- if (cell.row !== undefined) {
1578
- // reverse the row number
1579
- cell.row = maxRowNumber - cell.row + 1;
1580
- }
1581
- reversedGridLayout[key] = cell;
1582
- });
1583
1755
  return {
1584
1756
  templateRows,
1585
1757
  templateColumns,
1586
- layout: reversedGridLayout
1758
+ layout: gridLayout
1759
+ };
1760
+ };
1761
+ /**
1762
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
1763
+ */ const getAxisCategoryOrderProps = (data, layout)=>{
1764
+ const result = {};
1765
+ const axesById = {
1766
+ x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
1767
+ y: layout === null || layout === void 0 ? void 0 : layout.yaxis
1768
+ };
1769
+ Object.keys(axesById).forEach((axId)=>{
1770
+ const ax = axesById[axId];
1771
+ const axLetter = axId[0];
1772
+ const propName = `${axLetter}AxisCategoryOrder`;
1773
+ const values = [];
1774
+ data.forEach((series)=>{
1775
+ var _series_axLetter;
1776
+ (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
1777
+ if (!(0, _chartutilities.isInvalidValue)(val)) {
1778
+ values.push(val);
1779
+ }
1780
+ });
1781
+ });
1782
+ const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || (0, _chartutilities.isStringArray)(values) && !(0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isDateArray)(values);
1783
+ if (!isAxisTypeCategory) {
1784
+ return;
1785
+ }
1786
+ const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
1787
+ if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
1788
+ result[propName] = ax.categoryarray;
1789
+ return;
1790
+ }
1791
+ if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1792
+ const categoriesInTraceOrder = Array.from(new Set(values));
1793
+ result[propName] = categoriesInTraceOrder;
1794
+ return;
1795
+ }
1796
+ result[propName] = ax.categoryorder;
1797
+ });
1798
+ return result;
1799
+ };
1800
+ const getBarProps = (data, layout, isHorizontal)=>{
1801
+ let padding;
1802
+ if (typeof (layout === null || layout === void 0 ? void 0 : layout.bargap) === 'number') {
1803
+ padding = layout.bargap;
1804
+ }
1805
+ const plotlyBarWidths = data.map((series)=>{
1806
+ if (series.type === 'bar' && ((0, _chartutilities.isArrayOrTypedArray)(series.width) || typeof series.width === 'number')) {
1807
+ return series.width;
1808
+ }
1809
+ return [];
1810
+ }).flat();
1811
+ const maxPlotlyBarWidth = (0, _d3array.max)(plotlyBarWidths);
1812
+ if (typeof maxPlotlyBarWidth === 'number') {
1813
+ padding = 1 - maxPlotlyBarWidth;
1814
+ padding = Math.max(0, Math.min(padding, 1));
1815
+ }
1816
+ if (typeof padding === 'undefined') {
1817
+ return {};
1818
+ }
1819
+ if (isHorizontal) {
1820
+ return {
1821
+ maxBarHeight: 1000,
1822
+ yAxisPadding: padding
1823
+ };
1824
+ }
1825
+ return {
1826
+ barWidth: 'auto',
1827
+ maxBarWidth: 1000,
1828
+ xAxisInnerPadding: padding,
1829
+ xAxisOuterPadding: padding / 2
1587
1830
  };
1588
1831
  };