@fluentui/react-charts 0.0.0-nightly-20250826-0412.1 → 0.0.0-nightly-20250826-2140.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 (150) hide show
  1. package/CHANGELOG.md +15 -48
  2. package/dist/index.d.ts +1 -15
  3. package/lib/components/AreaChart/AreaChart.js +1 -4
  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 +15 -3
  8. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  9. package/lib/components/CommonComponents/CartesianChart.js +24 -24
  10. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  11. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +14 -17
  12. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  13. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +33 -6
  14. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  15. package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -32
  16. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  17. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
  18. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  19. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +199 -294
  20. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  21. package/lib/components/DonutChart/DonutChart.js +1 -6
  22. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  23. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  24. package/lib/components/DonutChart/useDonutChartStyles.styles.js +4 -21
  25. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  26. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +4 -8
  27. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  28. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +4 -23
  29. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  30. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +17 -4
  31. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  32. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +21 -4
  33. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  34. package/lib/components/HeatMapChart/HeatMapChart.js +114 -175
  35. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  36. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +6 -26
  37. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  38. package/lib/components/LineChart/LineChart.js +81 -111
  39. package/lib/components/LineChart/LineChart.js.map +1 -1
  40. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  41. package/lib/components/LineChart/useLineChartStyles.styles.js +10 -23
  42. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  43. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +21 -4
  44. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  45. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +25 -12
  46. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  47. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +12 -2
  48. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  49. package/lib/components/ScatterChart/ScatterChart.js +30 -49
  50. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  51. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  52. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +7 -27
  53. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  54. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +14 -8
  55. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  56. package/lib/components/VerticalBarChart/VerticalBarChart.js +4 -27
  57. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  58. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +6 -8
  59. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  60. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +19 -5
  61. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  62. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +44 -61
  63. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  64. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +6 -7
  65. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  66. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +19 -4
  67. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  68. package/lib/utilities/SVGTooltipText.js.map +1 -1
  69. package/lib/utilities/index.js +0 -1
  70. package/lib/utilities/index.js.map +1 -1
  71. package/lib/utilities/utilities.js +29 -0
  72. package/lib/utilities/utilities.js.map +1 -1
  73. package/lib-commonjs/components/AreaChart/AreaChart.js +1 -4
  74. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  75. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  76. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +14 -2
  77. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  78. package/lib-commonjs/components/CommonComponents/CartesianChart.js +24 -24
  79. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  80. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +13 -15
  81. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  82. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +32 -4
  83. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  84. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +15 -31
  85. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  86. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
  87. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  88. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +198 -302
  89. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  90. package/lib-commonjs/components/DonutChart/DonutChart.js +1 -6
  91. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  92. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  93. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +4 -32
  94. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  95. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +4 -8
  96. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  97. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +3 -22
  98. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  99. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +19 -2
  100. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  101. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +20 -3
  102. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  103. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +113 -174
  104. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  105. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +5 -25
  106. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  107. package/lib-commonjs/components/LineChart/LineChart.js +81 -111
  108. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  109. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  110. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +9 -30
  111. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  112. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +20 -2
  113. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  114. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +33 -23
  115. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  116. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +12 -1
  117. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  118. package/lib-commonjs/components/ScatterChart/ScatterChart.js +30 -49
  119. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  120. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  121. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +5 -37
  122. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  123. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +13 -7
  124. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  125. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +3 -26
  126. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  127. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +3 -5
  128. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  129. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +17 -3
  130. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  131. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +43 -60
  132. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  133. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +3 -5
  134. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  135. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +18 -3
  136. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  137. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  138. package/lib-commonjs/utilities/index.js +0 -1
  139. package/lib-commonjs/utilities/index.js.map +1 -1
  140. package/lib-commonjs/utilities/utilities.js +32 -0
  141. package/lib-commonjs/utilities/utilities.js.map +1 -1
  142. package/package.json +12 -12
  143. package/lib/utilities/Common.styles.js +0 -47
  144. package/lib/utilities/Common.styles.js.map +0 -1
  145. package/lib/utilities/Common.styles.raw.js +0 -47
  146. package/lib/utilities/Common.styles.raw.js.map +0 -1
  147. package/lib-commonjs/utilities/Common.styles.js +0 -71
  148. package/lib-commonjs/utilities/Common.styles.js.map +0 -1
  149. package/lib-commonjs/utilities/Common.styles.raw.js +0 -71
  150. package/lib-commonjs/utilities/Common.styles.raw.js.map +0 -1
@@ -4,12 +4,10 @@ import { scaleLinear as d3ScaleLinear } from 'd3-scale';
4
4
  import { format as d3Format } from 'd3-format';
5
5
  import { DataVizPalette, getColorFromToken } from '../../utilities/colors';
6
6
  import { findNumericMinMaxOfY, formatScientificLimitWidth, MIN_DONUT_RADIUS } from '../../utilities/utilities';
7
- import { isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isStringArray, isYearArray, isInvalidValue, formatToLocaleString } from '@fluentui/chart-utilities';
7
+ import { isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isStringArray, isYearArray, isInvalidValue } from '@fluentui/chart-utilities';
8
8
  import { curveCardinal as d3CurveCardinal } from 'd3-shape';
9
9
  import { getOpacity, extractColor, resolveColor } from './PlotlyColorAdapter';
10
10
  import { rgb } from 'd3-color';
11
- export const NON_PLOT_KEY_PREFIX = 'nonplot_';
12
- export const SINGLE_REPEAT = 'repeat(1, 1fr)';
13
11
  const dashOptions = {
14
12
  dot: {
15
13
  strokeDasharray: '1, 5',
@@ -58,47 +56,6 @@ function getTitles(layout) {
58
56
  };
59
57
  return titles;
60
58
  }
61
- const getXAxisTickFormat = (series, layout)=>{
62
- const xAxis = getXAxisProperties(series, layout);
63
- if (xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat) {
64
- return {
65
- tickFormat: xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat
66
- };
67
- }
68
- return {};
69
- };
70
- const getYAxisTickFormat = (series, layout)=>{
71
- const yAxis = getYAxisProperties(series, layout);
72
- if (yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat) {
73
- return {
74
- yAxisTickFormat: d3Format(yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat)
75
- };
76
- }
77
- return {};
78
- };
79
- const getYMinMaxValues = (series, layout)=>{
80
- var _getYAxisProperties;
81
- const range = (_getYAxisProperties = getYAxisProperties(series, layout)) === null || _getYAxisProperties === void 0 ? void 0 : _getYAxisProperties.range;
82
- if (range && range.length === 2) {
83
- return {
84
- yMinValue: range[0],
85
- yMaxValue: range[1]
86
- };
87
- }
88
- return {};
89
- };
90
- const getYAxisProperties = (series, layout)=>{
91
- return layout === null || layout === void 0 ? void 0 : layout.yaxis;
92
- };
93
- const getXAxisProperties = (series, layout)=>{
94
- return layout === null || layout === void 0 ? void 0 : layout.xaxis;
95
- };
96
- const getFormattedCalloutYData = (yVal, yAxisFormat)=>{
97
- if (typeof (yAxisFormat === null || yAxisFormat === void 0 ? void 0 : yAxisFormat.yAxisTickFormat) === 'function' && typeof yVal === 'number') {
98
- return yAxisFormat.yAxisTickFormat(yVal);
99
- }
100
- return formatToLocaleString(yVal);
101
- };
102
59
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
60
  export const correctYearMonth = (xValues)=>{
104
61
  const presentYear = new Date().getFullYear();
@@ -243,7 +200,7 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
243
200
  chartTitle,
244
201
  chartData: Object.values(mapLegendToDataPoint)
245
202
  },
246
- hideLegend: isMultiPlot || ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false,
203
+ hideLegend: ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false ? true : false,
247
204
  width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
248
205
  height,
249
206
  innerRadius,
@@ -262,7 +219,6 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
262
219
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
263
220
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
264
221
  let colorScale = undefined;
265
- const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
266
222
  let yMinValue = 0;
267
223
  input.data.forEach((series, index1)=>{
268
224
  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;
@@ -296,7 +252,6 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
296
252
  const color = colorScale ? colorScale(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) : resolveColor(extractedBarColors, index2, legend, colorMap, isDarkTheme);
297
253
  const opacity = getOpacity(series, index2);
298
254
  const yVal = rangeYValues[index2];
299
- const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
300
255
  if (series.type === 'bar') {
301
256
  var _rgb_copy_formatHex8;
302
257
  mapXToDataPoints[x].chartData.push({
@@ -304,8 +259,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
304
259
  data: yVal,
305
260
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
306
261
  opacity
307
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
308
- yAxisCalloutData
262
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
309
263
  });
310
264
  if (typeof yVal === 'number') {
311
265
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -327,8 +281,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
327
281
  ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
328
282
  mode: series.mode
329
283
  },
330
- useSecondaryYScale: usesSecondaryYScale(series, input.layout),
331
- yAxisCalloutData
284
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout)
332
285
  });
333
286
  if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
334
287
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -339,6 +292,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
339
292
  });
340
293
  });
341
294
  });
295
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
342
296
  const vsbcData = Object.values(mapXToDataPoints);
343
297
  var _input_layout_height;
344
298
  return {
@@ -348,6 +302,9 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
348
302
  barWidth: 'auto',
349
303
  yMaxValue,
350
304
  yMinValue,
305
+ chartTitle,
306
+ xAxisTitle,
307
+ yAxisTitle,
351
308
  mode: 'plotly',
352
309
  ...secondaryYAxisValues,
353
310
  wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
@@ -357,11 +314,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
357
314
  roundCorners: true,
358
315
  showYAxisLables: true,
359
316
  noOfCharsToTruncate: 20,
360
- showYAxisLablesTooltip: true,
361
- ...getTitles(input.layout),
362
- ...getXAxisTickFormat(input.data[0], input.layout),
363
- ...yAxisTickFormat,
364
- ...getAxisCategoryOrderProps(input.data, input.layout)
317
+ showYAxisLablesTooltip: true
365
318
  };
366
319
  };
367
320
  const createColorScale = (layout, series)=>{
@@ -384,7 +337,6 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
384
337
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
385
338
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
386
339
  let colorScale = undefined;
387
- const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
388
340
  input.data.forEach((series, index1)=>{
389
341
  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;
390
342
  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) && 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') {
@@ -407,24 +359,23 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
407
359
  var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
408
360
  const legend = legends[index1];
409
361
  // resolve color for each legend's bars from the colorscale or extracted colors
410
- const color = colorScale ? colorScale(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) : resolveColor(extractedColors, index2, legend, colorMap, isDarkTheme);
362
+ const color = colorScale ? colorScale(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) : resolveColor(extractedColors, index1, legend, colorMap, isDarkTheme);
411
363
  const opacity = getOpacity(series, index2);
412
- const yVal = series.y[index2];
413
364
  var _rgb_copy_formatHex8;
414
365
  mapXToDataPoints[x].series.push({
415
366
  key: legend,
416
- data: yVal,
367
+ data: series.y[index2],
417
368
  xAxisCalloutData: x,
418
369
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
419
370
  opacity
420
371
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
421
372
  legend,
422
- useSecondaryYScale: usesSecondaryYScale(series, input.layout),
423
- yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
373
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout)
424
374
  });
425
375
  }
426
376
  });
427
377
  });
378
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
428
379
  const gvbcData = Object.values(mapXToDataPoints);
429
380
  var _input_layout_height;
430
381
  return {
@@ -432,17 +383,15 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
432
383
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
433
384
  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,
434
385
  barWidth: 'auto',
386
+ chartTitle,
387
+ xAxisTitle,
388
+ yAxisTitle,
435
389
  mode: 'plotly',
436
390
  ...secondaryYAxisValues,
437
391
  hideTickOverlap: true,
438
392
  wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
439
393
  hideLegend,
440
- roundCorners: true,
441
- ...getTitles(input.layout),
442
- ...getYMinMaxValues(input.data[0], input.layout),
443
- ...getXAxisTickFormat(input.data[0], input.layout),
444
- ...yAxisTickFormat,
445
- ...getAxisCategoryOrderProps(input.data, input.layout)
394
+ roundCorners: true
446
395
  };
447
396
  };
448
397
  export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -508,20 +457,21 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
508
457
  });
509
458
  });
510
459
  });
460
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
511
461
  var _input_layout_height;
512
462
  return {
513
463
  data: vbcData,
514
464
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
515
465
  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,
466
+ chartTitle,
467
+ xAxisTitle,
468
+ yAxisTitle,
516
469
  mode: 'histogram',
517
470
  hideTickOverlap: true,
518
471
  wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
519
472
  maxBarWidth: 50,
520
473
  hideLegend,
521
- roundCorners: true,
522
- ...getTitles(input.layout),
523
- ...getYMinMaxValues(input.data[0], input.layout),
524
- ...getAxisCategoryOrderProps(input.data, input.layout)
474
+ roundCorners: true
525
475
  };
526
476
  };
527
477
  export const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -534,9 +484,8 @@ export const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, color
534
484
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
535
485
  };
536
486
  const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
537
- var _input_data_, _input_layout, _input_layout1;
487
+ var _input_data_;
538
488
  const isScatterMarkers = [
539
- 'markers',
540
489
  'text+markers',
541
490
  'markers+text',
542
491
  'lines+markers',
@@ -548,7 +497,6 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
548
497
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
549
498
  let mode = 'tonexty';
550
499
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
551
- const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
552
500
  const chartData = input.data.map((series, index)=>{
553
501
  var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
554
502
  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;
@@ -564,7 +512,6 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
564
512
  const seriesColor = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
565
513
  const seriesOpacity = getOpacity(series, index);
566
514
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
567
- // if mode contains 'text', we prioritize showing the text over curving the line
568
515
  const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) ? getLineOptions(series.line) : undefined;
569
516
  const legendShape = getLegendShape(series);
570
517
  const validXYRanges = getValidXYRanges(series);
@@ -590,8 +537,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
590
537
  } : {},
591
538
  ...textValues ? {
592
539
  text: textValues[i]
593
- } : {},
594
- yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat)
540
+ } : {}
595
541
  };
596
542
  }),
597
543
  color: (_rgb_copy_formatHex8 = rgb(seriesColor).copy({
@@ -605,45 +551,52 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
605
551
  };
606
552
  });
607
553
  }).flat();
608
- const yMinMax = getYMinMaxValues(input.data[0], input.layout);
609
- if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
610
- const yMinMaxValues = findNumericMinMaxOfY(chartData);
611
- yMinMax.yMinValue = yMinMaxValues.startValue;
612
- yMinMax.yMaxValue = yMinMaxValues.endValue;
613
- }
554
+ const yMinMaxValues = findNumericMinMaxOfY(chartData);
555
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
614
556
  const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
615
557
  const chartProps = {
558
+ chartTitle,
616
559
  lineChartData: chartData
617
560
  };
618
561
  const scatterChartProps = {
562
+ chartTitle,
619
563
  scatterChartData: chartData
620
564
  };
621
- var _input_layout_height;
622
- const commonProps = {
623
- supportNegativeData: true,
624
- ...secondaryYAxisValues,
625
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
626
- 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,
627
- hideTickOverlap: true,
628
- hideLegend,
629
- useUTC: false,
630
- optimizeLargeData: numDataPoints > 1000,
631
- ...getTitles(input.layout),
632
- ...getXAxisTickFormat(input.data[0], input.layout),
633
- ...yAxisTickFormat
634
- };
635
565
  if (isAreaChart) {
566
+ var _input_layout, _input_layout1;
567
+ var _input_layout_height;
636
568
  return {
637
569
  data: chartProps,
570
+ supportNegativeData: true,
571
+ xAxisTitle,
572
+ yAxisTitle,
573
+ ...secondaryYAxisValues,
638
574
  mode,
639
- ...commonProps
575
+ width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
576
+ 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,
577
+ hideTickOverlap: true,
578
+ useUTC: false,
579
+ hideLegend,
580
+ optimizeLargeData: numDataPoints > 1000
640
581
  };
641
582
  } else {
583
+ var _input_layout2, _input_layout3;
584
+ var _input_layout_height1;
642
585
  return {
643
586
  data: isScatterChart ? scatterChartProps : chartProps,
587
+ supportNegativeData: true,
588
+ xAxisTitle,
589
+ yAxisTitle,
590
+ ...secondaryYAxisValues,
644
591
  roundedTicks: true,
645
- ...commonProps,
646
- ...yMinMax
592
+ yMinValue: yMinMaxValues.startValue,
593
+ yMaxValue: yMinMaxValues.endValue,
594
+ width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
595
+ 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,
596
+ hideTickOverlap: true,
597
+ useUTC: false,
598
+ hideLegend,
599
+ optimizeLargeData: numDataPoints > 1000
647
600
  };
648
601
  }
649
602
  };
@@ -677,7 +630,8 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
677
630
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
678
631
  };
679
632
  }).filter((point)=>point !== null);
680
- }).flat();
633
+ }).reverse().flat()//reversing the order to invert the Y bars order as required by plotly.
634
+ .reverse();
681
635
  var _input_layout_height;
682
636
  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;
683
637
  var _input_layout_margin_l;
@@ -689,8 +643,12 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
689
643
  const scalingFactor = 0.01;
690
644
  const gapFactor = 1 / (1 + scalingFactor * numberOfRows);
691
645
  const barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
646
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
692
647
  return {
693
648
  data: chartData,
649
+ chartTitle,
650
+ xAxisTitle,
651
+ yAxisTitle,
694
652
  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) || '',
695
653
  barHeight,
696
654
  showYAxisLables: true,
@@ -700,9 +658,7 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
700
658
  noOfCharsToTruncate: 20,
701
659
  showYAxisLablesTooltip: true,
702
660
  hideLegend,
703
- roundCorners: true,
704
- ...getTitles(input.layout),
705
- ...getAxisCategoryOrderProps(input.data, input.layout)
661
+ roundCorners: true
706
662
  };
707
663
  };
708
664
  export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -816,6 +772,7 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
816
772
  }
817
773
  const domainValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
818
774
  const rangeValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[1]) : defaultRange;
775
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
819
776
  var _input_layout_height;
820
777
  return {
821
778
  data: [
@@ -825,17 +782,16 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
825
782
  rangeValuesForColorScale,
826
783
  hideLegend: true,
827
784
  showYAxisLables: true,
785
+ chartTitle,
786
+ xAxisTitle,
787
+ yAxisTitle,
828
788
  sortOrder: 'none',
829
789
  width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
830
790
  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,
831
791
  hideTickOverlap: true,
832
792
  noOfCharsToTruncate: 20,
833
793
  showYAxisLablesTooltip: true,
834
- wrapXAxisLables: true,
835
- ...getTitles(input.layout),
836
- ...getAxisCategoryOrderProps([
837
- firstData
838
- ], input.layout)
794
+ wrapXAxisLables: true
839
795
  };
840
796
  };
841
797
  export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -1308,44 +1264,25 @@ const getLegendShape = (series)=>{
1308
1264
  }
1309
1265
  return 'default';
1310
1266
  };
1311
- export const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, isDarkTheme)=>{
1267
+ export const getAllupLegendsProps = (input, colorMap, colorwayType, isDarkTheme)=>{
1312
1268
  const allupLegends = [];
1313
1269
  // reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
1314
1270
  const toShowLegend = input.data.reduce((acc, series)=>{
1315
- return acc || series.showlegend === true || series.showlegend === undefined;
1271
+ return acc || series.showlegend === true;
1316
1272
  }, false);
1317
1273
  if (toShowLegend) {
1318
1274
  input.data.forEach((series, index)=>{
1319
- if (traceInfo[index].type === 'donut') {
1320
- var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker, _pieSeries_labels;
1321
- const pieSeries = series;
1322
- var _input_layout_piecolorway, _input_layout_piecolorway1;
1323
- const colors = 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);
1324
- (_pieSeries_labels = pieSeries.labels) === null || _pieSeries_labels === void 0 ? void 0 : _pieSeries_labels.forEach((label, labelIndex)=>{
1325
- const legend = `${label}`;
1326
- // resolve color for each legend from the extracted colors
1327
- const color = resolveColor(colors, labelIndex, legend, colorMap, isDarkTheme);
1328
- if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
1329
- allupLegends.push({
1330
- title: legend,
1331
- color
1332
- });
1333
- }
1275
+ var _series_line, _series_marker, _input_layout_template_layout, _input_layout_template, _input_layout;
1276
+ const name = series.legendgroup;
1277
+ 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);
1278
+ const legendShape = getLegendShape(series);
1279
+ const resolvedColor = 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);
1280
+ if (name !== undefined && allupLegends.some((group)=>group.title === name) === false) {
1281
+ allupLegends.push({
1282
+ title: name,
1283
+ color: resolvedColor,
1284
+ shape: legendShape
1334
1285
  });
1335
- } else if (isNonPlotType(traceInfo[index].type) === false) {
1336
- var _plotSeries_line, _plotSeries_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout3;
1337
- const plotSeries = series;
1338
- const name = plotSeries.legendgroup;
1339
- 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);
1340
- const legendShape = getLegendShape(plotSeries);
1341
- const resolvedColor = 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);
1342
- if (name !== undefined && name !== '' && allupLegends.some((group)=>group.title === name) === false) {
1343
- allupLegends.push({
1344
- title: name,
1345
- color: resolvedColor,
1346
- shape: legendShape
1347
- });
1348
- }
1349
1286
  }
1350
1287
  });
1351
1288
  }
@@ -1411,21 +1348,28 @@ const getIndexFromKey = (key, pattern)=>{
1411
1348
  const normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
1412
1349
  return parseInt(normalizedKey, 10) - 1;
1413
1350
  };
1414
- export const isNonPlotType = (chartType)=>{
1415
- return [
1416
- 'donut',
1417
- 'sankey',
1418
- 'pie'
1419
- ].includes(chartType);
1420
- };
1421
- export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
1422
- const domainX = [];
1423
- const domainY = [];
1424
- let cartesianDomains = 0;
1351
+ export const getGridProperties = (layout, isMultiPlot)=>{
1352
+ var _layout_annotations;
1353
+ const gridX = [];
1354
+ const gridY = [];
1425
1355
  const annotations = {};
1426
1356
  let templateRows = '1fr';
1427
1357
  let templateColumns = '1fr';
1428
1358
  const gridLayout = {};
1359
+ if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
1360
+ return {
1361
+ templateRows,
1362
+ templateColumns,
1363
+ layout: gridLayout
1364
+ };
1365
+ }
1366
+ if (!layout.xaxis || !layout.yaxis) {
1367
+ return {
1368
+ templateRows,
1369
+ templateColumns,
1370
+ layout: gridLayout
1371
+ };
1372
+ }
1429
1373
  if (!isMultiPlot) {
1430
1374
  return {
1431
1375
  templateRows,
@@ -1433,182 +1377,143 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
1433
1377
  layout: gridLayout
1434
1378
  };
1435
1379
  }
1436
- const layout = schema === null || schema === void 0 ? void 0 : schema.layout;
1437
- if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
1438
- Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
1439
- if (key.startsWith('xaxis')) {
1440
- var _layout_key;
1441
- const index = getIndexFromKey(key, 'xaxis');
1442
- var _layout_key_anchor;
1443
- 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';
1444
- const anchorIndex = getIndexFromKey(anchor, 'y');
1445
- if (index !== anchorIndex) {
1446
- throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
1447
- }
1448
- const xAxisLayout = layout[key];
1449
- const domainXInfo = {
1450
- start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
1451
- end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1
1452
- };
1453
- domainX.push(domainXInfo);
1454
- } else if (key.startsWith('yaxis')) {
1455
- var _layout_key1;
1456
- const index = getIndexFromKey(key, 'yaxis');
1457
- var _layout_key_anchor1;
1458
- 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';
1459
- const anchorIndex = getIndexFromKey(anchor, 'x');
1460
- if (index !== anchorIndex) {
1461
- var _layout_yaxis2;
1462
- if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
1463
- // Special case for secondary y axis where yaxis2 can anchor to x1
1464
- return {
1465
- templateRows,
1466
- templateColumns
1467
- };
1468
- }
1469
- throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
1380
+ Object.keys(layout).forEach((key)=>{
1381
+ if (key.startsWith('xaxis')) {
1382
+ var _layout_key, _layout_key1;
1383
+ const index = getIndexFromKey(key, 'xaxis');
1384
+ var _layout_key_anchor;
1385
+ 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';
1386
+ const anchorIndex = getIndexFromKey(anchor, 'y');
1387
+ if (index !== anchorIndex) {
1388
+ throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
1389
+ }
1390
+ var _layout_key_domain;
1391
+ 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 : [];
1392
+ } else if (key.startsWith('yaxis')) {
1393
+ var _layout_key2, _layout_key3;
1394
+ const index = getIndexFromKey(key, 'yaxis');
1395
+ var _layout_key_anchor1;
1396
+ 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';
1397
+ const anchorIndex = getIndexFromKey(anchor, 'x');
1398
+ if (index !== anchorIndex) {
1399
+ var _layout_yaxis2;
1400
+ if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
1401
+ // Special case for secondary y axis where yaxis2 can anchor to x1
1402
+ return {
1403
+ templateRows,
1404
+ templateColumns
1405
+ };
1470
1406
  }
1471
- const yAxisLayout = layout[key];
1472
- const domainYInfo = {
1473
- start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
1474
- end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1
1475
- };
1476
- domainY.push(domainYInfo);
1407
+ throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
1477
1408
  }
1478
- });
1479
- }
1480
- cartesianDomains = domainX.length; // Assuming that the number of x and y axes is the same
1481
- validTracesInfo.forEach((trace, index)=>{
1482
- if (isNonPlotType(trace.type)) {
1483
- var _schema_data, _series_domain, _series_domain1, _series_domain2, _series_domain3;
1484
- const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
1485
- const domainXInfo = {
1486
- start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
1487
- end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1
1488
- };
1489
- const domainYInfo = {
1490
- start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
1491
- end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1
1492
- };
1493
- domainX.push(domainXInfo);
1494
- domainY.push(domainYInfo);
1409
+ var _layout_key_domain1;
1410
+ 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 : [];
1495
1411
  }
1496
1412
  });
1497
- if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
1498
- var _layout_annotations;
1499
- (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
1500
- 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 ? [
1501
- idx
1502
- ] : []);
1503
- 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);
1504
- if (yMatch !== -1) {
1505
- if (annotations[yMatch] === undefined) {
1506
- annotations[yMatch] = {};
1507
- }
1508
- if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1509
- annotations[yMatch].yAnnotation = annotation.text;
1510
- } else {
1511
- annotations[yMatch].xAnnotation = annotation.text;
1512
- }
1413
+ (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
1414
+ 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] ? [
1415
+ idx
1416
+ ] : []);
1417
+ 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]);
1418
+ if (yMatch !== -1) {
1419
+ if (annotations[yMatch] === undefined) {
1420
+ annotations[yMatch] = {};
1513
1421
  }
1514
- });
1515
- }
1516
- if (domainX.length > 0) {
1422
+ if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1423
+ annotations[yMatch].yAnnotation = annotation.text;
1424
+ } else {
1425
+ annotations[yMatch].xAnnotation = annotation.text;
1426
+ }
1427
+ }
1428
+ });
1429
+ if (gridX.length > 0) {
1517
1430
  const uniqueXIntervals = new Map();
1518
- domainX.forEach((interval)=>{
1519
- const key = `${interval.start}-${interval.end}`;
1431
+ gridX.forEach((interval)=>{
1432
+ const key = `${interval[0]}-${interval[1]}`;
1520
1433
  if (!uniqueXIntervals.has(key)) {
1521
1434
  uniqueXIntervals.set(key, interval);
1522
1435
  }
1523
1436
  });
1524
- const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
1525
- templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
1526
- domainX.forEach((interval, index)=>{
1527
- const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
1528
- const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
1529
- const columnNumber = columnIndex + 1; // Column numbers are 1-based
1437
+ const minXInterval = Math.min(...Array.from(uniqueXIntervals.values()).map((interval)=>interval[1] - interval[0]));
1438
+ templateColumns = Array.from(uniqueXIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minXInterval}fr`).join(' ');
1439
+ let columnNumber = 1;
1440
+ let lastIntervalEnd = 0;
1441
+ gridX.forEach((interval, index)=>{
1442
+ if (interval.length === 0) {
1443
+ return;
1444
+ }
1445
+ const cellName = `x${index === 0 ? '' : index + 1}`;
1530
1446
  const annotationProps = annotations[index];
1531
1447
  const xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
1448
+ if (interval[0] < lastIntervalEnd) {
1449
+ columnNumber = 1;
1450
+ }
1451
+ lastIntervalEnd = interval[1];
1532
1452
  const row = {
1533
1453
  row: -1,
1534
1454
  column: columnNumber,
1535
- xAnnotation,
1536
- xDomain: interval,
1537
- yDomain: {
1538
- start: 0,
1539
- end: 1
1540
- }
1455
+ xAnnotation
1541
1456
  };
1542
1457
  gridLayout[cellName] = row;
1458
+ columnNumber += 1;
1543
1459
  });
1544
1460
  }
1545
- if (domainY.length > 0) {
1461
+ const numColumns = Math.max(...Object.values(gridLayout).map((cell)=>{
1462
+ var _cell_column;
1463
+ return (_cell_column = cell.column) !== null && _cell_column !== void 0 ? _cell_column : 0;
1464
+ }));
1465
+ const columnFill = {};
1466
+ for(let i = 1; i <= numColumns; i++){
1467
+ columnFill[i] = {
1468
+ row: 1,
1469
+ fillDomain: 0
1470
+ };
1471
+ }
1472
+ if (gridY.length > 0) {
1546
1473
  const uniqueYIntervals = new Map();
1547
- domainY.forEach((interval)=>{
1548
- const key = `${interval.start}-${interval.end}`;
1474
+ gridY.forEach((interval)=>{
1475
+ const key = `${interval[0]}-${interval[1]}`;
1549
1476
  if (!uniqueYIntervals.has(key)) {
1550
1477
  uniqueYIntervals.set(key, interval);
1551
1478
  }
1552
1479
  });
1553
- const sortedYStart = Array.from(uniqueYIntervals.values()).map((interval)=>interval.start).sort();
1554
- const numberOfRows = sortedYStart.length;
1555
- templateRows = `repeat(${numberOfRows}, 1fr)`;
1556
- domainY.forEach((interval, index)=>{
1557
- const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
1558
- const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
1559
- const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
1480
+ const minYInterval = Math.min(...Array.from(uniqueYIntervals.values()).map((interval)=>interval[1] - interval[0]));
1481
+ templateRows = Array.from(uniqueYIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minYInterval}fr`).join(' ');
1482
+ gridY.forEach((interval, index)=>{
1483
+ if (interval.length === 0) {
1484
+ return;
1485
+ }
1486
+ const cellName = `x${index === 0 ? '' : index + 1}`;
1560
1487
  const annotationProps = annotations[index];
1561
1488
  const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
1562
1489
  const cell = gridLayout[cellName];
1563
1490
  if (cell !== undefined) {
1564
- cell.row = rowNumber;
1491
+ cell.row = columnFill[cell.column].row;
1565
1492
  cell.yAnnotation = yAnnotation;
1566
- cell.yDomain = interval;
1567
1493
  }
1494
+ columnFill[cell.column].fillDomain = interval[1];
1495
+ columnFill[cell.column].row += 1;
1568
1496
  });
1569
1497
  }
1498
+ // reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
1499
+ const reversedGridLayout = {};
1500
+ // find the maximum row number
1501
+ const maxRowNumber = Math.max(...Object.values(gridLayout).map((cell)=>{
1502
+ var _cell_row;
1503
+ return (_cell_row = cell.row) !== null && _cell_row !== void 0 ? _cell_row : 0;
1504
+ }));
1505
+ // iterate over the gridLayout and reverse the row numbers
1506
+ Object.keys(gridLayout).forEach((key)=>{
1507
+ const cell = gridLayout[key];
1508
+ if (cell.row !== undefined) {
1509
+ // reverse the row number
1510
+ cell.row = maxRowNumber - cell.row + 1;
1511
+ }
1512
+ reversedGridLayout[key] = cell;
1513
+ });
1570
1514
  return {
1571
1515
  templateRows,
1572
1516
  templateColumns,
1573
- layout: gridLayout
1574
- };
1575
- };
1576
- /**
1577
- * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
1578
- */ const getAxisCategoryOrderProps = (data, layout)=>{
1579
- const result = {};
1580
- const axesById = {
1581
- x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
1582
- y: layout === null || layout === void 0 ? void 0 : layout.yaxis
1517
+ layout: reversedGridLayout
1583
1518
  };
1584
- Object.keys(axesById).forEach((axId)=>{
1585
- const ax = axesById[axId];
1586
- const axLetter = axId[0];
1587
- const propName = `${axLetter}AxisCategoryOrder`;
1588
- const values = [];
1589
- data.forEach((series)=>{
1590
- var _series_axLetter;
1591
- (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
1592
- if (!isInvalidValue(val)) {
1593
- values.push(val);
1594
- }
1595
- });
1596
- });
1597
- const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || isStringArray(values) && !isNumberArray(values) && !isDateArray(values);
1598
- if (!isAxisTypeCategory) {
1599
- return;
1600
- }
1601
- const isValidArray = isArrayOrTypedArray(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
1602
- if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
1603
- result[propName] = ax.categoryarray;
1604
- return;
1605
- }
1606
- if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1607
- const categoriesInTraceOrder = Array.from(new Set(values));
1608
- result[propName] = categoriesInTraceOrder;
1609
- return;
1610
- }
1611
- result[propName] = ax.categoryorder;
1612
- });
1613
- return result;
1614
1519
  };