@fluentui/react-charts 9.3.2 → 9.3.3

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 (73) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/dist/index.d.ts +147 -1
  3. package/lib/components/AreaChart/AreaChart.js +20 -24
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/CommonComponents/ChartPopover.js +2 -1
  6. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  7. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
  8. package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -7
  9. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  10. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +63 -18
  11. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +394 -173
  13. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  14. package/lib/components/DonutChart/Arc/Arc.js +8 -7
  15. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  16. package/lib/components/DonutChart/DonutChart.js +16 -32
  17. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  18. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  19. package/lib/components/DonutChart/Pie/Pie.js +4 -4
  20. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  21. package/lib/components/FunnelChart/FunnelChart.js +23 -45
  22. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  23. package/lib/components/GaugeChart/GaugeChart.js +21 -46
  24. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  25. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +332 -114
  26. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  27. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  28. package/lib/components/Legends/Legends.js +1 -1
  29. package/lib/components/Legends/Legends.js.map +1 -1
  30. package/lib/components/LineChart/LineChart.js +145 -97
  31. package/lib/components/LineChart/LineChart.js.map +1 -1
  32. package/lib/components/ScatterChart/ScatterChart.js +7 -11
  33. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  34. package/lib/types/DataPoint.js +1 -3
  35. package/lib/types/DataPoint.js.map +1 -1
  36. package/lib/utilities/utilities.js +14 -8
  37. package/lib/utilities/utilities.js.map +1 -1
  38. package/lib-commonjs/components/AreaChart/AreaChart.js +19 -23
  39. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  40. package/lib-commonjs/components/CommonComponents/ChartPopover.js +2 -1
  41. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  42. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
  43. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +16 -7
  44. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  45. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +65 -18
  46. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  47. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +393 -172
  48. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  49. package/lib-commonjs/components/DonutChart/Arc/Arc.js +8 -7
  50. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  51. package/lib-commonjs/components/DonutChart/DonutChart.js +16 -32
  52. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  53. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  54. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -4
  55. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  56. package/lib-commonjs/components/FunnelChart/FunnelChart.js +23 -45
  57. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  58. package/lib-commonjs/components/GaugeChart/GaugeChart.js +21 -46
  59. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  60. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +329 -112
  61. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  62. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  63. package/lib-commonjs/components/Legends/Legends.js +1 -1
  64. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  65. package/lib-commonjs/components/LineChart/LineChart.js +144 -96
  66. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  67. package/lib-commonjs/components/ScatterChart/ScatterChart.js +6 -10
  68. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  69. package/lib-commonjs/types/DataPoint.js +1 -3
  70. package/lib-commonjs/types/DataPoint.js.map +1 -1
  71. package/lib-commonjs/utilities/utilities.js +17 -8
  72. package/lib-commonjs/utilities/utilities.js.map +1 -1
  73. package/package.json +7 -7
@@ -233,11 +233,12 @@ const usesSecondaryYScale = (series, layout)=>{
233
233
  var _layout_yaxis2, _layout_yaxis21;
234
234
  return series.yaxis === 'y2' && ((layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.anchor) === 'x' || (layout === null || layout === void 0 ? void 0 : (_layout_yaxis21 = layout.yaxis2) === null || _layout_yaxis21 === void 0 ? void 0 : _layout_yaxis21.side) === 'right');
235
235
  };
236
- const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>{
236
+ const getSecondaryYAxisValues = (data, layout)=>{
237
237
  var _layout_yaxis2, _layout_yaxis21, _layout_yaxis2_title, _layout_yaxis22;
238
238
  let containsSecondaryYAxis = false;
239
239
  let yMinValue;
240
240
  let yMaxValue;
241
+ let allLineSeries = true;
241
242
  data.forEach((series)=>{
242
243
  if (usesSecondaryYScale(series, layout)) {
243
244
  containsSecondaryYAxis = true;
@@ -246,16 +247,21 @@ const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>
246
247
  yMinValue = Math.min(...yValues);
247
248
  yMaxValue = Math.max(...yValues);
248
249
  }
250
+ if (series.type !== 'scatter' || (0, _chartutilities.isScatterAreaChart)(series)) {
251
+ allLineSeries = false;
252
+ }
249
253
  }
250
254
  });
251
255
  if (!containsSecondaryYAxis) {
252
256
  return {};
253
257
  }
254
- if (typeof yMinValue === 'number' && typeof maxAllowedMinY === 'number') {
255
- yMinValue = Math.min(yMinValue, maxAllowedMinY);
256
- }
257
- if (typeof yMaxValue === 'number' && typeof minAllowedMaxY === 'number') {
258
- yMaxValue = Math.max(yMaxValue, minAllowedMaxY);
258
+ if (!allLineSeries) {
259
+ if (typeof yMinValue === 'number') {
260
+ yMinValue = Math.min(yMinValue, 0);
261
+ }
262
+ if (typeof yMaxValue === 'number') {
263
+ yMaxValue = Math.max(yMaxValue, 0);
264
+ }
259
265
  }
260
266
  if (layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.range) {
261
267
  yMinValue = layout.yaxis2.range[0];
@@ -271,7 +277,7 @@ const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>
271
277
  };
272
278
  const _getGaugeAxisColor = (colorway, colorwayType, color, colorMap, isDarkTheme)=>{
273
279
  const extractedColors = (0, _PlotlyColorAdapter.extractColor)(colorway, colorwayType, color, colorMap, isDarkTheme);
274
- return (0, _PlotlyColorAdapter.resolveColor)(extractedColors, 0, '', colorMap, isDarkTheme);
280
+ return (0, _PlotlyColorAdapter.resolveColor)(extractedColors, 0, '', colorMap, colorway, isDarkTheme);
275
281
  };
276
282
  const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
277
283
  if (x === null || x === undefined) {
@@ -408,54 +414,41 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
408
414
  // extract colors for each series only once
409
415
  // use piecolorway if available
410
416
  // otherwise, default to colorway from template
411
- 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 : firstData === null || firstData === void 0 ? void 0 : (_firstData_marker = firstData.marker) === null || _firstData_marker === void 0 ? void 0 : _firstData_marker.colors, colorMap, isDarkTheme);
417
+ 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 : firstData === null || firstData === void 0 ? void 0 : (_firstData_marker = firstData.marker) === null || _firstData_marker === void 0 ? void 0 : _firstData_marker.colors, colorMap, isDarkTheme, true);
412
418
  const mapLegendToDataPoint = {};
413
- if (colors) {
414
- var _firstData_labels;
415
- (_firstData_labels = firstData.labels) === null || _firstData_labels === void 0 ? void 0 : _firstData_labels.forEach((label, index)=>{
416
- const value = getNumberAtIndexOrDefault(firstData.values, index);
417
- if ((0, _chartutilities.isInvalidValue)(value) || value < 0) {
418
- return;
419
- }
420
- const legend = `${label}`;
421
- // resolve color for each legend from the extracted colors
422
- const color = (0, _PlotlyColorAdapter.resolveColor)(colors, index, legend, colorMap, isDarkTheme);
419
+ // clear colorMap for donut chart to reassign colors as the colorMap initially gets assigned by
420
+ // getAllupLegendsProps function without sorting labels by value
421
+ colorMap.current.clear();
422
+ // Sort labels by value descending before mapping
423
+ if (firstData.labels && firstData.values) {
424
+ var _firstData_marker1;
425
+ const markerColors = ((_firstData_marker1 = firstData.marker) === null || _firstData_marker1 === void 0 ? void 0 : _firstData_marker1.colors) || undefined;
426
+ const hasMarkerColors = Array.isArray(markerColors) && markerColors.length >= firstData.labels.length;
427
+ const labelValuePairs = firstData.labels.map((label, index)=>({
428
+ label,
429
+ value: getNumberAtIndexOrDefault(firstData.values, index),
430
+ index,
431
+ color: hasMarkerColors ? markerColors[index] : undefined
432
+ }));
433
+ // Filter out invalid values
434
+ const validPairs = labelValuePairs.filter((pair)=>!(0, _chartutilities.isInvalidValue)(pair.value));
435
+ // Sort descending by value; when marker colors are present, keep color attached to the label
436
+ validPairs.sort((a, b)=>b.value - a.value);
437
+ validPairs.forEach((pair, sortedIdx)=>{
438
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1;
439
+ const legend = `${pair.label}`;
440
+ var _input_layout_piecolorway, _pair_color;
441
+ const color = (_pair_color = pair.color) !== null && _pair_color !== void 0 ? _pair_color : (0, _PlotlyColorAdapter.resolveColor)(colors, sortedIdx, legend, colorMap, (_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, isDarkTheme, true);
423
442
  if (!mapLegendToDataPoint[legend]) {
424
443
  mapLegendToDataPoint[legend] = {
425
444
  legend,
426
- data: value,
445
+ data: pair.value,
427
446
  color
428
447
  };
429
448
  } else {
430
- mapLegendToDataPoint[legend].data += value;
449
+ mapLegendToDataPoint[legend].data += pair.value;
431
450
  }
432
451
  });
433
- } else {
434
- // Sort labels by value descending before mapping
435
- if (firstData.labels && firstData.values) {
436
- const labelValuePairs = firstData.labels.map((label, index)=>({
437
- label,
438
- value: getNumberAtIndexOrDefault(firstData.values, index),
439
- index
440
- }));
441
- // Filter out invalid values
442
- const validPairs = labelValuePairs.filter((pair)=>!(0, _chartutilities.isInvalidValue)(pair.value));
443
- // Sort descending by value
444
- validPairs.sort((a, b)=>b.value - a.value);
445
- validPairs.forEach((pair, sortedIdx)=>{
446
- const legend = `${pair.label}`;
447
- const color = (0, _PlotlyColorAdapter.resolveColor)(colors, sortedIdx, legend, colorMap, isDarkTheme);
448
- if (!mapLegendToDataPoint[legend]) {
449
- mapLegendToDataPoint[legend] = {
450
- legend,
451
- data: pair.value,
452
- color
453
- };
454
- } else {
455
- mapLegendToDataPoint[legend].data += pair.value;
456
- }
457
- });
458
- }
459
452
  }
460
453
  var _input_layout_width;
461
454
  const width = (_input_layout_width = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width) !== null && _input_layout_width !== void 0 ? _input_layout_width : 440;
@@ -470,10 +463,25 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
470
463
  const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
471
464
  const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : _utilities.MIN_DONUT_RADIUS;
472
465
  const { chartTitle } = getTitles(input.layout);
466
+ // Build anticlockwise order by keeping the first item, reversing the rest
467
+ const legends = Object.keys(mapLegendToDataPoint);
468
+ const reorderedEntries = legends.length > 1 ? [
469
+ [
470
+ legends[0],
471
+ mapLegendToDataPoint[legends[0]]
472
+ ],
473
+ ...legends.slice(1).reverse().map((key)=>[
474
+ key,
475
+ mapLegendToDataPoint[key]
476
+ ])
477
+ ] : legends.map((key)=>[
478
+ key,
479
+ mapLegendToDataPoint[key]
480
+ ]);
473
481
  return {
474
482
  data: {
475
483
  chartTitle,
476
- chartData: Object.values(mapLegendToDataPoint)
484
+ chartData: reorderedEntries.map(([, v])=>v)
477
485
  },
478
486
  hideLegend: isMultiPlot || ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false,
479
487
  width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
@@ -484,46 +492,43 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
484
492
  'percent',
485
493
  'label+percent'
486
494
  ].includes(firstData.textinfo) : true,
487
- roundCorners: true
495
+ roundCorners: true,
496
+ order: 'sorted'
488
497
  };
489
498
  };
490
499
  const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
491
- var _input_layout, _input_layout1, _vsbcData_;
500
+ var _input_data_, _input_layout, _input_layout1, _input_layout2, _vsbcData_;
492
501
  const mapXToDataPoints = {};
493
502
  let yMaxValue = 0;
503
+ let yMinValue = 0;
494
504
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
495
505
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
496
506
  let colorScale = undefined;
497
507
  const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
498
- let yMinValue = 0;
508
+ const resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
499
509
  input.data.forEach((series, index1)=>{
500
510
  var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_line;
501
511
  colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
502
- const isXYearCategory = (0, _chartutilities.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
503
512
  // extract bar colors for each series only once
504
513
  const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
505
514
  // extract line colors for each series only once
506
515
  const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
507
- const xValues = series.x;
508
- const isXDate = (0, _chartutilities.isDateArray)(xValues);
509
- const isXString = (0, _chartutilities.isStringArray)(xValues);
510
- const isXNumber = (0, _chartutilities.isNumberArray)(xValues);
511
- const validXYRanges = getValidXYRanges(series);
516
+ const validXYRanges = getValidXYRanges(series, resolveXAxisValue);
512
517
  validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
513
518
  const rangeXValues = series.x.slice(rangeStart, rangeEnd);
514
519
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
515
520
  rangeXValues.forEach((x, index2)=>{
516
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
521
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
517
522
  if (!mapXToDataPoints[x]) {
518
523
  mapXToDataPoints[x] = {
519
- xAxisPoint: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
524
+ xAxisPoint: resolveXAxisValue(x),
520
525
  chartData: [],
521
526
  lineData: []
522
527
  };
523
528
  }
524
529
  const legend = legends[index1];
525
530
  // resolve color for each legend's bars from the colorscale or extracted colors
526
- 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);
531
+ 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, (_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, isDarkTheme);
527
532
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
528
533
  const yVal = rangeYValues[index2];
529
534
  const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
@@ -541,8 +546,8 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
541
546
  yMaxValue = Math.max(yMaxValue, yVal);
542
547
  }
543
548
  } else if (series.type === 'scatter' || !!fallbackVSBC) {
544
- var _series_mode;
545
- const lineColor = (0, _PlotlyColorAdapter.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
549
+ var _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_mode;
550
+ const lineColor = (0, _PlotlyColorAdapter.resolveColor)(extractedLineColors, index1, legend, colorMap, (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, isDarkTheme);
546
551
  const lineOptions = !((_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('text')) ? getLineOptions(series.line) : undefined;
547
552
  const legendShape = getLegendShape(series);
548
553
  var _rgb_copy_formatHex81;
@@ -569,12 +574,60 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
569
574
  });
570
575
  });
571
576
  });
577
+ var _input_data__x;
578
+ const xCategories = (_input_data__x = (_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.x) !== null && _input_data__x !== void 0 ? _input_data__x : [];
579
+ var _input_layout_shapes;
580
+ ((_input_layout_shapes = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.shapes) !== null && _input_layout_shapes !== void 0 ? _input_layout_shapes : []).filter((shape)=>shape.type === 'line').forEach((shape, shapeIdx)=>{
581
+ var _shape_line;
582
+ const lineColor = (_shape_line = shape.line) === null || _shape_line === void 0 ? void 0 : _shape_line.color;
583
+ const resolveX = (val)=>{
584
+ if (typeof val === 'number' && Array.isArray(xCategories) && xCategories[val] !== undefined) {
585
+ return xCategories[val];
586
+ }
587
+ return val;
588
+ };
589
+ const x0Key = resolveX(shape.x0);
590
+ const x1Key = resolveX(shape.x1);
591
+ const resolveY = (val)=>{
592
+ if (shape.yref === 'paper') {
593
+ if (val === 0) {
594
+ return yMinValue;
595
+ }
596
+ if (val === 1) {
597
+ return yMaxValue;
598
+ }
599
+ if (typeof val === 'number') {
600
+ return yMinValue + val * (yMaxValue - yMinValue);
601
+ }
602
+ return val;
603
+ }
604
+ return val;
605
+ };
606
+ const y0Val = resolveY(shape.y0);
607
+ const y1Val = resolveY(shape.y1);
608
+ var _rgb_formatHex8;
609
+ mapXToDataPoints[x0Key].lineData.push({
610
+ legend: `Reference_${shapeIdx}`,
611
+ y: y0Val,
612
+ color: (_rgb_formatHex8 = (0, _d3color.rgb)(lineColor).formatHex8()) !== null && _rgb_formatHex8 !== void 0 ? _rgb_formatHex8 : lineColor,
613
+ lineOptions: getLineOptions(shape.line),
614
+ useSecondaryYScale: false
615
+ });
616
+ var _rgb_formatHex81;
617
+ mapXToDataPoints[x1Key].lineData.push({
618
+ legend: `Reference_${shapeIdx}`,
619
+ y: y1Val,
620
+ color: (_rgb_formatHex81 = (0, _d3color.rgb)(lineColor).formatHex8()) !== null && _rgb_formatHex81 !== void 0 ? _rgb_formatHex81 : lineColor,
621
+ lineOptions: getLineOptions(shape.line),
622
+ useSecondaryYScale: false
623
+ });
624
+ });
572
625
  const vsbcData = Object.values(mapXToDataPoints);
573
626
  var _input_layout_height;
574
627
  return {
575
628
  data: vsbcData,
576
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
577
- 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,
629
+ width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
630
+ height: (_input_layout_height = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
578
631
  barWidth: 'auto',
579
632
  yMaxValue,
580
633
  yMinValue,
@@ -598,7 +651,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
598
651
  };
599
652
  };
600
653
  const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
601
- var _processedInput_layout, _processedInput_layout1, _gvbcData_;
654
+ var _processedInput_layout, _processedInput_layout1;
602
655
  // Handle object arrays in y values by normalizing the data first
603
656
  let processedInput = {
604
657
  ...input
@@ -627,60 +680,90 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
627
680
  data: processedData
628
681
  };
629
682
  }
630
- const mapXToDataPoints = {};
631
- const secondaryYAxisValues = getSecondaryYAxisValues(processedInput.data, processedInput.layout, 0, 0);
683
+ const gvbcDataV2 = [];
684
+ const secondaryYAxisValues = getSecondaryYAxisValues(processedInput.data, processedInput.layout);
632
685
  const { legends, hideLegend } = getLegendProps(processedInput.data, processedInput.layout, isMultiPlot);
633
686
  let colorScale = undefined;
634
687
  const yAxisTickFormat = getYAxisTickFormat(processedInput.data[0], processedInput.layout);
635
688
  processedInput.data.forEach((series, index1)=>{
636
- var _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout, _series_marker, _series_x;
637
689
  colorScale = (0, _PlotlyColorAdapter.createColorScale)(processedInput.layout, series, colorScale);
638
- // extract colors for each series only once
639
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : (_processedInput_layout_template = _processedInput_layout.template) === null || _processedInput_layout_template === void 0 ? void 0 : (_processedInput_layout_template_layout = _processedInput_layout_template.layout) === null || _processedInput_layout_template_layout === void 0 ? void 0 : _processedInput_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
640
- (_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x.forEach((x, index2)=>{
641
- var _series_y;
642
- if ((0, _chartutilities.isInvalidValue)(x) || (0, _chartutilities.isInvalidValue)((_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index2])) {
643
- return;
644
- }
645
- if (!mapXToDataPoints[x]) {
646
- mapXToDataPoints[x] = {
647
- name: x.toString(),
648
- series: []
649
- };
650
- }
651
- if (series.type === 'bar') {
652
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
653
- const legend = legends[index1];
654
- // resolve color for each legend's bars from the colorscale or extracted colors
655
- 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);
656
- const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
657
- const yVal = series.y[index2];
690
+ const legend = legends[index1];
691
+ const legendShape = getLegendShape(series);
692
+ if (series.type === 'bar') {
693
+ var _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout, _series_marker;
694
+ // extract bar colors for each series only once
695
+ const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : (_processedInput_layout_template = _processedInput_layout.template) === null || _processedInput_layout_template === void 0 ? void 0 : (_processedInput_layout_template_layout = _processedInput_layout_template.layout) === null || _processedInput_layout_template_layout === void 0 ? void 0 : _processedInput_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
696
+ gvbcDataV2.push({
697
+ type: 'bar',
698
+ legend,
699
+ key: legend,
700
+ data: series.x.map((x, xIndex)=>{
701
+ var _series_y, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout;
702
+ if ((0, _chartutilities.isInvalidValue)(x) || (0, _chartutilities.isInvalidValue)((_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[xIndex])) {
703
+ return;
704
+ }
705
+ // resolve color for each legend's bars from the colorscale or extracted colors
706
+ 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[xIndex % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, xIndex, legend, colorMap, (_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : (_processedInput_layout_template = _processedInput_layout.template) === null || _processedInput_layout_template === void 0 ? void 0 : (_processedInput_layout_template_layout = _processedInput_layout_template.layout) === null || _processedInput_layout_template_layout === void 0 ? void 0 : _processedInput_layout_template_layout.colorway, isDarkTheme);
707
+ const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, xIndex);
708
+ const yVal = series.y[xIndex];
709
+ var _rgb_copy_formatHex8;
710
+ return {
711
+ x: x.toString(),
712
+ y: yVal,
713
+ yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
714
+ color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
715
+ opacity
716
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
717
+ };
718
+ }).filter((item)=>typeof item !== 'undefined'),
719
+ useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
720
+ });
721
+ } else if (series.type === 'scatter') {
722
+ var _processedInput_layout_template_layout1, _processedInput_layout_template1, _processedInput_layout1, _series_line, _processedInput_layout_template_layout2, _processedInput_layout_template2, _processedInput_layout2;
723
+ // extract line colors for each series only once
724
+ const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_processedInput_layout1 = processedInput.layout) === null || _processedInput_layout1 === void 0 ? void 0 : (_processedInput_layout_template1 = _processedInput_layout1.template) === null || _processedInput_layout_template1 === void 0 ? void 0 : (_processedInput_layout_template_layout1 = _processedInput_layout_template1.layout) === null || _processedInput_layout_template_layout1 === void 0 ? void 0 : _processedInput_layout_template_layout1.colorway, colorwayType, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
725
+ const lineColor = (0, _PlotlyColorAdapter.resolveColor)(extractedLineColors, index1, legend, colorMap, (_processedInput_layout2 = processedInput.layout) === null || _processedInput_layout2 === void 0 ? void 0 : (_processedInput_layout_template2 = _processedInput_layout2.template) === null || _processedInput_layout_template2 === void 0 ? void 0 : (_processedInput_layout_template_layout2 = _processedInput_layout_template2.layout) === null || _processedInput_layout_template_layout2 === void 0 ? void 0 : _processedInput_layout_template_layout2.colorway, isDarkTheme);
726
+ const lineOptions = getLineOptions(series.line);
727
+ const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index1);
728
+ const validXYRanges = getValidXYRanges(series);
729
+ validXYRanges.forEach(([rangeStart, rangeEnd])=>{
730
+ const rangeXValues = series.x.slice(rangeStart, rangeEnd);
731
+ const rangeYValues = series.y.slice(rangeStart, rangeEnd);
658
732
  var _rgb_copy_formatHex8;
659
- mapXToDataPoints[x].series.push({
660
- key: legend,
661
- data: yVal,
662
- xAxisCalloutData: x,
663
- color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
664
- opacity
665
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
733
+ gvbcDataV2.push({
734
+ type: 'line',
666
735
  legend,
667
- useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
668
- yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
736
+ legendShape,
737
+ data: rangeXValues.map((x, i)=>{
738
+ const yVal = rangeYValues[i];
739
+ return {
740
+ x: x.toString(),
741
+ y: yVal,
742
+ yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
743
+ };
744
+ }),
745
+ color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(lineColor).copy({
746
+ opacity
747
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : lineColor,
748
+ lineOptions: {
749
+ ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
750
+ mode: series.mode
751
+ },
752
+ useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
669
753
  });
670
- }
671
- });
754
+ });
755
+ }
672
756
  });
673
- const gvbcData = Object.values(mapXToDataPoints);
674
757
  var _processedInput_layout_height;
675
758
  return {
676
- data: gvbcData,
759
+ dataV2: gvbcDataV2,
677
760
  width: (_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : _processedInput_layout.width,
678
761
  height: (_processedInput_layout_height = (_processedInput_layout1 = processedInput.layout) === null || _processedInput_layout1 === void 0 ? void 0 : _processedInput_layout1.height) !== null && _processedInput_layout_height !== void 0 ? _processedInput_layout_height : 350,
679
762
  barWidth: 'auto',
680
763
  mode: 'plotly',
681
764
  ...secondaryYAxisValues,
682
765
  hideTickOverlap: true,
683
- wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
766
+ wrapXAxisLables: true,
684
767
  hideLegend,
685
768
  roundCorners: true,
686
769
  ...getTitles(processedInput.layout),
@@ -708,8 +791,9 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
708
791
  const xValues = [];
709
792
  const yValues = [];
710
793
  series.x.forEach((xVal, index)=>{
711
- const yVal = getNumberAtIndexOrDefault(series.y, index);
712
- if ((0, _chartutilities.isInvalidValue)(xVal) || (0, _chartutilities.isInvalidValue)(yVal)) {
794
+ var _getNumberAtIndexOrDefault;
795
+ const yVal = (_getNumberAtIndexOrDefault = getNumberAtIndexOrDefault(series.y, index)) !== null && _getNumberAtIndexOrDefault !== void 0 ? _getNumberAtIndexOrDefault : 0;
796
+ if ((0, _chartutilities.isInvalidValue)(xVal)) {
713
797
  return;
714
798
  }
715
799
  xValues.push(xVal);
@@ -733,10 +817,10 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
733
817
  return yVal;
734
818
  });
735
819
  xBins.forEach((bin, index)=>{
736
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
820
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
737
821
  const legend = legends[seriesIdx];
738
822
  // resolve color for each legend's bars from the colorscale or extracted colors
739
- 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[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
823
+ 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[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, (_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, isDarkTheme);
740
824
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
741
825
  const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
742
826
  var _rgb_copy_formatHex8;
@@ -778,8 +862,29 @@ const transformPlotlyJsonToLineChartProps = (input, isMultiPlot, colorMap, color
778
862
  const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
779
863
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
780
864
  };
865
+ const mapColorFillBars = (layout)=>{
866
+ if (!Array.isArray(layout === null || layout === void 0 ? void 0 : layout.shapes)) {
867
+ return [];
868
+ }
869
+ return layout.shapes.filter((shape)=>shape.type === 'rect').map((shape)=>{
870
+ //colorFillbars doesn't support string dates or categories
871
+ if (typeof shape.x0 === 'string' || typeof shape.x1 === 'string') {
872
+ return null;
873
+ }
874
+ return {
875
+ color: shape.fillcolor,
876
+ data: [
877
+ {
878
+ startX: shape.x0,
879
+ endX: shape.x1
880
+ }
881
+ ],
882
+ applyPattern: false
883
+ };
884
+ });
885
+ };
781
886
  const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
782
- var _input_data_, _input_layout, _input_layout1;
887
+ var _input_data_, _chartData__data_, _chartData_, _chartData__data_1, _chartData_1, _chartData__data_2, _chartData_2, _chartData__data_3, _chartData_3, _input_layout, _input_layout1, _input_layout2;
783
888
  const isScatterMarkers = [
784
889
  'text',
785
890
  'markers',
@@ -792,36 +897,33 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
792
897
  ].includes((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.mode);
793
898
  const isAreaChart = chartType === 'area';
794
899
  const isScatterChart = chartType === 'scatter';
795
- const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
900
+ const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
796
901
  let mode = 'tonexty';
797
902
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
798
903
  const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
799
- var shouldWrapLabels = false;
904
+ const resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
905
+ const shouldWrapLabels = getAxisType(input.data, input.layout, 'x') === 'category';
800
906
  const chartData = input.data.map((series, index)=>{
801
- var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
907
+ var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_mode1;
802
908
  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;
803
909
  // extract colors for each series only once
804
910
  const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, colors, colorMap, isDarkTheme);
805
911
  const xValues = series.x;
806
- const isXString = (0, _chartutilities.isStringArray)(xValues);
807
- const isXDate = (0, _chartutilities.isDateArray)(xValues);
808
- const isXNumber = (0, _chartutilities.isNumberArray)(xValues);
809
- const isXYearCategory = (0, _chartutilities.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
810
- shouldWrapLabels = shouldWrapLabels || isXString && !isXDate;
811
912
  const legend = legends[index];
812
913
  // resolve color for each legend's lines from the extracted colors
813
- const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
914
+ const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, isDarkTheme);
814
915
  const seriesOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
815
916
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
816
917
  // if mode contains 'text', we prioritize showing the text over curving the line
817
918
  const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
818
919
  const legendShape = getLegendShape(series);
819
- const validXYRanges = getValidXYRanges(series);
920
+ const validXYRanges = getValidXYRanges(series, resolveXAxisValue);
820
921
  return validXYRanges.map(([rangeStart, rangeEnd], rangeIdx)=>{
821
- var _series_marker, _input_layout, _input_layout_polar_angularaxis, _input_layout_polar, _input_layout1, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout2;
922
+ var _series_marker, _series_marker1, _series_marker2, _input_layout, _input_layout_polar_angularaxis, _input_layout_polar, _input_layout1, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout2;
822
923
  const rangeXValues = xValues.slice(rangeStart, rangeEnd);
823
924
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
824
925
  const markerSizes = (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? series.marker.size.slice(rangeStart, rangeEnd) : [];
926
+ const markerColors = (0, _chartutilities.isArrayOrTypedArray)((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color) ? series.marker.color.slice(rangeStart, rangeEnd) : Array.isArray((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : _series_marker2.color) ? series.marker.color.slice(rangeStart, rangeEnd) : undefined;
825
927
  const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : undefined;
826
928
  var _rgb_copy_formatHex8;
827
929
  return {
@@ -830,13 +932,16 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
830
932
  data: rangeXValues.map((x, i)=>{
831
933
  var _series_marker, _series_marker1;
832
934
  return {
833
- x: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
935
+ x: resolveXAxisValue(x),
834
936
  y: rangeYValues[i],
835
937
  ...Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? {
836
938
  markerSize: markerSizes[i]
837
939
  } : typeof ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.size) === 'number' ? {
838
940
  markerSize: series.marker.size
839
941
  } : {},
942
+ ...markerColors ? {
943
+ markerColor: markerColors[i]
944
+ } : {},
840
945
  ...textValues ? {
841
946
  text: textValues[i]
842
947
  } : {},
@@ -855,13 +960,70 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
855
960
  originXOffset: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.__polarOriginX,
856
961
  direction: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_polar = _input_layout1.polar) === null || _input_layout_polar === void 0 ? void 0 : (_input_layout_polar_angularaxis = _input_layout_polar.angularaxis) === null || _input_layout_polar_angularaxis === void 0 ? void 0 : _input_layout_polar_angularaxis.direction,
857
962
  rotation: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_polar1 = _input_layout2.polar) === null || _input_layout_polar1 === void 0 ? void 0 : (_input_layout_polar_angularaxis1 = _input_layout_polar1.angularaxis) === null || _input_layout_polar_angularaxis1 === void 0 ? void 0 : _input_layout_polar_angularaxis1.rotation,
858
- axisLabel: series.__axisLabel ? series.__axisLabel : {}
963
+ axisLabel: series.__axisLabel ? series.__axisLabel : {},
964
+ fill: series.fill
859
965
  } : {}
860
966
  },
861
967
  useSecondaryYScale: usesSecondaryYScale(series, input.layout)
862
968
  };
863
969
  });
864
970
  }).flat();
971
+ const xMinValue = (_chartData_ = chartData[0]) === null || _chartData_ === void 0 ? void 0 : (_chartData__data_ = _chartData_.data[0]) === null || _chartData__data_ === void 0 ? void 0 : _chartData__data_.x;
972
+ const xMaxValue = (_chartData_1 = chartData[0]) === null || _chartData_1 === void 0 ? void 0 : (_chartData__data_1 = _chartData_1.data[chartData[0].data.length - 1]) === null || _chartData__data_1 === void 0 ? void 0 : _chartData__data_1.x;
973
+ const yMinValue = (_chartData_2 = chartData[0]) === null || _chartData_2 === void 0 ? void 0 : (_chartData__data_2 = _chartData_2.data[0]) === null || _chartData__data_2 === void 0 ? void 0 : _chartData__data_2.y;
974
+ const yMaxValue = (_chartData_3 = chartData[0]) === null || _chartData_3 === void 0 ? void 0 : (_chartData__data_3 = _chartData_3.data[chartData[0].data.length - 1]) === null || _chartData__data_3 === void 0 ? void 0 : _chartData__data_3.y;
975
+ var _input_layout_shapes;
976
+ const lineShape = ((_input_layout_shapes = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.shapes) !== null && _input_layout_shapes !== void 0 ? _input_layout_shapes : []).filter((shape)=>shape.type === 'line').map((shape, shapeIdx)=>{
977
+ var _shape_line;
978
+ const lineColor = (_shape_line = shape.line) === null || _shape_line === void 0 ? void 0 : _shape_line.color;
979
+ const resolveX = (val)=>{
980
+ if (shape.xref === 'paper') {
981
+ if (val === 0) {
982
+ return xMinValue;
983
+ }
984
+ if (val === 1) {
985
+ return xMaxValue;
986
+ }
987
+ if (typeof val === 'number' && typeof xMinValue === 'number' && typeof xMaxValue === 'number') {
988
+ return xMinValue + val * (xMaxValue - xMinValue);
989
+ }
990
+ return val;
991
+ }
992
+ return val;
993
+ };
994
+ const resolveY = (val)=>{
995
+ if (shape.yref === 'paper') {
996
+ if (val === 0) {
997
+ return yMinValue;
998
+ }
999
+ if (val === 1) {
1000
+ return yMaxValue;
1001
+ }
1002
+ if (typeof val === 'number') {
1003
+ return yMinValue + val * (yMaxValue - yMinValue);
1004
+ }
1005
+ return val;
1006
+ }
1007
+ return val;
1008
+ };
1009
+ var _rgb_formatHex8;
1010
+ return {
1011
+ legend: `Reference_${shapeIdx}`,
1012
+ data: [
1013
+ {
1014
+ x: resolveX(shape.x0),
1015
+ y: resolveY(shape.y0)
1016
+ },
1017
+ {
1018
+ x: resolveX(shape.x1),
1019
+ y: resolveY(shape.y1)
1020
+ }
1021
+ ],
1022
+ color: (_rgb_formatHex8 = (0, _d3color.rgb)(lineColor).formatHex8()) !== null && _rgb_formatHex8 !== void 0 ? _rgb_formatHex8 : lineColor,
1023
+ lineOptions: getLineOptions(shape.line),
1024
+ useSecondaryYScale: false
1025
+ };
1026
+ });
865
1027
  const yMinMax = getYMinMaxValues(input.data[0], input.layout);
866
1028
  if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
867
1029
  const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
@@ -870,7 +1032,10 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
870
1032
  }
871
1033
  const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
872
1034
  const chartProps = {
873
- lineChartData: chartData
1035
+ lineChartData: [
1036
+ ...chartData,
1037
+ ...lineShape
1038
+ ]
874
1039
  };
875
1040
  const scatterChartProps = {
876
1041
  scatterChartData: chartData
@@ -879,8 +1044,8 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
879
1044
  const commonProps = {
880
1045
  supportNegativeData: true,
881
1046
  ...secondaryYAxisValues,
882
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
883
- 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,
1047
+ width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
1048
+ height: (_input_layout_height = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
884
1049
  hideTickOverlap: true,
885
1050
  hideLegend,
886
1051
  useUTC: false,
@@ -907,7 +1072,13 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
907
1072
  ...isScatterChart ? {
908
1073
  showYAxisLablesTooltip: true,
909
1074
  ...getAxisCategoryOrderProps(input.data, input.layout)
910
- } : {}
1075
+ } : {},
1076
+ ...!isScatterChart && (()=>{
1077
+ const bars = mapColorFillBars(input.layout);
1078
+ return bars && !bars.includes(null) ? {
1079
+ colorFillBars: bars
1080
+ } : {};
1081
+ })()
911
1082
  };
912
1083
  }
913
1084
  };
@@ -922,16 +1093,16 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
922
1093
  const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
923
1094
  const legend = legends[index];
924
1095
  return series.y.map((yValue, i)=>{
925
- var _series_x, _series_marker, _series_marker1, _series_marker_color, _series_marker2;
926
- if ((0, _chartutilities.isInvalidValue)((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]) || (0, _chartutilities.isInvalidValue)(yValue)) {
1096
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
1097
+ if ((0, _chartutilities.isInvalidValue)(yValue)) {
927
1098
  return null;
928
1099
  }
929
1100
  // resolve color for each legend's bars from the colorscale or extracted colors
930
- 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[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
1101
+ 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[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, legend, colorMap, (_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, isDarkTheme);
931
1102
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, i);
932
1103
  var _rgb_copy_formatHex8;
933
1104
  return {
934
- x: series.x[i],
1105
+ x: (0, _chartutilities.isInvalidValue)((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]) ? 0 : series.x[i],
935
1106
  y: yValue,
936
1107
  legend,
937
1108
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
@@ -973,24 +1144,24 @@ const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colo
973
1144
  var _input_layout, _input_layout1;
974
1145
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
975
1146
  let colorScale = undefined;
1147
+ const isXDate = getAxisType(input.data, input.layout, 'x') === 'date';
976
1148
  const chartData = input.data.map((series, index)=>{
977
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _input_layout_xaxis, _input_layout1;
1149
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker;
978
1150
  colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
979
1151
  // extract colors for each series only once
980
1152
  const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
981
1153
  const legend = legends[index];
982
- const isXDate = ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_xaxis = _input_layout1.xaxis) === null || _input_layout_xaxis === void 0 ? void 0 : _input_layout_xaxis.type) === 'date' || (0, _chartutilities.isDateArray)(series.x);
983
1154
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
984
1155
  const convertXValueToNumber = (value)=>{
985
1156
  return (0, _chartutilities.isInvalidValue)(value) ? 0 : isXDate ? +parseLocalDate(value) : +value;
986
1157
  };
987
1158
  return series.y.map((yVal, i)=>{
988
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _series_base, _series_x;
1159
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_base, _series_x;
989
1160
  if ((0, _chartutilities.isInvalidValue)(yVal)) {
990
1161
  return null;
991
1162
  }
992
1163
  // resolve color for each legend's bars from the colorscale or extracted colors
993
- 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[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
1164
+ 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[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, legend, colorMap, (_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, isDarkTheme);
994
1165
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, i);
995
1166
  const base = convertXValueToNumber((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
996
1167
  const xVal = convertXValueToNumber((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
@@ -1039,8 +1210,9 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
1039
1210
  const zValues = [];
1040
1211
  (_firstData_x = firstData.x) === null || _firstData_x === void 0 ? void 0 : _firstData_x.forEach((xVal, index)=>{
1041
1212
  var _firstData_y;
1042
- const zVal = getNumberAtIndexOrDefault(firstData.z, index);
1043
- if ((0, _chartutilities.isInvalidValue)(xVal) || (0, _chartutilities.isInvalidValue)((_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y[index]) || (0, _chartutilities.isInvalidValue)(zVal)) {
1213
+ var _getNumberAtIndexOrDefault;
1214
+ const zVal = (_getNumberAtIndexOrDefault = getNumberAtIndexOrDefault(firstData.z, index)) !== null && _getNumberAtIndexOrDefault !== void 0 ? _getNumberAtIndexOrDefault : 0;
1215
+ if ((0, _chartutilities.isInvalidValue)(xVal) || (0, _chartutilities.isInvalidValue)((_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y[index])) {
1044
1216
  return;
1045
1217
  }
1046
1218
  xValues.push(xVal);
@@ -1178,7 +1350,8 @@ const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorway
1178
1350
  const extractedNodeColors = (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, node === null || node === void 0 ? void 0 : node.color, colorMap, isDarkTheme);
1179
1351
  const sankeyChartData = {
1180
1352
  nodes: (_node_label = node.label) === null || _node_label === void 0 ? void 0 : _node_label.map((label, index)=>{
1181
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedNodeColors, index, label, colorMap, isDarkTheme);
1353
+ var _input_layout_template_layout, _input_layout_template, _input_layout;
1354
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedNodeColors, index, label, colorMap, (_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, isDarkTheme);
1182
1355
  return {
1183
1356
  nodeId: index,
1184
1357
  name: label,
@@ -1215,9 +1388,9 @@ const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayT
1215
1388
  const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, stepsColors, colorMap, isDarkTheme);
1216
1389
  var _firstData_gauge_axis_range_, _firstData_value, _firstData_gauge_axis_range_1, _firstData_value1;
1217
1390
  const segments = ((_firstData_gauge1 = firstData.gauge) === null || _firstData_gauge1 === void 0 ? void 0 : (_firstData_gauge_steps = _firstData_gauge1.steps) === null || _firstData_gauge_steps === void 0 ? void 0 : _firstData_gauge_steps.length) ? firstData.gauge.steps.map((step, index)=>{
1218
- var _step_range, _step_range1;
1391
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _step_range, _step_range1;
1219
1392
  const legend = step.name || `Segment ${index + 1}`;
1220
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
1393
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, (_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, isDarkTheme);
1221
1394
  return {
1222
1395
  legend,
1223
1396
  size: ((_step_range = step.range) === null || _step_range === void 0 ? void 0 : _step_range[1]) - ((_step_range1 = step.range) === null || _step_range1 === void 0 ? void 0 : _step_range1[0]),
@@ -1240,16 +1413,16 @@ const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayT
1240
1413
  if ((_firstData_delta = firstData.delta) === null || _firstData_delta === void 0 ? void 0 : _firstData_delta.reference) {
1241
1414
  const diff = firstData.value - firstData.delta.reference;
1242
1415
  if (diff >= 0) {
1243
- var _input_layout_template_layout2, _input_layout_template2, _input_layout4, _firstData_delta_increasing, _firstData_delta1;
1416
+ var _input_layout_template_layout2, _input_layout_template2, _input_layout4, _firstData_delta_increasing, _firstData_delta1, _input_layout_template_layout3, _input_layout_template3, _input_layout5;
1244
1417
  sublabel = `\u25B2 ${diff}`;
1245
1418
  const extractedIncreasingDeltaColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_template2 = _input_layout4.template) === null || _input_layout_template2 === void 0 ? void 0 : (_input_layout_template_layout2 = _input_layout_template2.layout) === null || _input_layout_template_layout2 === void 0 ? void 0 : _input_layout_template_layout2.colorway, colorwayType, (_firstData_delta1 = firstData.delta) === null || _firstData_delta1 === void 0 ? void 0 : (_firstData_delta_increasing = _firstData_delta1.increasing) === null || _firstData_delta_increasing === void 0 ? void 0 : _firstData_delta_increasing.color, colorMap, isDarkTheme);
1246
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
1419
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedIncreasingDeltaColors, 0, '', colorMap, (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template3 = _input_layout5.template) === null || _input_layout_template3 === void 0 ? void 0 : (_input_layout_template_layout3 = _input_layout_template3.layout) === null || _input_layout_template_layout3 === void 0 ? void 0 : _input_layout_template_layout3.colorway, isDarkTheme);
1247
1420
  sublabelColor = color;
1248
1421
  } else {
1249
- var _input_layout_template_layout3, _input_layout_template3, _input_layout5, _firstData_delta_decreasing, _firstData_delta2;
1422
+ var _input_layout_template_layout4, _input_layout_template4, _input_layout6, _firstData_delta_decreasing, _firstData_delta2, _input_layout_template_layout5, _input_layout_template5, _input_layout7;
1250
1423
  sublabel = `\u25BC ${Math.abs(diff)}`;
1251
- const extractedDecreasingDeltaColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template3 = _input_layout5.template) === null || _input_layout_template3 === void 0 ? void 0 : (_input_layout_template_layout3 = _input_layout_template3.layout) === null || _input_layout_template_layout3 === void 0 ? void 0 : _input_layout_template_layout3.colorway, colorwayType, (_firstData_delta2 = firstData.delta) === null || _firstData_delta2 === void 0 ? void 0 : (_firstData_delta_decreasing = _firstData_delta2.decreasing) === null || _firstData_delta_decreasing === void 0 ? void 0 : _firstData_delta_decreasing.color, colorMap, isDarkTheme);
1252
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
1424
+ const extractedDecreasingDeltaColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : (_input_layout_template4 = _input_layout6.template) === null || _input_layout_template4 === void 0 ? void 0 : (_input_layout_template_layout4 = _input_layout_template4.layout) === null || _input_layout_template_layout4 === void 0 ? void 0 : _input_layout_template_layout4.colorway, colorwayType, (_firstData_delta2 = firstData.delta) === null || _firstData_delta2 === void 0 ? void 0 : (_firstData_delta_decreasing = _firstData_delta2.decreasing) === null || _firstData_delta_decreasing === void 0 ? void 0 : _firstData_delta_decreasing.color, colorMap, isDarkTheme);
1425
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedDecreasingDeltaColors, 0, '', colorMap, (_input_layout7 = input.layout) === null || _input_layout7 === void 0 ? void 0 : (_input_layout_template5 = _input_layout7.template) === null || _input_layout_template5 === void 0 ? void 0 : (_input_layout_template_layout5 = _input_layout_template5.layout) === null || _input_layout_template_layout5 === void 0 ? void 0 : _input_layout_template_layout5.colorway, isDarkTheme);
1253
1426
  sublabelColor = color;
1254
1427
  }
1255
1428
  }
@@ -1502,13 +1675,13 @@ const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorMap, col
1502
1675
  // Assign a color per series/category and use it for all subValues of that category
1503
1676
  const seriesColors = {};
1504
1677
  input.data.forEach((series, seriesIdx)=>{
1505
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1;
1678
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1, _input_layout_template_layout1, _input_layout_template1, _input_layout1;
1506
1679
  const category = series.name || `Category ${seriesIdx + 1}`;
1507
1680
  var _series_marker_colors;
1508
1681
  // Use the same color for this category across all stages
1509
1682
  const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker_colors = (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.colors) !== null && _series_marker_colors !== void 0 ? _series_marker_colors : (_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color, colorMap, isDarkTheme);
1510
1683
  // Always use the first color for the series/category
1511
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, 0, category, colorMap, isDarkTheme);
1684
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, 0, category, colorMap, (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, isDarkTheme);
1512
1685
  seriesColors[category] = color;
1513
1686
  var _series_labels, _ref;
1514
1687
  const labels = (_ref = (_series_labels = series.labels) !== null && _series_labels !== void 0 ? _series_labels : series.y) !== null && _ref !== void 0 ? _ref : series.stage;
@@ -1556,7 +1729,8 @@ const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorMap, col
1556
1729
  var _series_marker_colors;
1557
1730
  const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker_colors = (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.colors) !== null && _series_marker_colors !== void 0 ? _series_marker_colors : (_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color, colorMap, isDarkTheme);
1558
1731
  categories.forEach((label, i)=>{
1559
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, label, colorMap, isDarkTheme);
1732
+ var _input_layout_template_layout, _input_layout_template, _input_layout;
1733
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, label, colorMap, (_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, isDarkTheme);
1560
1734
  const valueNum = Number(values[i]);
1561
1735
  if (isNaN(valueNum)) {
1562
1736
  return;
@@ -1890,11 +2064,13 @@ const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, isDarkTh
1890
2064
  var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker, _pieSeries_labels;
1891
2065
  const pieSeries = series;
1892
2066
  var _input_layout_piecolorway, _input_layout_piecolorway1;
1893
- 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);
2067
+ 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, true);
1894
2068
  (_pieSeries_labels = pieSeries.labels) === null || _pieSeries_labels === void 0 ? void 0 : _pieSeries_labels.forEach((label, labelIndex)=>{
2069
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1;
1895
2070
  const legend = `${label}`;
2071
+ var _input_layout_piecolorway;
1896
2072
  // resolve color for each legend from the extracted colors
1897
- const color = (0, _PlotlyColorAdapter.resolveColor)(colors, labelIndex, legend, colorMap, isDarkTheme);
2073
+ const color = (0, _PlotlyColorAdapter.resolveColor)(colors, labelIndex, legend, colorMap, (_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, isDarkTheme, true);
1898
2074
  if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
1899
2075
  allupLegends.push({
1900
2076
  title: legend,
@@ -1951,7 +2127,7 @@ const getNumberAtIndexOrDefault = (data, index)=>{
1951
2127
  }
1952
2128
  return 1;
1953
2129
  };
1954
- const getValidXYRanges = (series)=>{
2130
+ const getValidXYRanges = (series, resolveX, resolveY)=>{
1955
2131
  if (!(0, _chartutilities.isArrayOrTypedArray)(series.x) || !(0, _chartutilities.isArrayOrTypedArray)(series.y)) {
1956
2132
  return [];
1957
2133
  }
@@ -1959,7 +2135,7 @@ const getValidXYRanges = (series)=>{
1959
2135
  let start = 0;
1960
2136
  let end = 0;
1961
2137
  for(; end < series.x.length; end++){
1962
- if ((0, _chartutilities.isInvalidValue)(series.x[end]) || (0, _chartutilities.isInvalidValue)(series.y[end])) {
2138
+ if ((0, _chartutilities.isInvalidValue)(series.x[end]) || typeof resolveX === 'function' && (0, _chartutilities.isInvalidValue)(resolveX(series.x[end])) || (0, _chartutilities.isInvalidValue)(series.y[end]) || typeof resolveY === 'function' && (0, _chartutilities.isInvalidValue)(resolveY(series.y[end]))) {
1963
2139
  if (end - start > 0) {
1964
2140
  ranges.push([
1965
2141
  start,
@@ -2166,6 +2342,7 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2166
2342
  });
2167
2343
  const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || (0, _chartutilities.isStringArray)(values) && !(0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isDateArray)(values);
2168
2344
  if (!isAxisTypeCategory) {
2345
+ result[propName] = 'data';
2169
2346
  return;
2170
2347
  }
2171
2348
  const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
@@ -2175,7 +2352,7 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2175
2352
  }
2176
2353
  if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
2177
2354
  const categoriesInTraceOrder = Array.from(new Set(values));
2178
- result[propName] = categoriesInTraceOrder;
2355
+ result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
2179
2356
  return;
2180
2357
  }
2181
2358
  result[propName] = ax.categoryorder;
@@ -2246,7 +2423,7 @@ const getAxisScaleTypeProps = (data, layout)=>{
2246
2423
  if (!ax) {
2247
2424
  return;
2248
2425
  }
2249
- const axType = getAxisType(data, axId[0], ax);
2426
+ const axType = getAxisType(data, ax);
2250
2427
  if ((!ax.tickmode || ax.tickmode === 'array') && (0, _chartutilities.isArrayOrTypedArray)(ax.tickvals)) {
2251
2428
  const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
2252
2429
  if (axId === 'x') {
@@ -2262,12 +2439,12 @@ const getAxisScaleTypeProps = (data, layout)=>{
2262
2439
  if (axId === 'x') {
2263
2440
  props.xAxis = {
2264
2441
  tickStep: dtick,
2265
- tick0: tick0
2442
+ tick0
2266
2443
  };
2267
2444
  } else if (axId === 'y') {
2268
2445
  props.yAxis = {
2269
2446
  tickStep: dtick,
2270
- tick0: tick0
2447
+ tick0
2271
2448
  };
2272
2449
  }
2273
2450
  return;
@@ -2343,44 +2520,88 @@ const getAxisObjects = (data, layout)=>{
2343
2520
  xAxisId = axisIds.x;
2344
2521
  yAxisIds.add(axisIds.y);
2345
2522
  });
2523
+ const makeAxisObject = (axLetter, axId)=>({
2524
+ ...layout === null || layout === void 0 ? void 0 : layout[(0, _chartutilities.getAxisKey)(axLetter, axId)],
2525
+ _id: `${axLetter}${axId > 1 ? axId : ''}`
2526
+ });
2346
2527
  const axisObjects = {};
2347
2528
  if (typeof xAxisId === 'number') {
2348
- axisObjects.x = layout === null || layout === void 0 ? void 0 : layout[(0, _chartutilities.getAxisKey)('x', xAxisId)];
2529
+ axisObjects.x = makeAxisObject('x', xAxisId);
2349
2530
  }
2350
2531
  const sortedYAxisIds = Array.from(yAxisIds).sort();
2351
2532
  if (sortedYAxisIds.length > 0) {
2352
- axisObjects.y = layout === null || layout === void 0 ? void 0 : layout[(0, _chartutilities.getAxisKey)('y', sortedYAxisIds[0])];
2533
+ axisObjects.y = makeAxisObject('y', sortedYAxisIds[0]);
2353
2534
  }
2354
2535
  if (sortedYAxisIds.length > 1) {
2355
- axisObjects.y2 = layout === null || layout === void 0 ? void 0 : layout[(0, _chartutilities.getAxisKey)('y', sortedYAxisIds[1])];
2536
+ axisObjects.y2 = makeAxisObject('y', sortedYAxisIds[1]);
2356
2537
  }
2357
2538
  return axisObjects;
2358
2539
  };
2359
- const getAxisType = (data, axLetter, ax)=>{
2540
+ function getAxisType(data, arg2, arg3) {
2541
+ let ax;
2542
+ if (arg2 && typeof arg2 === 'object' && '_id' in arg2) {
2543
+ ax = arg2;
2544
+ } else if (typeof arg3 === 'string') {
2545
+ const layout = arg2;
2546
+ ax = getAxisObjects(data, layout)[arg3];
2547
+ }
2548
+ if (!ax) {
2549
+ return 'category';
2550
+ }
2551
+ var _ax_type;
2552
+ if ([
2553
+ 'linear',
2554
+ 'log',
2555
+ 'date',
2556
+ 'category'
2557
+ ].includes((_ax_type = ax.type) !== null && _ax_type !== void 0 ? _ax_type : '')) {
2558
+ return ax.type;
2559
+ }
2560
+ const axLetter = ax._id[0];
2360
2561
  const values = [];
2361
2562
  data.forEach((series)=>{
2362
- var _series_axLetter;
2363
- (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
2364
- if (!(0, _chartutilities.isInvalidValue)(val)) {
2365
- values.push(val);
2366
- }
2367
- });
2368
- });
2369
- // Note: When ax.type is explicitly specified, Plotly casts the values to match that type.
2370
- // Therefore, simply checking the type of the values may not be sufficient. At the moment,
2371
- // we don’t always perform this casting ourselves and instead use the values as provided.
2372
- if ((0, _chartutilities.isNumberArray)(values)) {
2373
- if ((ax === null || ax === void 0 ? void 0 : ax.type) === 'log') {
2374
- return 'log';
2563
+ const axId = series[`${axLetter}axis`];
2564
+ if (axId === ax._id || !axId && ax._id === axLetter) {
2565
+ var _series_axLetter;
2566
+ (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
2567
+ if (!(0, _chartutilities.isInvalidValue)(val)) {
2568
+ values.push(val);
2569
+ }
2570
+ });
2375
2571
  }
2572
+ });
2573
+ if ((0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isYearArray)(values)) {
2376
2574
  return 'linear';
2377
2575
  }
2378
2576
  if ((0, _chartutilities.isDateArray)(values)) {
2379
2577
  return 'date';
2380
2578
  }
2381
- if ((0, _chartutilities.isStringArray)(values)) {
2382
- return 'category';
2383
- }
2579
+ return 'category';
2580
+ }
2581
+ const getAxisValueResolver = (data, layout, axisId)=>{
2582
+ const axType = getAxisType(data, layout, axisId);
2583
+ return (value)=>{
2584
+ if ((0, _chartutilities.isInvalidValue)(value)) {
2585
+ return null;
2586
+ }
2587
+ switch(axType){
2588
+ case 'linear':
2589
+ case 'log':
2590
+ return (0, _chartutilities.isNumber)(value) ? +value : null;
2591
+ case 'date':
2592
+ if ((0, _chartutilities.isNumber)(value)) {
2593
+ return new Date(+value);
2594
+ }
2595
+ if (typeof value === 'string') {
2596
+ return new Date(value);
2597
+ }
2598
+ return null;
2599
+ case 'category':
2600
+ return `${value}`;
2601
+ default:
2602
+ return null;
2603
+ }
2604
+ };
2384
2605
  };
2385
2606
  /**
2386
2607
  * This is experimental. Use it only with valid datetime strings to verify if they conform to the ISO 8601 format.