@fluentui/react-charts 0.0.0-nightly-20250825-0406.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 (75) hide show
  1. package/CHANGELOG.md +15 -48
  2. package/dist/index.d.ts +1 -9
  3. package/lib/components/AreaChart/AreaChart.js +1 -4
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/CommonComponents/CartesianChart.js +9 -13
  6. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  7. package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -32
  8. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  9. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
  10. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  11. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +199 -293
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  13. package/lib/components/DonutChart/DonutChart.js +1 -6
  14. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  15. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  16. package/lib/components/DonutChart/useDonutChartStyles.styles.js +4 -21
  17. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  18. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +3 -16
  19. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  20. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +4 -23
  21. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  22. package/lib/components/HeatMapChart/HeatMapChart.js +114 -175
  23. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  24. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +6 -26
  25. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  26. package/lib/components/ScatterChart/ScatterChart.js +30 -49
  27. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  28. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  29. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +3 -19
  30. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  31. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +2 -14
  32. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  33. package/lib/components/VerticalBarChart/VerticalBarChart.js +4 -27
  34. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  35. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +44 -61
  36. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  37. package/lib/utilities/utilities.js +29 -0
  38. package/lib/utilities/utilities.js.map +1 -1
  39. package/lib-commonjs/components/AreaChart/AreaChart.js +1 -4
  40. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  41. package/lib-commonjs/components/CommonComponents/CartesianChart.js +9 -13
  42. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  43. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +15 -31
  44. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  45. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
  46. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  47. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +198 -301
  48. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  49. package/lib-commonjs/components/DonutChart/DonutChart.js +1 -6
  50. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  51. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  52. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +4 -32
  53. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  54. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +3 -16
  55. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  56. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +3 -22
  57. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  58. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +113 -174
  59. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  60. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +5 -25
  61. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  62. package/lib-commonjs/components/ScatterChart/ScatterChart.js +30 -49
  63. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  64. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  65. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +2 -28
  66. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  67. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +1 -13
  68. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  69. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +3 -26
  70. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  71. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +43 -60
  72. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  73. package/lib-commonjs/utilities/utilities.js +32 -0
  74. package/lib-commonjs/utilities/utilities.js.map +1 -1
  75. package/package.json +12 -12
@@ -9,12 +9,6 @@ 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
- },
18
12
  _getGaugeAxisColor: function() {
19
13
  return _getGaugeAxisColor;
20
14
  },
@@ -36,9 +30,6 @@ _export(exports, {
36
30
  getValidXYRanges: function() {
37
31
  return getValidXYRanges;
38
32
  },
39
- isNonPlotType: function() {
40
- return isNonPlotType;
41
- },
42
33
  projectPolarToCartesian: function() {
43
34
  return projectPolarToCartesian;
44
35
  },
@@ -93,8 +84,6 @@ const _chartutilities = require("@fluentui/chart-utilities");
93
84
  const _d3shape = require("d3-shape");
94
85
  const _PlotlyColorAdapter = require("./PlotlyColorAdapter");
95
86
  const _d3color = require("d3-color");
96
- const NON_PLOT_KEY_PREFIX = 'nonplot_';
97
- const SINGLE_REPEAT = 'repeat(1, 1fr)';
98
87
  const dashOptions = {
99
88
  dot: {
100
89
  strokeDasharray: '1, 5',
@@ -143,47 +132,6 @@ function getTitles(layout) {
143
132
  };
144
133
  return titles;
145
134
  }
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
- };
187
135
  const correctYearMonth = (xValues)=>{
188
136
  const presentYear = new Date().getFullYear();
189
137
  if (xValues.length > 0 && Array.isArray(xValues[0])) {
@@ -327,7 +275,7 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
327
275
  chartTitle,
328
276
  chartData: Object.values(mapLegendToDataPoint)
329
277
  },
330
- hideLegend: isMultiPlot || ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false,
278
+ hideLegend: ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false ? true : false,
331
279
  width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
332
280
  height,
333
281
  innerRadius,
@@ -346,7 +294,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
346
294
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
347
295
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
348
296
  let colorScale = undefined;
349
- const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
350
297
  let yMinValue = 0;
351
298
  input.data.forEach((series, index1)=>{
352
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;
@@ -380,7 +327,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
380
327
  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);
381
328
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
382
329
  const yVal = rangeYValues[index2];
383
- const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
384
330
  if (series.type === 'bar') {
385
331
  var _rgb_copy_formatHex8;
386
332
  mapXToDataPoints[x].chartData.push({
@@ -388,8 +334,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
388
334
  data: yVal,
389
335
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
390
336
  opacity
391
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
392
- yAxisCalloutData
337
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
393
338
  });
394
339
  if (typeof yVal === 'number') {
395
340
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -411,8 +356,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
411
356
  ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
412
357
  mode: series.mode
413
358
  },
414
- useSecondaryYScale: usesSecondaryYScale(series, input.layout),
415
- yAxisCalloutData
359
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout)
416
360
  });
417
361
  if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
418
362
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -423,6 +367,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
423
367
  });
424
368
  });
425
369
  });
370
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
426
371
  const vsbcData = Object.values(mapXToDataPoints);
427
372
  var _input_layout_height;
428
373
  return {
@@ -432,6 +377,9 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
432
377
  barWidth: 'auto',
433
378
  yMaxValue,
434
379
  yMinValue,
380
+ chartTitle,
381
+ xAxisTitle,
382
+ yAxisTitle,
435
383
  mode: 'plotly',
436
384
  ...secondaryYAxisValues,
437
385
  wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
@@ -441,11 +389,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
441
389
  roundCorners: true,
442
390
  showYAxisLables: true,
443
391
  noOfCharsToTruncate: 20,
444
- showYAxisLablesTooltip: true,
445
- ...getTitles(input.layout),
446
- ...getXAxisTickFormat(input.data[0], input.layout),
447
- ...yAxisTickFormat,
448
- ...getAxisCategoryOrderProps(input.data, input.layout)
392
+ showYAxisLablesTooltip: true
449
393
  };
450
394
  };
451
395
  const createColorScale = (layout, series)=>{
@@ -468,7 +412,6 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
468
412
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
469
413
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
470
414
  let colorScale = undefined;
471
- const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
472
415
  input.data.forEach((series, index1)=>{
473
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;
474
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') {
@@ -491,24 +434,23 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
491
434
  var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
492
435
  const legend = legends[index1];
493
436
  // resolve color for each legend's bars from the colorscale or extracted colors
494
- 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);
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);
495
438
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
496
- const yVal = series.y[index2];
497
439
  var _rgb_copy_formatHex8;
498
440
  mapXToDataPoints[x].series.push({
499
441
  key: legend,
500
- data: yVal,
442
+ data: series.y[index2],
501
443
  xAxisCalloutData: x,
502
444
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
503
445
  opacity
504
446
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
505
447
  legend,
506
- useSecondaryYScale: usesSecondaryYScale(series, input.layout),
507
- yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
448
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout)
508
449
  });
509
450
  }
510
451
  });
511
452
  });
453
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
512
454
  const gvbcData = Object.values(mapXToDataPoints);
513
455
  var _input_layout_height;
514
456
  return {
@@ -516,17 +458,15 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
516
458
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
517
459
  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,
518
460
  barWidth: 'auto',
461
+ chartTitle,
462
+ xAxisTitle,
463
+ yAxisTitle,
519
464
  mode: 'plotly',
520
465
  ...secondaryYAxisValues,
521
466
  hideTickOverlap: true,
522
467
  wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
523
468
  hideLegend,
524
- roundCorners: true,
525
- ...getTitles(input.layout),
526
- ...getYMinMaxValues(input.data[0], input.layout),
527
- ...getXAxisTickFormat(input.data[0], input.layout),
528
- ...yAxisTickFormat,
529
- ...getAxisCategoryOrderProps(input.data, input.layout)
469
+ roundCorners: true
530
470
  };
531
471
  };
532
472
  const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -592,20 +532,21 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
592
532
  });
593
533
  });
594
534
  });
535
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
595
536
  var _input_layout_height;
596
537
  return {
597
538
  data: vbcData,
598
539
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
599
540
  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,
600
544
  mode: 'histogram',
601
545
  hideTickOverlap: true,
602
546
  wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
603
547
  maxBarWidth: 50,
604
548
  hideLegend,
605
- roundCorners: true,
606
- ...getTitles(input.layout),
607
- ...getYMinMaxValues(input.data[0], input.layout),
608
- ...getAxisCategoryOrderProps(input.data, input.layout)
549
+ roundCorners: true
609
550
  };
610
551
  };
611
552
  const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -618,9 +559,8 @@ const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, co
618
559
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
619
560
  };
620
561
  const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
621
- var _input_data_, _input_layout, _input_layout1;
562
+ var _input_data_;
622
563
  const isScatterMarkers = [
623
- 'markers',
624
564
  'text+markers',
625
565
  'markers+text',
626
566
  'lines+markers',
@@ -632,7 +572,6 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
632
572
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
633
573
  let mode = 'tonexty';
634
574
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
635
- const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
636
575
  const chartData = input.data.map((series, index)=>{
637
576
  var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
638
577
  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;
@@ -673,8 +612,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
673
612
  } : {},
674
613
  ...textValues ? {
675
614
  text: textValues[i]
676
- } : {},
677
- yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat)
615
+ } : {}
678
616
  };
679
617
  }),
680
618
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(seriesColor).copy({
@@ -688,45 +626,52 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
688
626
  };
689
627
  });
690
628
  }).flat();
691
- const yMinMax = getYMinMaxValues(input.data[0], input.layout);
692
- if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
693
- const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
694
- yMinMax.yMinValue = yMinMaxValues.startValue;
695
- yMinMax.yMaxValue = yMinMaxValues.endValue;
696
- }
629
+ const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
630
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
697
631
  const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
698
632
  const chartProps = {
633
+ chartTitle,
699
634
  lineChartData: chartData
700
635
  };
701
636
  const scatterChartProps = {
637
+ chartTitle,
702
638
  scatterChartData: chartData
703
639
  };
704
- var _input_layout_height;
705
- const commonProps = {
706
- supportNegativeData: true,
707
- ...secondaryYAxisValues,
708
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
709
- 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,
710
- hideTickOverlap: true,
711
- hideLegend,
712
- useUTC: false,
713
- optimizeLargeData: numDataPoints > 1000,
714
- ...getTitles(input.layout),
715
- ...getXAxisTickFormat(input.data[0], input.layout),
716
- ...yAxisTickFormat
717
- };
718
640
  if (isAreaChart) {
641
+ var _input_layout, _input_layout1;
642
+ var _input_layout_height;
719
643
  return {
720
644
  data: chartProps,
645
+ supportNegativeData: true,
646
+ xAxisTitle,
647
+ yAxisTitle,
648
+ ...secondaryYAxisValues,
721
649
  mode,
722
- ...commonProps
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
723
656
  };
724
657
  } else {
658
+ var _input_layout2, _input_layout3;
659
+ var _input_layout_height1;
725
660
  return {
726
661
  data: isScatterChart ? scatterChartProps : chartProps,
662
+ supportNegativeData: true,
663
+ xAxisTitle,
664
+ yAxisTitle,
665
+ ...secondaryYAxisValues,
727
666
  roundedTicks: true,
728
- ...commonProps,
729
- ...yMinMax
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
730
675
  };
731
676
  }
732
677
  };
@@ -760,7 +705,8 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
760
705
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
761
706
  };
762
707
  }).filter((point)=>point !== null);
763
- }).flat();
708
+ }).reverse().flat() //reversing the order to invert the Y bars order as required by plotly.
709
+ .reverse();
764
710
  var _input_layout_height;
765
711
  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;
766
712
  var _input_layout_margin_l;
@@ -772,8 +718,12 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
772
718
  const scalingFactor = 0.01;
773
719
  const gapFactor = 1 / (1 + scalingFactor * numberOfRows);
774
720
  const barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
721
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
775
722
  return {
776
723
  data: chartData,
724
+ chartTitle,
725
+ xAxisTitle,
726
+ yAxisTitle,
777
727
  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) || '',
778
728
  barHeight,
779
729
  showYAxisLables: true,
@@ -783,9 +733,7 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
783
733
  noOfCharsToTruncate: 20,
784
734
  showYAxisLablesTooltip: true,
785
735
  hideLegend,
786
- roundCorners: true,
787
- ...getTitles(input.layout),
788
- ...getAxisCategoryOrderProps(input.data, input.layout)
736
+ roundCorners: true
789
737
  };
790
738
  };
791
739
  const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -898,6 +846,7 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
898
846
  }
899
847
  const domainValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
900
848
  const rangeValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[1]) : defaultRange;
849
+ const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
901
850
  var _input_layout_height;
902
851
  return {
903
852
  data: [
@@ -907,17 +856,16 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
907
856
  rangeValuesForColorScale,
908
857
  hideLegend: true,
909
858
  showYAxisLables: true,
859
+ chartTitle,
860
+ xAxisTitle,
861
+ yAxisTitle,
910
862
  sortOrder: 'none',
911
863
  width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
912
864
  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,
913
865
  hideTickOverlap: true,
914
866
  noOfCharsToTruncate: 20,
915
867
  showYAxisLablesTooltip: true,
916
- wrapXAxisLables: true,
917
- ...getTitles(input.layout),
918
- ...getAxisCategoryOrderProps([
919
- firstData
920
- ], input.layout)
868
+ wrapXAxisLables: true
921
869
  };
922
870
  };
923
871
  const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -1385,44 +1333,25 @@ const getLegendShape = (series)=>{
1385
1333
  }
1386
1334
  return 'default';
1387
1335
  };
1388
- const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, isDarkTheme)=>{
1336
+ const getAllupLegendsProps = (input, colorMap, colorwayType, isDarkTheme)=>{
1389
1337
  const allupLegends = [];
1390
1338
  // reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
1391
1339
  const toShowLegend = input.data.reduce((acc, series)=>{
1392
- return acc || series.showlegend === true || series.showlegend === undefined;
1340
+ return acc || series.showlegend === true;
1393
1341
  }, false);
1394
1342
  if (toShowLegend) {
1395
1343
  input.data.forEach((series, index)=>{
1396
- if (traceInfo[index].type === 'donut') {
1397
- var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker, _pieSeries_labels;
1398
- const pieSeries = series;
1399
- var _input_layout_piecolorway, _input_layout_piecolorway1;
1400
- 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);
1401
- (_pieSeries_labels = pieSeries.labels) === null || _pieSeries_labels === void 0 ? void 0 : _pieSeries_labels.forEach((label, labelIndex)=>{
1402
- const legend = `${label}`;
1403
- // resolve color for each legend from the extracted colors
1404
- const color = (0, _PlotlyColorAdapter.resolveColor)(colors, labelIndex, legend, colorMap, isDarkTheme);
1405
- if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
1406
- allupLegends.push({
1407
- title: legend,
1408
- color
1409
- });
1410
- }
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
1411
1354
  });
1412
- } else if (isNonPlotType(traceInfo[index].type) === false) {
1413
- var _plotSeries_line, _plotSeries_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout3;
1414
- const plotSeries = series;
1415
- const name = plotSeries.legendgroup;
1416
- 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);
1417
- const legendShape = getLegendShape(plotSeries);
1418
- 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);
1419
- if (name !== undefined && name !== '' && allupLegends.some((group)=>group.title === name) === false) {
1420
- allupLegends.push({
1421
- title: name,
1422
- color: resolvedColor,
1423
- shape: legendShape
1424
- });
1425
- }
1426
1355
  }
1427
1356
  });
1428
1357
  }
@@ -1488,21 +1417,28 @@ const getIndexFromKey = (key, pattern)=>{
1488
1417
  const normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
1489
1418
  return parseInt(normalizedKey, 10) - 1;
1490
1419
  };
1491
- const isNonPlotType = (chartType)=>{
1492
- return [
1493
- 'donut',
1494
- 'sankey',
1495
- 'pie'
1496
- ].includes(chartType);
1497
- };
1498
- const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
1499
- const domainX = [];
1500
- const domainY = [];
1501
- let cartesianDomains = 0;
1420
+ const getGridProperties = (layout, isMultiPlot)=>{
1421
+ var _layout_annotations;
1422
+ const gridX = [];
1423
+ const gridY = [];
1502
1424
  const annotations = {};
1503
1425
  let templateRows = '1fr';
1504
1426
  let templateColumns = '1fr';
1505
1427
  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
+ }
1506
1442
  if (!isMultiPlot) {
1507
1443
  return {
1508
1444
  templateRows,
@@ -1510,182 +1446,143 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
1510
1446
  layout: gridLayout
1511
1447
  };
1512
1448
  }
1513
- const layout = schema === null || schema === void 0 ? void 0 : schema.layout;
1514
- if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
1515
- Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
1516
- if (key.startsWith('xaxis')) {
1517
- var _layout_key;
1518
- const index = getIndexFromKey(key, 'xaxis');
1519
- var _layout_key_anchor;
1520
- 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';
1521
- const anchorIndex = getIndexFromKey(anchor, 'y');
1522
- if (index !== anchorIndex) {
1523
- throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
1524
- }
1525
- const xAxisLayout = layout[key];
1526
- const domainXInfo = {
1527
- start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
1528
- end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1
1529
- };
1530
- domainX.push(domainXInfo);
1531
- } else if (key.startsWith('yaxis')) {
1532
- var _layout_key1;
1533
- const index = getIndexFromKey(key, 'yaxis');
1534
- var _layout_key_anchor1;
1535
- 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';
1536
- const anchorIndex = getIndexFromKey(anchor, 'x');
1537
- if (index !== anchorIndex) {
1538
- var _layout_yaxis2;
1539
- if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
1540
- // Special case for secondary y axis where yaxis2 can anchor to x1
1541
- return {
1542
- templateRows,
1543
- templateColumns
1544
- };
1545
- }
1546
- throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
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
+ };
1547
1475
  }
1548
- const yAxisLayout = layout[key];
1549
- const domainYInfo = {
1550
- start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
1551
- end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1
1552
- };
1553
- domainY.push(domainYInfo);
1476
+ throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
1554
1477
  }
1555
- });
1556
- }
1557
- cartesianDomains = domainX.length; // Assuming that the number of x and y axes is the same
1558
- validTracesInfo.forEach((trace, index)=>{
1559
- if (isNonPlotType(trace.type)) {
1560
- var _schema_data, _series_domain, _series_domain1, _series_domain2, _series_domain3;
1561
- const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
1562
- const domainXInfo = {
1563
- start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
1564
- end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1
1565
- };
1566
- const domainYInfo = {
1567
- start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
1568
- end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1
1569
- };
1570
- domainX.push(domainXInfo);
1571
- domainY.push(domainYInfo);
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 : [];
1572
1480
  }
1573
1481
  });
1574
- if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
1575
- var _layout_annotations;
1576
- (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
1577
- 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 ? [
1578
- idx
1579
- ] : []);
1580
- 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);
1581
- if (yMatch !== -1) {
1582
- if (annotations[yMatch] === undefined) {
1583
- annotations[yMatch] = {};
1584
- }
1585
- if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1586
- annotations[yMatch].yAnnotation = annotation.text;
1587
- } else {
1588
- annotations[yMatch].xAnnotation = annotation.text;
1589
- }
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] = {};
1590
1490
  }
1591
- });
1592
- }
1593
- if (domainX.length > 0) {
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;
1495
+ }
1496
+ }
1497
+ });
1498
+ if (gridX.length > 0) {
1594
1499
  const uniqueXIntervals = new Map();
1595
- domainX.forEach((interval)=>{
1596
- const key = `${interval.start}-${interval.end}`;
1500
+ gridX.forEach((interval)=>{
1501
+ const key = `${interval[0]}-${interval[1]}`;
1597
1502
  if (!uniqueXIntervals.has(key)) {
1598
1503
  uniqueXIntervals.set(key, interval);
1599
1504
  }
1600
1505
  });
1601
- const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
1602
- templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
1603
- domainX.forEach((interval, index)=>{
1604
- const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
1605
- const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
1606
- const columnNumber = columnIndex + 1; // Column numbers are 1-based
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}`;
1607
1515
  const annotationProps = annotations[index];
1608
1516
  const xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
1517
+ if (interval[0] < lastIntervalEnd) {
1518
+ columnNumber = 1;
1519
+ }
1520
+ lastIntervalEnd = interval[1];
1609
1521
  const row = {
1610
1522
  row: -1,
1611
1523
  column: columnNumber,
1612
- xAnnotation,
1613
- xDomain: interval,
1614
- yDomain: {
1615
- start: 0,
1616
- end: 1
1617
- }
1524
+ xAnnotation
1618
1525
  };
1619
1526
  gridLayout[cellName] = row;
1527
+ columnNumber += 1;
1620
1528
  });
1621
1529
  }
1622
- if (domainY.length > 0) {
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) {
1623
1542
  const uniqueYIntervals = new Map();
1624
- domainY.forEach((interval)=>{
1625
- const key = `${interval.start}-${interval.end}`;
1543
+ gridY.forEach((interval)=>{
1544
+ const key = `${interval[0]}-${interval[1]}`;
1626
1545
  if (!uniqueYIntervals.has(key)) {
1627
1546
  uniqueYIntervals.set(key, interval);
1628
1547
  }
1629
1548
  });
1630
- const sortedYStart = Array.from(uniqueYIntervals.values()).map((interval)=>interval.start).sort();
1631
- const numberOfRows = sortedYStart.length;
1632
- templateRows = `repeat(${numberOfRows}, 1fr)`;
1633
- domainY.forEach((interval, index)=>{
1634
- const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
1635
- const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
1636
- const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
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}`;
1637
1556
  const annotationProps = annotations[index];
1638
1557
  const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
1639
1558
  const cell = gridLayout[cellName];
1640
1559
  if (cell !== undefined) {
1641
- cell.row = rowNumber;
1560
+ cell.row = columnFill[cell.column].row;
1642
1561
  cell.yAnnotation = yAnnotation;
1643
- cell.yDomain = interval;
1644
1562
  }
1563
+ columnFill[cell.column].fillDomain = interval[1];
1564
+ columnFill[cell.column].row += 1;
1645
1565
  });
1646
1566
  }
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
+ });
1647
1583
  return {
1648
1584
  templateRows,
1649
1585
  templateColumns,
1650
- layout: gridLayout
1586
+ layout: reversedGridLayout
1651
1587
  };
1652
1588
  };
1653
- /**
1654
- * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
1655
- */ const getAxisCategoryOrderProps = (data, layout)=>{
1656
- const result = {};
1657
- const axesById = {
1658
- x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
1659
- y: layout === null || layout === void 0 ? void 0 : layout.yaxis
1660
- };
1661
- Object.keys(axesById).forEach((axId)=>{
1662
- const ax = axesById[axId];
1663
- const axLetter = axId[0];
1664
- const propName = `${axLetter}AxisCategoryOrder`;
1665
- const values = [];
1666
- data.forEach((series)=>{
1667
- var _series_axLetter;
1668
- (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
1669
- if (!(0, _chartutilities.isInvalidValue)(val)) {
1670
- values.push(val);
1671
- }
1672
- });
1673
- });
1674
- const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || (0, _chartutilities.isStringArray)(values) && !(0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isDateArray)(values);
1675
- if (!isAxisTypeCategory) {
1676
- return;
1677
- }
1678
- const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
1679
- if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
1680
- result[propName] = ax.categoryarray;
1681
- return;
1682
- }
1683
- if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1684
- const categoriesInTraceOrder = Array.from(new Set(values));
1685
- result[propName] = categoriesInTraceOrder;
1686
- return;
1687
- }
1688
- result[propName] = ax.categoryorder;
1689
- });
1690
- return result;
1691
- };