@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
@@ -5,7 +5,7 @@ import { scaleLinear as d3ScaleLinear } from 'd3-scale';
5
5
  import { format as d3Format } from 'd3-format';
6
6
  import { DataVizPalette, getColorFromToken } from '../../utilities/colors';
7
7
  import { DEFAULT_DATE_STRING, findNumericMinMaxOfY, formatScientificLimitWidth, MIN_DONUT_RADIUS, calculatePrecision, precisionRound } from '../../utilities/utilities';
8
- import { isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isStringArray, isYearArray, isInvalidValue, formatToLocaleString, isNumber, isObjectArray, getAxisIds, getAxisKey } from '@fluentui/chart-utilities';
8
+ import { isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isStringArray, isYearArray, isInvalidValue, formatToLocaleString, isNumber, isObjectArray, getAxisIds, getAxisKey, isScatterAreaChart } from '@fluentui/chart-utilities';
9
9
  import { curveCardinal as d3CurveCardinal } from 'd3-shape';
10
10
  import { getOpacity, extractColor, resolveColor, createColorScale } from './PlotlyColorAdapter';
11
11
  import { rgb } from 'd3-color';
@@ -140,11 +140,12 @@ const usesSecondaryYScale = (series, layout)=>{
140
140
  var _layout_yaxis2, _layout_yaxis21;
141
141
  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');
142
142
  };
143
- const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>{
143
+ const getSecondaryYAxisValues = (data, layout)=>{
144
144
  var _layout_yaxis2, _layout_yaxis21, _layout_yaxis2_title, _layout_yaxis22;
145
145
  let containsSecondaryYAxis = false;
146
146
  let yMinValue;
147
147
  let yMaxValue;
148
+ let allLineSeries = true;
148
149
  data.forEach((series)=>{
149
150
  if (usesSecondaryYScale(series, layout)) {
150
151
  containsSecondaryYAxis = true;
@@ -153,16 +154,21 @@ const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>
153
154
  yMinValue = Math.min(...yValues);
154
155
  yMaxValue = Math.max(...yValues);
155
156
  }
157
+ if (series.type !== 'scatter' || isScatterAreaChart(series)) {
158
+ allLineSeries = false;
159
+ }
156
160
  }
157
161
  });
158
162
  if (!containsSecondaryYAxis) {
159
163
  return {};
160
164
  }
161
- if (typeof yMinValue === 'number' && typeof maxAllowedMinY === 'number') {
162
- yMinValue = Math.min(yMinValue, maxAllowedMinY);
163
- }
164
- if (typeof yMaxValue === 'number' && typeof minAllowedMaxY === 'number') {
165
- yMaxValue = Math.max(yMaxValue, minAllowedMaxY);
165
+ if (!allLineSeries) {
166
+ if (typeof yMinValue === 'number') {
167
+ yMinValue = Math.min(yMinValue, 0);
168
+ }
169
+ if (typeof yMaxValue === 'number') {
170
+ yMaxValue = Math.max(yMaxValue, 0);
171
+ }
166
172
  }
167
173
  if (layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.range) {
168
174
  yMinValue = layout.yaxis2.range[0];
@@ -178,7 +184,7 @@ const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>
178
184
  };
179
185
  export const _getGaugeAxisColor = (colorway, colorwayType, color, colorMap, isDarkTheme)=>{
180
186
  const extractedColors = extractColor(colorway, colorwayType, color, colorMap, isDarkTheme);
181
- return resolveColor(extractedColors, 0, '', colorMap, isDarkTheme);
187
+ return resolveColor(extractedColors, 0, '', colorMap, colorway, isDarkTheme);
182
188
  };
183
189
  export const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
184
190
  if (x === null || x === undefined) {
@@ -320,54 +326,41 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
320
326
  // extract colors for each series only once
321
327
  // use piecolorway if available
322
328
  // otherwise, default to colorway from template
323
- const colors = extractColor((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : firstData === null || firstData === void 0 ? void 0 : (_firstData_marker = firstData.marker) === null || _firstData_marker === void 0 ? void 0 : _firstData_marker.colors, colorMap, isDarkTheme);
329
+ const colors = extractColor((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : firstData === null || firstData === void 0 ? void 0 : (_firstData_marker = firstData.marker) === null || _firstData_marker === void 0 ? void 0 : _firstData_marker.colors, colorMap, isDarkTheme, true);
324
330
  const mapLegendToDataPoint = {};
325
- if (colors) {
326
- var _firstData_labels;
327
- (_firstData_labels = firstData.labels) === null || _firstData_labels === void 0 ? void 0 : _firstData_labels.forEach((label, index)=>{
328
- const value = getNumberAtIndexOrDefault(firstData.values, index);
329
- if (isInvalidValue(value) || value < 0) {
330
- return;
331
- }
332
- const legend = `${label}`;
333
- // resolve color for each legend from the extracted colors
334
- const color = resolveColor(colors, index, legend, colorMap, isDarkTheme);
331
+ // clear colorMap for donut chart to reassign colors as the colorMap initially gets assigned by
332
+ // getAllupLegendsProps function without sorting labels by value
333
+ colorMap.current.clear();
334
+ // Sort labels by value descending before mapping
335
+ if (firstData.labels && firstData.values) {
336
+ var _firstData_marker1;
337
+ const markerColors = ((_firstData_marker1 = firstData.marker) === null || _firstData_marker1 === void 0 ? void 0 : _firstData_marker1.colors) || undefined;
338
+ const hasMarkerColors = Array.isArray(markerColors) && markerColors.length >= firstData.labels.length;
339
+ const labelValuePairs = firstData.labels.map((label, index)=>({
340
+ label,
341
+ value: getNumberAtIndexOrDefault(firstData.values, index),
342
+ index,
343
+ color: hasMarkerColors ? markerColors[index] : undefined
344
+ }));
345
+ // Filter out invalid values
346
+ const validPairs = labelValuePairs.filter((pair)=>!isInvalidValue(pair.value));
347
+ // Sort descending by value; when marker colors are present, keep color attached to the label
348
+ validPairs.sort((a, b)=>b.value - a.value);
349
+ validPairs.forEach((pair, sortedIdx)=>{
350
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1;
351
+ const legend = `${pair.label}`;
352
+ var _input_layout_piecolorway, _pair_color;
353
+ const color = (_pair_color = pair.color) !== null && _pair_color !== void 0 ? _pair_color : 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);
335
354
  if (!mapLegendToDataPoint[legend]) {
336
355
  mapLegendToDataPoint[legend] = {
337
356
  legend,
338
- data: value,
357
+ data: pair.value,
339
358
  color
340
359
  };
341
360
  } else {
342
- mapLegendToDataPoint[legend].data += value;
361
+ mapLegendToDataPoint[legend].data += pair.value;
343
362
  }
344
363
  });
345
- } else {
346
- // Sort labels by value descending before mapping
347
- if (firstData.labels && firstData.values) {
348
- const labelValuePairs = firstData.labels.map((label, index)=>({
349
- label,
350
- value: getNumberAtIndexOrDefault(firstData.values, index),
351
- index
352
- }));
353
- // Filter out invalid values
354
- const validPairs = labelValuePairs.filter((pair)=>!isInvalidValue(pair.value));
355
- // Sort descending by value
356
- validPairs.sort((a, b)=>b.value - a.value);
357
- validPairs.forEach((pair, sortedIdx)=>{
358
- const legend = `${pair.label}`;
359
- const color = resolveColor(colors, sortedIdx, legend, colorMap, isDarkTheme);
360
- if (!mapLegendToDataPoint[legend]) {
361
- mapLegendToDataPoint[legend] = {
362
- legend,
363
- data: pair.value,
364
- color
365
- };
366
- } else {
367
- mapLegendToDataPoint[legend].data += pair.value;
368
- }
369
- });
370
- }
371
364
  }
372
365
  var _input_layout_width;
373
366
  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;
@@ -382,10 +375,25 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
382
375
  const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
383
376
  const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : MIN_DONUT_RADIUS;
384
377
  const { chartTitle } = getTitles(input.layout);
378
+ // Build anticlockwise order by keeping the first item, reversing the rest
379
+ const legends = Object.keys(mapLegendToDataPoint);
380
+ const reorderedEntries = legends.length > 1 ? [
381
+ [
382
+ legends[0],
383
+ mapLegendToDataPoint[legends[0]]
384
+ ],
385
+ ...legends.slice(1).reverse().map((key)=>[
386
+ key,
387
+ mapLegendToDataPoint[key]
388
+ ])
389
+ ] : legends.map((key)=>[
390
+ key,
391
+ mapLegendToDataPoint[key]
392
+ ]);
385
393
  return {
386
394
  data: {
387
395
  chartTitle,
388
- chartData: Object.values(mapLegendToDataPoint)
396
+ chartData: reorderedEntries.map(([, v])=>v)
389
397
  },
390
398
  hideLegend: isMultiPlot || ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false,
391
399
  width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
@@ -396,46 +404,43 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
396
404
  'percent',
397
405
  'label+percent'
398
406
  ].includes(firstData.textinfo) : true,
399
- roundCorners: true
407
+ roundCorners: true,
408
+ order: 'sorted'
400
409
  };
401
410
  };
402
411
  export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
403
- var _input_layout, _input_layout1, _vsbcData_;
412
+ var _input_data_, _input_layout, _input_layout1, _input_layout2, _vsbcData_;
404
413
  const mapXToDataPoints = {};
405
414
  let yMaxValue = 0;
415
+ let yMinValue = 0;
406
416
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
407
417
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
408
418
  let colorScale = undefined;
409
419
  const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
410
- let yMinValue = 0;
420
+ const resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
411
421
  input.data.forEach((series, index1)=>{
412
422
  var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_line;
413
423
  colorScale = createColorScale(input.layout, series, colorScale);
414
- const isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
415
424
  // extract bar colors for each series only once
416
425
  const extractedBarColors = 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);
417
426
  // extract line colors for each series only once
418
427
  const extractedLineColors = 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);
419
- const xValues = series.x;
420
- const isXDate = isDateArray(xValues);
421
- const isXString = isStringArray(xValues);
422
- const isXNumber = isNumberArray(xValues);
423
- const validXYRanges = getValidXYRanges(series);
428
+ const validXYRanges = getValidXYRanges(series, resolveXAxisValue);
424
429
  validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
425
430
  const rangeXValues = series.x.slice(rangeStart, rangeEnd);
426
431
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
427
432
  rangeXValues.forEach((x, index2)=>{
428
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
433
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
429
434
  if (!mapXToDataPoints[x]) {
430
435
  mapXToDataPoints[x] = {
431
- xAxisPoint: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
436
+ xAxisPoint: resolveXAxisValue(x),
432
437
  chartData: [],
433
438
  lineData: []
434
439
  };
435
440
  }
436
441
  const legend = legends[index1];
437
442
  // resolve color for each legend's bars from the colorscale or extracted colors
438
- const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedBarColors, index2, legend, colorMap, isDarkTheme);
443
+ const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedBarColors, index2, legend, colorMap, (_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);
439
444
  const opacity = getOpacity(series, index2);
440
445
  const yVal = rangeYValues[index2];
441
446
  const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
@@ -453,8 +458,8 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
453
458
  yMaxValue = Math.max(yMaxValue, yVal);
454
459
  }
455
460
  } else if (series.type === 'scatter' || !!fallbackVSBC) {
456
- var _series_mode;
457
- const lineColor = resolveColor(extractedLineColors, index1, legend, colorMap, isDarkTheme);
461
+ var _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_mode;
462
+ const lineColor = 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);
458
463
  const lineOptions = !((_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('text')) ? getLineOptions(series.line) : undefined;
459
464
  const legendShape = getLegendShape(series);
460
465
  var _rgb_copy_formatHex81;
@@ -481,12 +486,60 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
481
486
  });
482
487
  });
483
488
  });
489
+ var _input_data__x;
490
+ 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 : [];
491
+ var _input_layout_shapes;
492
+ ((_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)=>{
493
+ var _shape_line;
494
+ const lineColor = (_shape_line = shape.line) === null || _shape_line === void 0 ? void 0 : _shape_line.color;
495
+ const resolveX = (val)=>{
496
+ if (typeof val === 'number' && Array.isArray(xCategories) && xCategories[val] !== undefined) {
497
+ return xCategories[val];
498
+ }
499
+ return val;
500
+ };
501
+ const x0Key = resolveX(shape.x0);
502
+ const x1Key = resolveX(shape.x1);
503
+ const resolveY = (val)=>{
504
+ if (shape.yref === 'paper') {
505
+ if (val === 0) {
506
+ return yMinValue;
507
+ }
508
+ if (val === 1) {
509
+ return yMaxValue;
510
+ }
511
+ if (typeof val === 'number') {
512
+ return yMinValue + val * (yMaxValue - yMinValue);
513
+ }
514
+ return val;
515
+ }
516
+ return val;
517
+ };
518
+ const y0Val = resolveY(shape.y0);
519
+ const y1Val = resolveY(shape.y1);
520
+ var _rgb_formatHex8;
521
+ mapXToDataPoints[x0Key].lineData.push({
522
+ legend: `Reference_${shapeIdx}`,
523
+ y: y0Val,
524
+ color: (_rgb_formatHex8 = rgb(lineColor).formatHex8()) !== null && _rgb_formatHex8 !== void 0 ? _rgb_formatHex8 : lineColor,
525
+ lineOptions: getLineOptions(shape.line),
526
+ useSecondaryYScale: false
527
+ });
528
+ var _rgb_formatHex81;
529
+ mapXToDataPoints[x1Key].lineData.push({
530
+ legend: `Reference_${shapeIdx}`,
531
+ y: y1Val,
532
+ color: (_rgb_formatHex81 = rgb(lineColor).formatHex8()) !== null && _rgb_formatHex81 !== void 0 ? _rgb_formatHex81 : lineColor,
533
+ lineOptions: getLineOptions(shape.line),
534
+ useSecondaryYScale: false
535
+ });
536
+ });
484
537
  const vsbcData = Object.values(mapXToDataPoints);
485
538
  var _input_layout_height;
486
539
  return {
487
540
  data: vsbcData,
488
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
489
- height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
541
+ width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
542
+ 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,
490
543
  barWidth: 'auto',
491
544
  yMaxValue,
492
545
  yMinValue,
@@ -510,7 +563,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
510
563
  };
511
564
  };
512
565
  export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
513
- var _processedInput_layout, _processedInput_layout1, _gvbcData_;
566
+ var _processedInput_layout, _processedInput_layout1;
514
567
  // Handle object arrays in y values by normalizing the data first
515
568
  let processedInput = {
516
569
  ...input
@@ -539,60 +592,90 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
539
592
  data: processedData
540
593
  };
541
594
  }
542
- const mapXToDataPoints = {};
543
- const secondaryYAxisValues = getSecondaryYAxisValues(processedInput.data, processedInput.layout, 0, 0);
595
+ const gvbcDataV2 = [];
596
+ const secondaryYAxisValues = getSecondaryYAxisValues(processedInput.data, processedInput.layout);
544
597
  const { legends, hideLegend } = getLegendProps(processedInput.data, processedInput.layout, isMultiPlot);
545
598
  let colorScale = undefined;
546
599
  const yAxisTickFormat = getYAxisTickFormat(processedInput.data[0], processedInput.layout);
547
600
  processedInput.data.forEach((series, index1)=>{
548
- var _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout, _series_marker, _series_x;
549
601
  colorScale = createColorScale(processedInput.layout, series, colorScale);
550
- // extract colors for each series only once
551
- const extractedColors = 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);
552
- (_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x.forEach((x, index2)=>{
553
- var _series_y;
554
- if (isInvalidValue(x) || isInvalidValue((_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index2])) {
555
- return;
556
- }
557
- if (!mapXToDataPoints[x]) {
558
- mapXToDataPoints[x] = {
559
- name: x.toString(),
560
- series: []
561
- };
562
- }
563
- if (series.type === 'bar') {
564
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
565
- const legend = legends[index1];
566
- // resolve color for each legend's bars from the colorscale or extracted colors
567
- const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, index2, legend, colorMap, isDarkTheme);
568
- const opacity = getOpacity(series, index2);
569
- const yVal = series.y[index2];
602
+ const legend = legends[index1];
603
+ const legendShape = getLegendShape(series);
604
+ if (series.type === 'bar') {
605
+ var _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout, _series_marker;
606
+ // extract bar colors for each series only once
607
+ const extractedBarColors = 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);
608
+ gvbcDataV2.push({
609
+ type: 'bar',
610
+ legend,
611
+ key: legend,
612
+ data: series.x.map((x, xIndex)=>{
613
+ var _series_y, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout;
614
+ if (isInvalidValue(x) || isInvalidValue((_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[xIndex])) {
615
+ return;
616
+ }
617
+ // resolve color for each legend's bars from the colorscale or extracted colors
618
+ const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[xIndex % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : 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);
619
+ const opacity = getOpacity(series, xIndex);
620
+ const yVal = series.y[xIndex];
621
+ var _rgb_copy_formatHex8;
622
+ return {
623
+ x: x.toString(),
624
+ y: yVal,
625
+ yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
626
+ color: (_rgb_copy_formatHex8 = rgb(color).copy({
627
+ opacity
628
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
629
+ };
630
+ }).filter((item)=>typeof item !== 'undefined'),
631
+ useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
632
+ });
633
+ } else if (series.type === 'scatter') {
634
+ var _processedInput_layout_template_layout1, _processedInput_layout_template1, _processedInput_layout1, _series_line, _processedInput_layout_template_layout2, _processedInput_layout_template2, _processedInput_layout2;
635
+ // extract line colors for each series only once
636
+ const extractedLineColors = 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);
637
+ const lineColor = 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);
638
+ const lineOptions = getLineOptions(series.line);
639
+ const opacity = getOpacity(series, index1);
640
+ const validXYRanges = getValidXYRanges(series);
641
+ validXYRanges.forEach(([rangeStart, rangeEnd])=>{
642
+ const rangeXValues = series.x.slice(rangeStart, rangeEnd);
643
+ const rangeYValues = series.y.slice(rangeStart, rangeEnd);
570
644
  var _rgb_copy_formatHex8;
571
- mapXToDataPoints[x].series.push({
572
- key: legend,
573
- data: yVal,
574
- xAxisCalloutData: x,
575
- color: (_rgb_copy_formatHex8 = rgb(color).copy({
576
- opacity
577
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
645
+ gvbcDataV2.push({
646
+ type: 'line',
578
647
  legend,
579
- useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
580
- yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
648
+ legendShape,
649
+ data: rangeXValues.map((x, i)=>{
650
+ const yVal = rangeYValues[i];
651
+ return {
652
+ x: x.toString(),
653
+ y: yVal,
654
+ yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
655
+ };
656
+ }),
657
+ color: (_rgb_copy_formatHex8 = rgb(lineColor).copy({
658
+ opacity
659
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : lineColor,
660
+ lineOptions: {
661
+ ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
662
+ mode: series.mode
663
+ },
664
+ useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
581
665
  });
582
- }
583
- });
666
+ });
667
+ }
584
668
  });
585
- const gvbcData = Object.values(mapXToDataPoints);
586
669
  var _processedInput_layout_height;
587
670
  return {
588
- data: gvbcData,
671
+ dataV2: gvbcDataV2,
589
672
  width: (_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : _processedInput_layout.width,
590
673
  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,
591
674
  barWidth: 'auto',
592
675
  mode: 'plotly',
593
676
  ...secondaryYAxisValues,
594
677
  hideTickOverlap: true,
595
- wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
678
+ wrapXAxisLables: true,
596
679
  hideLegend,
597
680
  roundCorners: true,
598
681
  ...getTitles(processedInput.layout),
@@ -620,8 +703,9 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
620
703
  const xValues = [];
621
704
  const yValues = [];
622
705
  series.x.forEach((xVal, index)=>{
623
- const yVal = getNumberAtIndexOrDefault(series.y, index);
624
- if (isInvalidValue(xVal) || isInvalidValue(yVal)) {
706
+ var _getNumberAtIndexOrDefault;
707
+ const yVal = (_getNumberAtIndexOrDefault = getNumberAtIndexOrDefault(series.y, index)) !== null && _getNumberAtIndexOrDefault !== void 0 ? _getNumberAtIndexOrDefault : 0;
708
+ if (isInvalidValue(xVal)) {
625
709
  return;
626
710
  }
627
711
  xValues.push(xVal);
@@ -645,10 +729,10 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
645
729
  return yVal;
646
730
  });
647
731
  xBins.forEach((bin, index)=>{
648
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
732
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
649
733
  const legend = legends[seriesIdx];
650
734
  // resolve color for each legend's bars from the colorscale or extracted colors
651
- const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
735
+ const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : 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);
652
736
  const opacity = getOpacity(series, index);
653
737
  const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
654
738
  var _rgb_copy_formatHex8;
@@ -690,8 +774,29 @@ export const transformPlotlyJsonToLineChartProps = (input, isMultiPlot, colorMap
690
774
  export const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
691
775
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
692
776
  };
777
+ const mapColorFillBars = (layout)=>{
778
+ if (!Array.isArray(layout === null || layout === void 0 ? void 0 : layout.shapes)) {
779
+ return [];
780
+ }
781
+ return layout.shapes.filter((shape)=>shape.type === 'rect').map((shape)=>{
782
+ //colorFillbars doesn't support string dates or categories
783
+ if (typeof shape.x0 === 'string' || typeof shape.x1 === 'string') {
784
+ return null;
785
+ }
786
+ return {
787
+ color: shape.fillcolor,
788
+ data: [
789
+ {
790
+ startX: shape.x0,
791
+ endX: shape.x1
792
+ }
793
+ ],
794
+ applyPattern: false
795
+ };
796
+ });
797
+ };
693
798
  const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
694
- var _input_data_, _input_layout, _input_layout1;
799
+ 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;
695
800
  const isScatterMarkers = [
696
801
  'text',
697
802
  'markers',
@@ -704,36 +809,33 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
704
809
  ].includes((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.mode);
705
810
  const isAreaChart = chartType === 'area';
706
811
  const isScatterChart = chartType === 'scatter';
707
- const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
812
+ const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
708
813
  let mode = 'tonexty';
709
814
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
710
815
  const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
711
- var shouldWrapLabels = false;
816
+ const resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
817
+ const shouldWrapLabels = getAxisType(input.data, input.layout, 'x') === 'category';
712
818
  const chartData = input.data.map((series, index)=>{
713
- var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
819
+ 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;
714
820
  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;
715
821
  // extract colors for each series only once
716
822
  const extractedColors = 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);
717
823
  const xValues = series.x;
718
- const isXString = isStringArray(xValues);
719
- const isXDate = isDateArray(xValues);
720
- const isXNumber = isNumberArray(xValues);
721
- const isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
722
- shouldWrapLabels = shouldWrapLabels || isXString && !isXDate;
723
824
  const legend = legends[index];
724
825
  // resolve color for each legend's lines from the extracted colors
725
- const seriesColor = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
826
+ const seriesColor = 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);
726
827
  const seriesOpacity = getOpacity(series, index);
727
828
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
728
829
  // if mode contains 'text', we prioritize showing the text over curving the line
729
830
  const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
730
831
  const legendShape = getLegendShape(series);
731
- const validXYRanges = getValidXYRanges(series);
832
+ const validXYRanges = getValidXYRanges(series, resolveXAxisValue);
732
833
  return validXYRanges.map(([rangeStart, rangeEnd], rangeIdx)=>{
733
- var _series_marker, _input_layout, _input_layout_polar_angularaxis, _input_layout_polar, _input_layout1, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout2;
834
+ 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;
734
835
  const rangeXValues = xValues.slice(rangeStart, rangeEnd);
735
836
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
736
837
  const markerSizes = isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? series.marker.size.slice(rangeStart, rangeEnd) : [];
838
+ const markerColors = 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;
737
839
  const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : undefined;
738
840
  var _rgb_copy_formatHex8;
739
841
  return {
@@ -742,13 +844,16 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
742
844
  data: rangeXValues.map((x, i)=>{
743
845
  var _series_marker, _series_marker1;
744
846
  return {
745
- x: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
847
+ x: resolveXAxisValue(x),
746
848
  y: rangeYValues[i],
747
849
  ...Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? {
748
850
  markerSize: markerSizes[i]
749
851
  } : typeof ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.size) === 'number' ? {
750
852
  markerSize: series.marker.size
751
853
  } : {},
854
+ ...markerColors ? {
855
+ markerColor: markerColors[i]
856
+ } : {},
752
857
  ...textValues ? {
753
858
  text: textValues[i]
754
859
  } : {},
@@ -767,13 +872,70 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
767
872
  originXOffset: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.__polarOriginX,
768
873
  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,
769
874
  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,
770
- axisLabel: series.__axisLabel ? series.__axisLabel : {}
875
+ axisLabel: series.__axisLabel ? series.__axisLabel : {},
876
+ fill: series.fill
771
877
  } : {}
772
878
  },
773
879
  useSecondaryYScale: usesSecondaryYScale(series, input.layout)
774
880
  };
775
881
  });
776
882
  }).flat();
883
+ 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;
884
+ 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;
885
+ 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;
886
+ 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;
887
+ var _input_layout_shapes;
888
+ 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)=>{
889
+ var _shape_line;
890
+ const lineColor = (_shape_line = shape.line) === null || _shape_line === void 0 ? void 0 : _shape_line.color;
891
+ const resolveX = (val)=>{
892
+ if (shape.xref === 'paper') {
893
+ if (val === 0) {
894
+ return xMinValue;
895
+ }
896
+ if (val === 1) {
897
+ return xMaxValue;
898
+ }
899
+ if (typeof val === 'number' && typeof xMinValue === 'number' && typeof xMaxValue === 'number') {
900
+ return xMinValue + val * (xMaxValue - xMinValue);
901
+ }
902
+ return val;
903
+ }
904
+ return val;
905
+ };
906
+ const resolveY = (val)=>{
907
+ if (shape.yref === 'paper') {
908
+ if (val === 0) {
909
+ return yMinValue;
910
+ }
911
+ if (val === 1) {
912
+ return yMaxValue;
913
+ }
914
+ if (typeof val === 'number') {
915
+ return yMinValue + val * (yMaxValue - yMinValue);
916
+ }
917
+ return val;
918
+ }
919
+ return val;
920
+ };
921
+ var _rgb_formatHex8;
922
+ return {
923
+ legend: `Reference_${shapeIdx}`,
924
+ data: [
925
+ {
926
+ x: resolveX(shape.x0),
927
+ y: resolveY(shape.y0)
928
+ },
929
+ {
930
+ x: resolveX(shape.x1),
931
+ y: resolveY(shape.y1)
932
+ }
933
+ ],
934
+ color: (_rgb_formatHex8 = rgb(lineColor).formatHex8()) !== null && _rgb_formatHex8 !== void 0 ? _rgb_formatHex8 : lineColor,
935
+ lineOptions: getLineOptions(shape.line),
936
+ useSecondaryYScale: false
937
+ };
938
+ });
777
939
  const yMinMax = getYMinMaxValues(input.data[0], input.layout);
778
940
  if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
779
941
  const yMinMaxValues = findNumericMinMaxOfY(chartData);
@@ -782,7 +944,10 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
782
944
  }
783
945
  const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
784
946
  const chartProps = {
785
- lineChartData: chartData
947
+ lineChartData: [
948
+ ...chartData,
949
+ ...lineShape
950
+ ]
786
951
  };
787
952
  const scatterChartProps = {
788
953
  scatterChartData: chartData
@@ -791,8 +956,8 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
791
956
  const commonProps = {
792
957
  supportNegativeData: true,
793
958
  ...secondaryYAxisValues,
794
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
795
- 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,
959
+ width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
960
+ 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,
796
961
  hideTickOverlap: true,
797
962
  hideLegend,
798
963
  useUTC: false,
@@ -819,7 +984,13 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
819
984
  ...isScatterChart ? {
820
985
  showYAxisLablesTooltip: true,
821
986
  ...getAxisCategoryOrderProps(input.data, input.layout)
822
- } : {}
987
+ } : {},
988
+ ...!isScatterChart && (()=>{
989
+ const bars = mapColorFillBars(input.layout);
990
+ return bars && !bars.includes(null) ? {
991
+ colorFillBars: bars
992
+ } : {};
993
+ })()
823
994
  };
824
995
  }
825
996
  };
@@ -834,16 +1005,16 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
834
1005
  const extractedColors = 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);
835
1006
  const legend = legends[index];
836
1007
  return series.y.map((yValue, i)=>{
837
- var _series_x, _series_marker, _series_marker1, _series_marker_color, _series_marker2;
838
- if (isInvalidValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]) || isInvalidValue(yValue)) {
1008
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
1009
+ if (isInvalidValue(yValue)) {
839
1010
  return null;
840
1011
  }
841
1012
  // resolve color for each legend's bars from the colorscale or extracted colors
842
- const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, i, legend, colorMap, isDarkTheme);
1013
+ const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : 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);
843
1014
  const opacity = getOpacity(series, i);
844
1015
  var _rgb_copy_formatHex8;
845
1016
  return {
846
- x: series.x[i],
1017
+ x: isInvalidValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]) ? 0 : series.x[i],
847
1018
  y: yValue,
848
1019
  legend,
849
1020
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
@@ -885,24 +1056,24 @@ export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMa
885
1056
  var _input_layout, _input_layout1;
886
1057
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
887
1058
  let colorScale = undefined;
1059
+ const isXDate = getAxisType(input.data, input.layout, 'x') === 'date';
888
1060
  const chartData = input.data.map((series, index)=>{
889
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _input_layout_xaxis, _input_layout1;
1061
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker;
890
1062
  colorScale = createColorScale(input.layout, series, colorScale);
891
1063
  // extract colors for each series only once
892
1064
  const extractedColors = 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);
893
1065
  const legend = legends[index];
894
- 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' || isDateArray(series.x);
895
1066
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
896
1067
  const convertXValueToNumber = (value)=>{
897
1068
  return isInvalidValue(value) ? 0 : isXDate ? +parseLocalDate(value) : +value;
898
1069
  };
899
1070
  return series.y.map((yVal, i)=>{
900
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _series_base, _series_x;
1071
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_base, _series_x;
901
1072
  if (isInvalidValue(yVal)) {
902
1073
  return null;
903
1074
  }
904
1075
  // resolve color for each legend's bars from the colorscale or extracted colors
905
- const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, i, legend, colorMap, isDarkTheme);
1076
+ const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : 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);
906
1077
  const opacity = getOpacity(series, i);
907
1078
  const base = convertXValueToNumber((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
908
1079
  const xVal = convertXValueToNumber((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
@@ -951,8 +1122,9 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
951
1122
  const zValues = [];
952
1123
  (_firstData_x = firstData.x) === null || _firstData_x === void 0 ? void 0 : _firstData_x.forEach((xVal, index)=>{
953
1124
  var _firstData_y;
954
- const zVal = getNumberAtIndexOrDefault(firstData.z, index);
955
- if (isInvalidValue(xVal) || isInvalidValue((_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y[index]) || isInvalidValue(zVal)) {
1125
+ var _getNumberAtIndexOrDefault;
1126
+ const zVal = (_getNumberAtIndexOrDefault = getNumberAtIndexOrDefault(firstData.z, index)) !== null && _getNumberAtIndexOrDefault !== void 0 ? _getNumberAtIndexOrDefault : 0;
1127
+ if (isInvalidValue(xVal) || isInvalidValue((_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y[index])) {
956
1128
  return;
957
1129
  }
958
1130
  xValues.push(xVal);
@@ -1091,7 +1263,8 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
1091
1263
  const extractedNodeColors = 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);
1092
1264
  const sankeyChartData = {
1093
1265
  nodes: (_node_label = node.label) === null || _node_label === void 0 ? void 0 : _node_label.map((label, index)=>{
1094
- const color = resolveColor(extractedNodeColors, index, label, colorMap, isDarkTheme);
1266
+ var _input_layout_template_layout, _input_layout_template, _input_layout;
1267
+ const color = 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);
1095
1268
  return {
1096
1269
  nodeId: index,
1097
1270
  name: label,
@@ -1128,9 +1301,9 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
1128
1301
  const extractedColors = 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);
1129
1302
  var _firstData_gauge_axis_range_, _firstData_value, _firstData_gauge_axis_range_1, _firstData_value1;
1130
1303
  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)=>{
1131
- var _step_range, _step_range1;
1304
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _step_range, _step_range1;
1132
1305
  const legend = step.name || `Segment ${index + 1}`;
1133
- const color = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
1306
+ const color = 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);
1134
1307
  return {
1135
1308
  legend,
1136
1309
  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]),
@@ -1153,16 +1326,16 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
1153
1326
  if ((_firstData_delta = firstData.delta) === null || _firstData_delta === void 0 ? void 0 : _firstData_delta.reference) {
1154
1327
  const diff = firstData.value - firstData.delta.reference;
1155
1328
  if (diff >= 0) {
1156
- var _input_layout_template_layout2, _input_layout_template2, _input_layout4, _firstData_delta_increasing, _firstData_delta1;
1329
+ var _input_layout_template_layout2, _input_layout_template2, _input_layout4, _firstData_delta_increasing, _firstData_delta1, _input_layout_template_layout3, _input_layout_template3, _input_layout5;
1157
1330
  sublabel = `\u25B2 ${diff}`;
1158
1331
  const extractedIncreasingDeltaColors = 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);
1159
- const color = resolveColor(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
1332
+ const color = 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);
1160
1333
  sublabelColor = color;
1161
1334
  } else {
1162
- var _input_layout_template_layout3, _input_layout_template3, _input_layout5, _firstData_delta_decreasing, _firstData_delta2;
1335
+ var _input_layout_template_layout4, _input_layout_template4, _input_layout6, _firstData_delta_decreasing, _firstData_delta2, _input_layout_template_layout5, _input_layout_template5, _input_layout7;
1163
1336
  sublabel = `\u25BC ${Math.abs(diff)}`;
1164
- const extractedDecreasingDeltaColors = 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);
1165
- const color = resolveColor(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
1337
+ const extractedDecreasingDeltaColors = 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);
1338
+ const color = 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);
1166
1339
  sublabelColor = color;
1167
1340
  }
1168
1341
  }
@@ -1415,13 +1588,13 @@ export const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorM
1415
1588
  // Assign a color per series/category and use it for all subValues of that category
1416
1589
  const seriesColors = {};
1417
1590
  input.data.forEach((series, seriesIdx)=>{
1418
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1;
1591
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1, _input_layout_template_layout1, _input_layout_template1, _input_layout1;
1419
1592
  const category = series.name || `Category ${seriesIdx + 1}`;
1420
1593
  var _series_marker_colors;
1421
1594
  // Use the same color for this category across all stages
1422
1595
  const extractedColors = 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);
1423
1596
  // Always use the first color for the series/category
1424
- const color = resolveColor(extractedColors, 0, category, colorMap, isDarkTheme);
1597
+ const color = 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);
1425
1598
  seriesColors[category] = color;
1426
1599
  var _series_labels, _ref;
1427
1600
  const labels = (_ref = (_series_labels = series.labels) !== null && _series_labels !== void 0 ? _series_labels : series.y) !== null && _ref !== void 0 ? _ref : series.stage;
@@ -1469,7 +1642,8 @@ export const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorM
1469
1642
  var _series_marker_colors;
1470
1643
  const extractedColors = 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);
1471
1644
  categories.forEach((label, i)=>{
1472
- const color = resolveColor(extractedColors, i, label, colorMap, isDarkTheme);
1645
+ var _input_layout_template_layout, _input_layout_template, _input_layout;
1646
+ const color = 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);
1473
1647
  const valueNum = Number(values[i]);
1474
1648
  if (isNaN(valueNum)) {
1475
1649
  return;
@@ -1808,11 +1982,13 @@ export const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, i
1808
1982
  var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker, _pieSeries_labels;
1809
1983
  const pieSeries = series;
1810
1984
  var _input_layout_piecolorway, _input_layout_piecolorway1;
1811
- const colors = extractColor((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : pieSeries === null || pieSeries === void 0 ? void 0 : (_pieSeries_marker = pieSeries.marker) === null || _pieSeries_marker === void 0 ? void 0 : _pieSeries_marker.colors, colorMap, isDarkTheme);
1985
+ const colors = extractColor((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : pieSeries === null || pieSeries === void 0 ? void 0 : (_pieSeries_marker = pieSeries.marker) === null || _pieSeries_marker === void 0 ? void 0 : _pieSeries_marker.colors, colorMap, isDarkTheme, true);
1812
1986
  (_pieSeries_labels = pieSeries.labels) === null || _pieSeries_labels === void 0 ? void 0 : _pieSeries_labels.forEach((label, labelIndex)=>{
1987
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1;
1813
1988
  const legend = `${label}`;
1989
+ var _input_layout_piecolorway;
1814
1990
  // resolve color for each legend from the extracted colors
1815
- const color = resolveColor(colors, labelIndex, legend, colorMap, isDarkTheme);
1991
+ const color = 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);
1816
1992
  if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
1817
1993
  allupLegends.push({
1818
1994
  title: legend,
@@ -1869,7 +2045,7 @@ export const getNumberAtIndexOrDefault = (data, index)=>{
1869
2045
  }
1870
2046
  return 1;
1871
2047
  };
1872
- export const getValidXYRanges = (series)=>{
2048
+ export const getValidXYRanges = (series, resolveX, resolveY)=>{
1873
2049
  if (!isArrayOrTypedArray(series.x) || !isArrayOrTypedArray(series.y)) {
1874
2050
  return [];
1875
2051
  }
@@ -1877,7 +2053,7 @@ export const getValidXYRanges = (series)=>{
1877
2053
  let start = 0;
1878
2054
  let end = 0;
1879
2055
  for(; end < series.x.length; end++){
1880
- if (isInvalidValue(series.x[end]) || isInvalidValue(series.y[end])) {
2056
+ if (isInvalidValue(series.x[end]) || typeof resolveX === 'function' && isInvalidValue(resolveX(series.x[end])) || isInvalidValue(series.y[end]) || typeof resolveY === 'function' && isInvalidValue(resolveY(series.y[end]))) {
1881
2057
  if (end - start > 0) {
1882
2058
  ranges.push([
1883
2059
  start,
@@ -2084,6 +2260,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2084
2260
  });
2085
2261
  const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || isStringArray(values) && !isNumberArray(values) && !isDateArray(values);
2086
2262
  if (!isAxisTypeCategory) {
2263
+ result[propName] = 'data';
2087
2264
  return;
2088
2265
  }
2089
2266
  const isValidArray = isArrayOrTypedArray(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
@@ -2093,7 +2270,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2093
2270
  }
2094
2271
  if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
2095
2272
  const categoriesInTraceOrder = Array.from(new Set(values));
2096
- result[propName] = categoriesInTraceOrder;
2273
+ result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
2097
2274
  return;
2098
2275
  }
2099
2276
  result[propName] = ax.categoryorder;
@@ -2164,7 +2341,7 @@ const getAxisScaleTypeProps = (data, layout)=>{
2164
2341
  if (!ax) {
2165
2342
  return;
2166
2343
  }
2167
- const axType = getAxisType(data, axId[0], ax);
2344
+ const axType = getAxisType(data, ax);
2168
2345
  if ((!ax.tickmode || ax.tickmode === 'array') && isArrayOrTypedArray(ax.tickvals)) {
2169
2346
  const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
2170
2347
  if (axId === 'x') {
@@ -2180,12 +2357,12 @@ const getAxisScaleTypeProps = (data, layout)=>{
2180
2357
  if (axId === 'x') {
2181
2358
  props.xAxis = {
2182
2359
  tickStep: dtick,
2183
- tick0: tick0
2360
+ tick0
2184
2361
  };
2185
2362
  } else if (axId === 'y') {
2186
2363
  props.yAxis = {
2187
2364
  tickStep: dtick,
2188
- tick0: tick0
2365
+ tick0
2189
2366
  };
2190
2367
  }
2191
2368
  return;
@@ -2262,44 +2439,88 @@ const getAxisObjects = (data, layout)=>{
2262
2439
  xAxisId = axisIds.x;
2263
2440
  yAxisIds.add(axisIds.y);
2264
2441
  });
2442
+ const makeAxisObject = (axLetter, axId)=>({
2443
+ ...layout === null || layout === void 0 ? void 0 : layout[getAxisKey(axLetter, axId)],
2444
+ _id: `${axLetter}${axId > 1 ? axId : ''}`
2445
+ });
2265
2446
  const axisObjects = {};
2266
2447
  if (typeof xAxisId === 'number') {
2267
- axisObjects.x = layout === null || layout === void 0 ? void 0 : layout[getAxisKey('x', xAxisId)];
2448
+ axisObjects.x = makeAxisObject('x', xAxisId);
2268
2449
  }
2269
2450
  const sortedYAxisIds = Array.from(yAxisIds).sort();
2270
2451
  if (sortedYAxisIds.length > 0) {
2271
- axisObjects.y = layout === null || layout === void 0 ? void 0 : layout[getAxisKey('y', sortedYAxisIds[0])];
2452
+ axisObjects.y = makeAxisObject('y', sortedYAxisIds[0]);
2272
2453
  }
2273
2454
  if (sortedYAxisIds.length > 1) {
2274
- axisObjects.y2 = layout === null || layout === void 0 ? void 0 : layout[getAxisKey('y', sortedYAxisIds[1])];
2455
+ axisObjects.y2 = makeAxisObject('y', sortedYAxisIds[1]);
2275
2456
  }
2276
2457
  return axisObjects;
2277
2458
  };
2278
- const getAxisType = (data, axLetter, ax)=>{
2459
+ function getAxisType(data, arg2, arg3) {
2460
+ let ax;
2461
+ if (arg2 && typeof arg2 === 'object' && '_id' in arg2) {
2462
+ ax = arg2;
2463
+ } else if (typeof arg3 === 'string') {
2464
+ const layout = arg2;
2465
+ ax = getAxisObjects(data, layout)[arg3];
2466
+ }
2467
+ if (!ax) {
2468
+ return 'category';
2469
+ }
2470
+ var _ax_type;
2471
+ if ([
2472
+ 'linear',
2473
+ 'log',
2474
+ 'date',
2475
+ 'category'
2476
+ ].includes((_ax_type = ax.type) !== null && _ax_type !== void 0 ? _ax_type : '')) {
2477
+ return ax.type;
2478
+ }
2479
+ const axLetter = ax._id[0];
2279
2480
  const values = [];
2280
2481
  data.forEach((series)=>{
2281
- var _series_axLetter;
2282
- (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
2283
- if (!isInvalidValue(val)) {
2284
- values.push(val);
2285
- }
2286
- });
2287
- });
2288
- // Note: When ax.type is explicitly specified, Plotly casts the values to match that type.
2289
- // Therefore, simply checking the type of the values may not be sufficient. At the moment,
2290
- // we don’t always perform this casting ourselves and instead use the values as provided.
2291
- if (isNumberArray(values)) {
2292
- if ((ax === null || ax === void 0 ? void 0 : ax.type) === 'log') {
2293
- return 'log';
2482
+ const axId = series[`${axLetter}axis`];
2483
+ if (axId === ax._id || !axId && ax._id === axLetter) {
2484
+ var _series_axLetter;
2485
+ (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
2486
+ if (!isInvalidValue(val)) {
2487
+ values.push(val);
2488
+ }
2489
+ });
2294
2490
  }
2491
+ });
2492
+ if (isNumberArray(values) && !isYearArray(values)) {
2295
2493
  return 'linear';
2296
2494
  }
2297
2495
  if (isDateArray(values)) {
2298
2496
  return 'date';
2299
2497
  }
2300
- if (isStringArray(values)) {
2301
- return 'category';
2302
- }
2498
+ return 'category';
2499
+ }
2500
+ const getAxisValueResolver = (data, layout, axisId)=>{
2501
+ const axType = getAxisType(data, layout, axisId);
2502
+ return (value)=>{
2503
+ if (isInvalidValue(value)) {
2504
+ return null;
2505
+ }
2506
+ switch(axType){
2507
+ case 'linear':
2508
+ case 'log':
2509
+ return isNumber(value) ? +value : null;
2510
+ case 'date':
2511
+ if (isNumber(value)) {
2512
+ return new Date(+value);
2513
+ }
2514
+ if (typeof value === 'string') {
2515
+ return new Date(value);
2516
+ }
2517
+ return null;
2518
+ case 'category':
2519
+ return `${value}`;
2520
+ default:
2521
+ return null;
2522
+ }
2523
+ };
2303
2524
  };
2304
2525
  /**
2305
2526
  * This is experimental. Use it only with valid datetime strings to verify if they conform to the ISO 8601 format.