@fluentui/react-charts 0.0.0-nightly-20250821-0406.1 → 0.0.0-nightly-20250825-0406.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 (29) hide show
  1. package/CHANGELOG.md +48 -15
  2. package/dist/index.d.ts +5 -1
  3. package/lib/components/CommonComponents/CartesianChart.js +8 -7
  4. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  5. package/lib/components/DeclarativeChart/DeclarativeChart.js +32 -16
  6. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  7. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +239 -191
  8. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  9. package/lib/components/DonutChart/DonutChart.js +6 -1
  10. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  11. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  12. package/lib/components/DonutChart/useDonutChartStyles.styles.js +21 -4
  13. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  14. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -3
  15. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  16. package/lib-commonjs/components/CommonComponents/CartesianChart.js +8 -7
  17. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  18. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +31 -15
  19. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  20. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +247 -190
  21. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  22. package/lib-commonjs/components/DonutChart/DonutChart.js +6 -1
  23. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  24. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  25. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +32 -4
  26. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  27. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -3
  28. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  29. package/package.json +12 -12
@@ -9,6 +9,12 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ NON_PLOT_KEY_PREFIX: function() {
13
+ return NON_PLOT_KEY_PREFIX;
14
+ },
15
+ SINGLE_REPEAT: function() {
16
+ return SINGLE_REPEAT;
17
+ },
12
18
  _getGaugeAxisColor: function() {
13
19
  return _getGaugeAxisColor;
14
20
  },
@@ -30,6 +36,9 @@ _export(exports, {
30
36
  getValidXYRanges: function() {
31
37
  return getValidXYRanges;
32
38
  },
39
+ isNonPlotType: function() {
40
+ return isNonPlotType;
41
+ },
33
42
  projectPolarToCartesian: function() {
34
43
  return projectPolarToCartesian;
35
44
  },
@@ -84,6 +93,8 @@ const _chartutilities = require("@fluentui/chart-utilities");
84
93
  const _d3shape = require("d3-shape");
85
94
  const _PlotlyColorAdapter = require("./PlotlyColorAdapter");
86
95
  const _d3color = require("d3-color");
96
+ const NON_PLOT_KEY_PREFIX = 'nonplot_';
97
+ const SINGLE_REPEAT = 'repeat(1, 1fr)';
87
98
  const dashOptions = {
88
99
  dot: {
89
100
  strokeDasharray: '1, 5',
@@ -132,6 +143,47 @@ function getTitles(layout) {
132
143
  };
133
144
  return titles;
134
145
  }
146
+ const getXAxisTickFormat = (series, layout)=>{
147
+ const xAxis = getXAxisProperties(series, layout);
148
+ if (xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat) {
149
+ return {
150
+ tickFormat: xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat
151
+ };
152
+ }
153
+ return {};
154
+ };
155
+ const getYAxisTickFormat = (series, layout)=>{
156
+ const yAxis = getYAxisProperties(series, layout);
157
+ if (yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat) {
158
+ return {
159
+ yAxisTickFormat: (0, _d3format.format)(yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat)
160
+ };
161
+ }
162
+ return {};
163
+ };
164
+ const getYMinMaxValues = (series, layout)=>{
165
+ var _getYAxisProperties;
166
+ const range = (_getYAxisProperties = getYAxisProperties(series, layout)) === null || _getYAxisProperties === void 0 ? void 0 : _getYAxisProperties.range;
167
+ if (range && range.length === 2) {
168
+ return {
169
+ yMinValue: range[0],
170
+ yMaxValue: range[1]
171
+ };
172
+ }
173
+ return {};
174
+ };
175
+ const getYAxisProperties = (series, layout)=>{
176
+ return layout === null || layout === void 0 ? void 0 : layout.yaxis;
177
+ };
178
+ const getXAxisProperties = (series, layout)=>{
179
+ return layout === null || layout === void 0 ? void 0 : layout.xaxis;
180
+ };
181
+ const getFormattedCalloutYData = (yVal, yAxisFormat)=>{
182
+ if (typeof (yAxisFormat === null || yAxisFormat === void 0 ? void 0 : yAxisFormat.yAxisTickFormat) === 'function' && typeof yVal === 'number') {
183
+ return yAxisFormat.yAxisTickFormat(yVal);
184
+ }
185
+ return (0, _chartutilities.formatToLocaleString)(yVal);
186
+ };
135
187
  const correctYearMonth = (xValues)=>{
136
188
  const presentYear = new Date().getFullYear();
137
189
  if (xValues.length > 0 && Array.isArray(xValues[0])) {
@@ -275,7 +327,7 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
275
327
  chartTitle,
276
328
  chartData: Object.values(mapLegendToDataPoint)
277
329
  },
278
- hideLegend: ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false ? true : false,
330
+ hideLegend: isMultiPlot || ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false,
279
331
  width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
280
332
  height,
281
333
  innerRadius,
@@ -294,6 +346,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
294
346
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
295
347
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
296
348
  let colorScale = undefined;
349
+ const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
297
350
  let yMinValue = 0;
298
351
  input.data.forEach((series, index1)=>{
299
352
  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;
@@ -327,6 +380,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
327
380
  const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
328
381
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
329
382
  const yVal = rangeYValues[index2];
383
+ const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
330
384
  if (series.type === 'bar') {
331
385
  var _rgb_copy_formatHex8;
332
386
  mapXToDataPoints[x].chartData.push({
@@ -334,7 +388,8 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
334
388
  data: yVal,
335
389
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
336
390
  opacity
337
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
391
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
392
+ yAxisCalloutData
338
393
  });
339
394
  if (typeof yVal === 'number') {
340
395
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -356,7 +411,8 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
356
411
  ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
357
412
  mode: series.mode
358
413
  },
359
- useSecondaryYScale: usesSecondaryYScale(series, input.layout)
414
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
415
+ yAxisCalloutData
360
416
  });
361
417
  if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
362
418
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -367,7 +423,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
367
423
  });
368
424
  });
369
425
  });
370
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
371
426
  const vsbcData = Object.values(mapXToDataPoints);
372
427
  var _input_layout_height;
373
428
  return {
@@ -377,9 +432,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
377
432
  barWidth: 'auto',
378
433
  yMaxValue,
379
434
  yMinValue,
380
- chartTitle,
381
- xAxisTitle,
382
- yAxisTitle,
383
435
  mode: 'plotly',
384
436
  ...secondaryYAxisValues,
385
437
  wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
@@ -390,6 +442,9 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
390
442
  showYAxisLables: true,
391
443
  noOfCharsToTruncate: 20,
392
444
  showYAxisLablesTooltip: true,
445
+ ...getTitles(input.layout),
446
+ ...getXAxisTickFormat(input.data[0], input.layout),
447
+ ...yAxisTickFormat,
393
448
  ...getAxisCategoryOrderProps(input.data, input.layout)
394
449
  };
395
450
  };
@@ -413,6 +468,7 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
413
468
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
414
469
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
415
470
  let colorScale = undefined;
471
+ const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
416
472
  input.data.forEach((series, index1)=>{
417
473
  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;
418
474
  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') {
@@ -437,21 +493,22 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
437
493
  // resolve color for each legend's bars from the colorscale or extracted colors
438
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);
439
495
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
496
+ const yVal = series.y[index2];
440
497
  var _rgb_copy_formatHex8;
441
498
  mapXToDataPoints[x].series.push({
442
499
  key: legend,
443
- data: series.y[index2],
500
+ data: yVal,
444
501
  xAxisCalloutData: x,
445
502
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
446
503
  opacity
447
504
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
448
505
  legend,
449
- useSecondaryYScale: usesSecondaryYScale(series, input.layout)
506
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
507
+ yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
450
508
  });
451
509
  }
452
510
  });
453
511
  });
454
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
455
512
  const gvbcData = Object.values(mapXToDataPoints);
456
513
  var _input_layout_height;
457
514
  return {
@@ -459,15 +516,16 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
459
516
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
460
517
  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,
461
518
  barWidth: 'auto',
462
- chartTitle,
463
- xAxisTitle,
464
- yAxisTitle,
465
519
  mode: 'plotly',
466
520
  ...secondaryYAxisValues,
467
521
  hideTickOverlap: true,
468
522
  wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
469
523
  hideLegend,
470
524
  roundCorners: true,
525
+ ...getTitles(input.layout),
526
+ ...getYMinMaxValues(input.data[0], input.layout),
527
+ ...getXAxisTickFormat(input.data[0], input.layout),
528
+ ...yAxisTickFormat,
471
529
  ...getAxisCategoryOrderProps(input.data, input.layout)
472
530
  };
473
531
  };
@@ -534,21 +592,19 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
534
592
  });
535
593
  });
536
594
  });
537
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
538
595
  var _input_layout_height;
539
596
  return {
540
597
  data: vbcData,
541
598
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
542
599
  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,
543
- chartTitle,
544
- xAxisTitle,
545
- yAxisTitle,
546
600
  mode: 'histogram',
547
601
  hideTickOverlap: true,
548
602
  wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
549
603
  maxBarWidth: 50,
550
604
  hideLegend,
551
605
  roundCorners: true,
606
+ ...getTitles(input.layout),
607
+ ...getYMinMaxValues(input.data[0], input.layout),
552
608
  ...getAxisCategoryOrderProps(input.data, input.layout)
553
609
  };
554
610
  };
@@ -562,7 +618,7 @@ const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, co
562
618
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
563
619
  };
564
620
  const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
565
- var _input_data_;
621
+ var _input_data_, _input_layout, _input_layout1;
566
622
  const isScatterMarkers = [
567
623
  'markers',
568
624
  'text+markers',
@@ -576,6 +632,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
576
632
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
577
633
  let mode = 'tonexty';
578
634
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
635
+ const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
579
636
  const chartData = input.data.map((series, index)=>{
580
637
  var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
581
638
  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;
@@ -616,7 +673,8 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
616
673
  } : {},
617
674
  ...textValues ? {
618
675
  text: textValues[i]
619
- } : {}
676
+ } : {},
677
+ yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat)
620
678
  };
621
679
  }),
622
680
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(seriesColor).copy({
@@ -630,52 +688,45 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
630
688
  };
631
689
  });
632
690
  }).flat();
633
- const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
634
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
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
+ }
635
697
  const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
636
698
  const chartProps = {
637
- chartTitle,
638
699
  lineChartData: chartData
639
700
  };
640
701
  const scatterChartProps = {
641
- chartTitle,
642
702
  scatterChartData: chartData
643
703
  };
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
+ };
644
718
  if (isAreaChart) {
645
- var _input_layout, _input_layout1;
646
- var _input_layout_height;
647
719
  return {
648
720
  data: chartProps,
649
- supportNegativeData: true,
650
- xAxisTitle,
651
- yAxisTitle,
652
- ...secondaryYAxisValues,
653
721
  mode,
654
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
655
- 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,
656
- hideTickOverlap: true,
657
- useUTC: false,
658
- hideLegend,
659
- optimizeLargeData: numDataPoints > 1000
722
+ ...commonProps
660
723
  };
661
724
  } else {
662
- var _input_layout2, _input_layout3;
663
- var _input_layout_height1;
664
725
  return {
665
726
  data: isScatterChart ? scatterChartProps : chartProps,
666
- supportNegativeData: true,
667
- xAxisTitle,
668
- yAxisTitle,
669
- ...secondaryYAxisValues,
670
727
  roundedTicks: true,
671
- yMinValue: yMinMaxValues.startValue,
672
- yMaxValue: yMinMaxValues.endValue,
673
- width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
674
- 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,
675
- hideTickOverlap: true,
676
- useUTC: false,
677
- hideLegend,
678
- optimizeLargeData: numDataPoints > 1000
728
+ ...commonProps,
729
+ ...yMinMax
679
730
  };
680
731
  }
681
732
  };
@@ -721,12 +772,8 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
721
772
  const scalingFactor = 0.01;
722
773
  const gapFactor = 1 / (1 + scalingFactor * numberOfRows);
723
774
  const barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
724
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
725
775
  return {
726
776
  data: chartData,
727
- chartTitle,
728
- xAxisTitle,
729
- yAxisTitle,
730
777
  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) || '',
731
778
  barHeight,
732
779
  showYAxisLables: true,
@@ -737,6 +784,7 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
737
784
  showYAxisLablesTooltip: true,
738
785
  hideLegend,
739
786
  roundCorners: true,
787
+ ...getTitles(input.layout),
740
788
  ...getAxisCategoryOrderProps(input.data, input.layout)
741
789
  };
742
790
  };
@@ -850,7 +898,6 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
850
898
  }
851
899
  const domainValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
852
900
  const rangeValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[1]) : defaultRange;
853
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
854
901
  var _input_layout_height;
855
902
  return {
856
903
  data: [
@@ -860,9 +907,6 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
860
907
  rangeValuesForColorScale,
861
908
  hideLegend: true,
862
909
  showYAxisLables: true,
863
- chartTitle,
864
- xAxisTitle,
865
- yAxisTitle,
866
910
  sortOrder: 'none',
867
911
  width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
868
912
  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,
@@ -870,6 +914,7 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
870
914
  noOfCharsToTruncate: 20,
871
915
  showYAxisLablesTooltip: true,
872
916
  wrapXAxisLables: true,
917
+ ...getTitles(input.layout),
873
918
  ...getAxisCategoryOrderProps([
874
919
  firstData
875
920
  ], input.layout)
@@ -1340,25 +1385,44 @@ const getLegendShape = (series)=>{
1340
1385
  }
1341
1386
  return 'default';
1342
1387
  };
1343
- const getAllupLegendsProps = (input, colorMap, colorwayType, isDarkTheme)=>{
1388
+ const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, isDarkTheme)=>{
1344
1389
  const allupLegends = [];
1345
1390
  // reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
1346
1391
  const toShowLegend = input.data.reduce((acc, series)=>{
1347
- return acc || series.showlegend === true;
1392
+ return acc || series.showlegend === true || series.showlegend === undefined;
1348
1393
  }, false);
1349
1394
  if (toShowLegend) {
1350
1395
  input.data.forEach((series, index)=>{
1351
- var _series_line, _series_marker, _input_layout_template_layout, _input_layout_template, _input_layout;
1352
- const name = series.legendgroup;
1353
- 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);
1354
- const legendShape = getLegendShape(series);
1355
- 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);
1356
- if (name !== undefined && allupLegends.some((group)=>group.title === name) === false) {
1357
- allupLegends.push({
1358
- title: name,
1359
- color: resolvedColor,
1360
- shape: legendShape
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
+ }
1361
1411
  });
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
+ }
1362
1426
  }
1363
1427
  });
1364
1428
  }
@@ -1424,28 +1488,21 @@ const getIndexFromKey = (key, pattern)=>{
1424
1488
  const normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
1425
1489
  return parseInt(normalizedKey, 10) - 1;
1426
1490
  };
1427
- const getGridProperties = (layout, isMultiPlot)=>{
1428
- var _layout_annotations;
1429
- const gridX = [];
1430
- const gridY = [];
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;
1431
1502
  const annotations = {};
1432
1503
  let templateRows = '1fr';
1433
1504
  let templateColumns = '1fr';
1434
1505
  const gridLayout = {};
1435
- if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
1436
- return {
1437
- templateRows,
1438
- templateColumns,
1439
- layout: gridLayout
1440
- };
1441
- }
1442
- if (!layout.xaxis || !layout.yaxis) {
1443
- return {
1444
- templateRows,
1445
- templateColumns,
1446
- layout: gridLayout
1447
- };
1448
- }
1449
1506
  if (!isMultiPlot) {
1450
1507
  return {
1451
1508
  templateRows,
@@ -1453,144 +1510,144 @@ const getGridProperties = (layout, isMultiPlot)=>{
1453
1510
  layout: gridLayout
1454
1511
  };
1455
1512
  }
1456
- Object.keys(layout).forEach((key)=>{
1457
- if (key.startsWith('xaxis')) {
1458
- var _layout_key, _layout_key1;
1459
- const index = getIndexFromKey(key, 'xaxis');
1460
- var _layout_key_anchor;
1461
- 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';
1462
- const anchorIndex = getIndexFromKey(anchor, 'y');
1463
- if (index !== anchorIndex) {
1464
- throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
1465
- }
1466
- var _layout_key_domain;
1467
- 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 : [];
1468
- } else if (key.startsWith('yaxis')) {
1469
- var _layout_key2, _layout_key3;
1470
- const index = getIndexFromKey(key, 'yaxis');
1471
- var _layout_key_anchor1;
1472
- 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';
1473
- const anchorIndex = getIndexFromKey(anchor, 'x');
1474
- if (index !== anchorIndex) {
1475
- var _layout_yaxis2;
1476
- if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
1477
- // Special case for secondary y axis where yaxis2 can anchor to x1
1478
- return {
1479
- templateRows,
1480
- templateColumns
1481
- };
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}`);
1482
1547
  }
1483
- throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
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);
1484
1554
  }
1485
- var _layout_key_domain1;
1486
- 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 : [];
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);
1487
1572
  }
1488
1573
  });
1489
- (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
1490
- 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] ? [
1491
- idx
1492
- ] : []);
1493
- 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]);
1494
- if (yMatch !== -1) {
1495
- if (annotations[yMatch] === undefined) {
1496
- annotations[yMatch] = {};
1497
- }
1498
- if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1499
- annotations[yMatch].yAnnotation = annotation.text;
1500
- } else {
1501
- annotations[yMatch].xAnnotation = annotation.text;
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
+ }
1502
1590
  }
1503
- }
1504
- });
1505
- if (gridX.length > 0) {
1591
+ });
1592
+ }
1593
+ if (domainX.length > 0) {
1506
1594
  const uniqueXIntervals = new Map();
1507
- gridX.forEach((interval)=>{
1508
- const key = `${interval[0]}-${interval[1]}`;
1595
+ domainX.forEach((interval)=>{
1596
+ const key = `${interval.start}-${interval.end}`;
1509
1597
  if (!uniqueXIntervals.has(key)) {
1510
1598
  uniqueXIntervals.set(key, interval);
1511
1599
  }
1512
1600
  });
1513
- const minXInterval = Math.min(...Array.from(uniqueXIntervals.values()).map((interval)=>interval[1] - interval[0]));
1514
- templateColumns = Array.from(uniqueXIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minXInterval}fr`).join(' ');
1515
- let columnNumber = 1;
1516
- let lastIntervalEnd = 0;
1517
- gridX.forEach((interval, index)=>{
1518
- if (interval.length === 0) {
1519
- return;
1520
- }
1521
- const cellName = `x${index === 0 ? '' : index + 1}`;
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
1522
1607
  const annotationProps = annotations[index];
1523
1608
  const xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
1524
- if (interval[0] < lastIntervalEnd) {
1525
- columnNumber = 1;
1526
- }
1527
- lastIntervalEnd = interval[1];
1528
1609
  const row = {
1529
1610
  row: -1,
1530
1611
  column: columnNumber,
1531
- xAnnotation
1612
+ xAnnotation,
1613
+ xDomain: interval,
1614
+ yDomain: {
1615
+ start: 0,
1616
+ end: 1
1617
+ }
1532
1618
  };
1533
1619
  gridLayout[cellName] = row;
1534
- columnNumber += 1;
1535
1620
  });
1536
1621
  }
1537
- const numColumns = Math.max(...Object.values(gridLayout).map((cell)=>{
1538
- var _cell_column;
1539
- return (_cell_column = cell.column) !== null && _cell_column !== void 0 ? _cell_column : 0;
1540
- }));
1541
- const columnFill = {};
1542
- for(let i = 1; i <= numColumns; i++){
1543
- columnFill[i] = {
1544
- row: 1,
1545
- fillDomain: 0
1546
- };
1547
- }
1548
- if (gridY.length > 0) {
1622
+ if (domainY.length > 0) {
1549
1623
  const uniqueYIntervals = new Map();
1550
- gridY.forEach((interval)=>{
1551
- const key = `${interval[0]}-${interval[1]}`;
1624
+ domainY.forEach((interval)=>{
1625
+ const key = `${interval.start}-${interval.end}`;
1552
1626
  if (!uniqueYIntervals.has(key)) {
1553
1627
  uniqueYIntervals.set(key, interval);
1554
1628
  }
1555
1629
  });
1556
- const minYInterval = Math.min(...Array.from(uniqueYIntervals.values()).map((interval)=>interval[1] - interval[0]));
1557
- templateRows = Array.from(uniqueYIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minYInterval}fr`).join(' ');
1558
- gridY.forEach((interval, index)=>{
1559
- if (interval.length === 0) {
1560
- return;
1561
- }
1562
- const cellName = `x${index === 0 ? '' : index + 1}`;
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
1563
1637
  const annotationProps = annotations[index];
1564
1638
  const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
1565
1639
  const cell = gridLayout[cellName];
1566
1640
  if (cell !== undefined) {
1567
- cell.row = columnFill[cell.column].row;
1641
+ cell.row = rowNumber;
1568
1642
  cell.yAnnotation = yAnnotation;
1643
+ cell.yDomain = interval;
1569
1644
  }
1570
- columnFill[cell.column].fillDomain = interval[1];
1571
- columnFill[cell.column].row += 1;
1572
1645
  });
1573
1646
  }
1574
- // reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
1575
- const reversedGridLayout = {};
1576
- // find the maximum row number
1577
- const maxRowNumber = Math.max(...Object.values(gridLayout).map((cell)=>{
1578
- var _cell_row;
1579
- return (_cell_row = cell.row) !== null && _cell_row !== void 0 ? _cell_row : 0;
1580
- }));
1581
- // iterate over the gridLayout and reverse the row numbers
1582
- Object.keys(gridLayout).forEach((key)=>{
1583
- const cell = gridLayout[key];
1584
- if (cell.row !== undefined) {
1585
- // reverse the row number
1586
- cell.row = maxRowNumber - cell.row + 1;
1587
- }
1588
- reversedGridLayout[key] = cell;
1589
- });
1590
1647
  return {
1591
1648
  templateRows,
1592
1649
  templateColumns,
1593
- layout: reversedGridLayout
1650
+ layout: gridLayout
1594
1651
  };
1595
1652
  };
1596
1653
  /**