@fluentui/react-charts 9.3.2 → 9.3.4

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 (145) hide show
  1. package/CHANGELOG.md +47 -2
  2. package/dist/index.d.ts +151 -1
  3. package/lib/components/AreaChart/AreaChart.js +208 -60
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/ChartTable/ChartTable.js +14 -12
  6. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  7. package/lib/components/ChartTable/useChartTableStyles.styles.js +3 -3
  8. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  9. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
  10. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  11. package/lib/components/CommonComponents/CartesianChart.js +5 -6
  12. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  13. package/lib/components/CommonComponents/ChartPopover.js +2 -1
  14. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  15. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
  16. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +3 -2
  17. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  18. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
  19. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  20. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +3 -2
  21. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  22. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
  23. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  24. package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -7
  25. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  26. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +63 -18
  27. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  28. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +471 -207
  29. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  30. package/lib/components/DonutChart/Arc/Arc.js +8 -7
  31. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  32. package/lib/components/DonutChart/DonutChart.js +16 -32
  33. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  34. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  35. package/lib/components/DonutChart/Pie/Pie.js +4 -4
  36. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  37. package/lib/components/DonutChart/useDonutChartStyles.styles.js +3 -2
  38. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  39. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
  40. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  41. package/lib/components/FunnelChart/FunnelChart.js +23 -45
  42. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  43. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +3 -2
  44. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  45. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
  46. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  47. package/lib/components/GaugeChart/GaugeChart.js +21 -46
  48. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  49. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +3 -2
  50. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  51. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
  52. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  53. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +332 -114
  54. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  55. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  56. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +3 -2
  57. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  58. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
  59. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  60. package/lib/components/Legends/Legends.js +1 -1
  61. package/lib/components/Legends/Legends.js.map +1 -1
  62. package/lib/components/LineChart/LineChart.js +145 -97
  63. package/lib/components/LineChart/LineChart.js.map +1 -1
  64. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +3 -2
  65. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  66. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
  67. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  68. package/lib/components/ScatterChart/ScatterChart.js +7 -11
  69. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  70. package/lib/types/DataPoint.js +1 -3
  71. package/lib/types/DataPoint.js.map +1 -1
  72. package/lib/utilities/utilities.js +77 -26
  73. package/lib/utilities/utilities.js.map +1 -1
  74. package/lib-commonjs/components/AreaChart/AreaChart.js +207 -59
  75. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  76. package/lib-commonjs/components/ChartTable/ChartTable.js +13 -12
  77. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  78. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +3 -3
  79. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  80. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
  81. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  82. package/lib-commonjs/components/CommonComponents/CartesianChart.js +5 -6
  83. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  84. package/lib-commonjs/components/CommonComponents/ChartPopover.js +2 -1
  85. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  86. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
  87. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -1
  88. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  89. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
  90. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  91. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +7 -1
  92. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  93. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
  94. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  95. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +16 -7
  96. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  97. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +65 -18
  98. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  99. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +470 -206
  100. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  101. package/lib-commonjs/components/DonutChart/Arc/Arc.js +8 -7
  102. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  103. package/lib-commonjs/components/DonutChart/DonutChart.js +16 -32
  104. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  105. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  106. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -4
  107. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  108. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +7 -1
  109. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  110. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
  111. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  112. package/lib-commonjs/components/FunnelChart/FunnelChart.js +23 -45
  113. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  114. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +7 -1
  115. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  116. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
  117. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  118. package/lib-commonjs/components/GaugeChart/GaugeChart.js +21 -46
  119. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  120. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +7 -1
  121. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  122. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
  123. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  124. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +329 -112
  125. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  126. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  127. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +7 -1
  128. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  129. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
  130. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  131. package/lib-commonjs/components/Legends/Legends.js +1 -1
  132. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  133. package/lib-commonjs/components/LineChart/LineChart.js +144 -96
  134. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  135. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +7 -1
  136. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  137. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
  138. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  139. package/lib-commonjs/components/ScatterChart/ScatterChart.js +6 -10
  140. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  141. package/lib-commonjs/types/DataPoint.js +1 -3
  142. package/lib-commonjs/types/DataPoint.js.map +1 -1
  143. package/lib-commonjs/utilities/utilities.js +80 -26
  144. package/lib-commonjs/utilities/utilities.js.map +1 -1
  145. package/package.json +13 -13
@@ -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_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 resolveXValue = getAxisValueResolver(getAxisType(input.data, getAxisObjects(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, resolveXValue);
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: resolveXValue(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,75 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
481
486
  });
482
487
  });
483
488
  });
489
+ var _input_data;
490
+ const xCategories = Array.from(new Set(((_input_data = input.data) !== null && _input_data !== void 0 ? _input_data : []).flatMap((trace)=>{
491
+ const xData = trace.x;
492
+ if (!xData) {
493
+ return [];
494
+ }
495
+ if (Array.isArray(xData)) {
496
+ return xData.flat().map((x)=>{
497
+ return x;
498
+ });
499
+ }
500
+ return [];
501
+ }).filter((x)=>x !== undefined && x !== null)));
502
+ var _input_layout_shapes;
503
+ ((_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)=>{
504
+ var _shape_line;
505
+ const lineColor = (_shape_line = shape.line) === null || _shape_line === void 0 ? void 0 : _shape_line.color;
506
+ const resolveX = (val)=>{
507
+ if (typeof val === 'number' && Array.isArray(xCategories)) {
508
+ if (xCategories[val] !== undefined) {
509
+ return xCategories[val];
510
+ } else {
511
+ return xCategories[shapeIdx];
512
+ }
513
+ }
514
+ return val;
515
+ };
516
+ const x0Key = resolveX(shape.x0);
517
+ const x1Key = resolveX(shape.x1);
518
+ const resolveY = (val)=>{
519
+ if (shape.yref === 'paper') {
520
+ if (val === 0) {
521
+ return yMinValue;
522
+ }
523
+ if (val === 1) {
524
+ return yMaxValue;
525
+ }
526
+ if (typeof val === 'number') {
527
+ return yMinValue + val * (yMaxValue - yMinValue);
528
+ }
529
+ return val;
530
+ }
531
+ return val;
532
+ };
533
+ const y0Val = resolveY(shape.y0);
534
+ const y1Val = resolveY(shape.y1);
535
+ var _rgb_formatHex8;
536
+ mapXToDataPoints[x0Key].lineData.push({
537
+ legend: `Reference_${shapeIdx}`,
538
+ y: y0Val,
539
+ color: (_rgb_formatHex8 = rgb(lineColor).formatHex8()) !== null && _rgb_formatHex8 !== void 0 ? _rgb_formatHex8 : lineColor,
540
+ lineOptions: getLineOptions(shape.line),
541
+ useSecondaryYScale: false
542
+ });
543
+ var _rgb_formatHex81;
544
+ mapXToDataPoints[x1Key].lineData.push({
545
+ legend: `Reference_${shapeIdx}`,
546
+ y: y1Val,
547
+ color: (_rgb_formatHex81 = rgb(lineColor).formatHex8()) !== null && _rgb_formatHex81 !== void 0 ? _rgb_formatHex81 : lineColor,
548
+ lineOptions: getLineOptions(shape.line),
549
+ useSecondaryYScale: false
550
+ });
551
+ });
484
552
  const vsbcData = Object.values(mapXToDataPoints);
485
553
  var _input_layout_height;
486
554
  return {
487
555
  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,
556
+ width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
557
+ 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
558
  barWidth: 'auto',
491
559
  yMaxValue,
492
560
  yMinValue,
@@ -510,7 +578,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
510
578
  };
511
579
  };
512
580
  export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
513
- var _processedInput_layout, _processedInput_layout1, _gvbcData_;
581
+ var _processedInput_layout, _processedInput_layout1;
514
582
  // Handle object arrays in y values by normalizing the data first
515
583
  let processedInput = {
516
584
  ...input
@@ -539,60 +607,90 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
539
607
  data: processedData
540
608
  };
541
609
  }
542
- const mapXToDataPoints = {};
543
- const secondaryYAxisValues = getSecondaryYAxisValues(processedInput.data, processedInput.layout, 0, 0);
610
+ const gvbcDataV2 = [];
611
+ const secondaryYAxisValues = getSecondaryYAxisValues(processedInput.data, processedInput.layout);
544
612
  const { legends, hideLegend } = getLegendProps(processedInput.data, processedInput.layout, isMultiPlot);
545
613
  let colorScale = undefined;
546
614
  const yAxisTickFormat = getYAxisTickFormat(processedInput.data[0], processedInput.layout);
547
615
  processedInput.data.forEach((series, index1)=>{
548
- var _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout, _series_marker, _series_x;
549
616
  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];
617
+ const legend = legends[index1];
618
+ const legendShape = getLegendShape(series);
619
+ if (series.type === 'bar') {
620
+ var _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout, _series_marker;
621
+ // extract bar colors for each series only once
622
+ 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);
623
+ gvbcDataV2.push({
624
+ type: 'bar',
625
+ legend,
626
+ key: legend,
627
+ data: series.x.map((x, xIndex)=>{
628
+ var _series_y, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout;
629
+ if (isInvalidValue(x) || isInvalidValue((_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[xIndex])) {
630
+ return;
631
+ }
632
+ // resolve color for each legend's bars from the colorscale or extracted colors
633
+ 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);
634
+ const opacity = getOpacity(series, xIndex);
635
+ const yVal = series.y[xIndex];
636
+ var _rgb_copy_formatHex8;
637
+ return {
638
+ x: x.toString(),
639
+ y: yVal,
640
+ yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
641
+ color: (_rgb_copy_formatHex8 = rgb(color).copy({
642
+ opacity
643
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
644
+ };
645
+ }).filter((item)=>typeof item !== 'undefined'),
646
+ useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
647
+ });
648
+ } else if (series.type === 'scatter') {
649
+ var _processedInput_layout_template_layout1, _processedInput_layout_template1, _processedInput_layout1, _series_line, _processedInput_layout_template_layout2, _processedInput_layout_template2, _processedInput_layout2;
650
+ // extract line colors for each series only once
651
+ 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);
652
+ 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);
653
+ const lineOptions = getLineOptions(series.line);
654
+ const opacity = getOpacity(series, index1);
655
+ const validXYRanges = getValidXYRanges(series);
656
+ validXYRanges.forEach(([rangeStart, rangeEnd])=>{
657
+ const rangeXValues = series.x.slice(rangeStart, rangeEnd);
658
+ const rangeYValues = series.y.slice(rangeStart, rangeEnd);
570
659
  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,
660
+ gvbcDataV2.push({
661
+ type: 'line',
578
662
  legend,
579
- useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
580
- yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
663
+ legendShape,
664
+ data: rangeXValues.map((x, i)=>{
665
+ const yVal = rangeYValues[i];
666
+ return {
667
+ x: x.toString(),
668
+ y: yVal,
669
+ yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
670
+ };
671
+ }),
672
+ color: (_rgb_copy_formatHex8 = rgb(lineColor).copy({
673
+ opacity
674
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : lineColor,
675
+ lineOptions: {
676
+ ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
677
+ mode: series.mode
678
+ },
679
+ useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
581
680
  });
582
- }
583
- });
681
+ });
682
+ }
584
683
  });
585
- const gvbcData = Object.values(mapXToDataPoints);
586
684
  var _processedInput_layout_height;
587
685
  return {
588
- data: gvbcData,
686
+ dataV2: gvbcDataV2,
589
687
  width: (_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : _processedInput_layout.width,
590
688
  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
689
  barWidth: 'auto',
592
690
  mode: 'plotly',
593
691
  ...secondaryYAxisValues,
594
692
  hideTickOverlap: true,
595
- wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
693
+ wrapXAxisLables: true,
596
694
  hideLegend,
597
695
  roundCorners: true,
598
696
  ...getTitles(processedInput.layout),
@@ -620,8 +718,9 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
620
718
  const xValues = [];
621
719
  const yValues = [];
622
720
  series.x.forEach((xVal, index)=>{
623
- const yVal = getNumberAtIndexOrDefault(series.y, index);
624
- if (isInvalidValue(xVal) || isInvalidValue(yVal)) {
721
+ var _getNumberAtIndexOrDefault;
722
+ const yVal = (_getNumberAtIndexOrDefault = getNumberAtIndexOrDefault(series.y, index)) !== null && _getNumberAtIndexOrDefault !== void 0 ? _getNumberAtIndexOrDefault : 0;
723
+ if (isInvalidValue(xVal)) {
625
724
  return;
626
725
  }
627
726
  xValues.push(xVal);
@@ -645,10 +744,10 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
645
744
  return yVal;
646
745
  });
647
746
  xBins.forEach((bin, index)=>{
648
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
747
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
649
748
  const legend = legends[seriesIdx];
650
749
  // 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);
750
+ 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
751
  const opacity = getOpacity(series, index);
653
752
  const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
654
753
  var _rgb_copy_formatHex8;
@@ -690,8 +789,29 @@ export const transformPlotlyJsonToLineChartProps = (input, isMultiPlot, colorMap
690
789
  export const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
691
790
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
692
791
  };
792
+ const mapColorFillBars = (layout)=>{
793
+ if (!Array.isArray(layout === null || layout === void 0 ? void 0 : layout.shapes)) {
794
+ return [];
795
+ }
796
+ return layout.shapes.filter((shape)=>shape.type === 'rect').map((shape)=>{
797
+ //colorFillbars doesn't support string dates or categories
798
+ if (typeof shape.x0 === 'string' || typeof shape.x1 === 'string') {
799
+ return null;
800
+ }
801
+ return {
802
+ color: shape.fillcolor,
803
+ data: [
804
+ {
805
+ startX: shape.x0,
806
+ endX: shape.x1
807
+ }
808
+ ],
809
+ applyPattern: false
810
+ };
811
+ });
812
+ };
693
813
  const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
694
- var _input_data_, _input_layout, _input_layout1;
814
+ 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
815
  const isScatterMarkers = [
696
816
  'text',
697
817
  'markers',
@@ -704,36 +824,34 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
704
824
  ].includes((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.mode);
705
825
  const isAreaChart = chartType === 'area';
706
826
  const isScatterChart = chartType === 'scatter';
707
- const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
827
+ const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
708
828
  let mode = 'tonexty';
709
829
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
710
830
  const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
711
- var shouldWrapLabels = false;
831
+ const xAxisType = getAxisType(input.data, getAxisObjects(input.data, input.layout).x);
832
+ const resolveXValue = getAxisValueResolver(xAxisType);
833
+ const shouldWrapLabels = xAxisType === 'category';
712
834
  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;
835
+ 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
836
  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
837
  // extract colors for each series only once
716
838
  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
839
  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
840
  const legend = legends[index];
724
841
  // resolve color for each legend's lines from the extracted colors
725
- const seriesColor = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
842
+ 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
843
  const seriesOpacity = getOpacity(series, index);
727
844
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
728
845
  // if mode contains 'text', we prioritize showing the text over curving the line
729
846
  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
847
  const legendShape = getLegendShape(series);
731
- const validXYRanges = getValidXYRanges(series);
848
+ const validXYRanges = getValidXYRanges(series, resolveXValue);
732
849
  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;
850
+ 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
851
  const rangeXValues = xValues.slice(rangeStart, rangeEnd);
735
852
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
736
853
  const markerSizes = isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? series.marker.size.slice(rangeStart, rangeEnd) : [];
854
+ 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
855
  const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : undefined;
738
856
  var _rgb_copy_formatHex8;
739
857
  return {
@@ -742,13 +860,16 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
742
860
  data: rangeXValues.map((x, i)=>{
743
861
  var _series_marker, _series_marker1;
744
862
  return {
745
- x: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
863
+ x: resolveXValue(x),
746
864
  y: rangeYValues[i],
747
865
  ...Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? {
748
866
  markerSize: markerSizes[i]
749
867
  } : typeof ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.size) === 'number' ? {
750
868
  markerSize: series.marker.size
751
869
  } : {},
870
+ ...markerColors ? {
871
+ markerColor: markerColors[i]
872
+ } : {},
752
873
  ...textValues ? {
753
874
  text: textValues[i]
754
875
  } : {},
@@ -767,13 +888,70 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
767
888
  originXOffset: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.__polarOriginX,
768
889
  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
890
  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 : {}
891
+ axisLabel: series.__axisLabel ? series.__axisLabel : {},
892
+ fill: series.fill
771
893
  } : {}
772
894
  },
773
895
  useSecondaryYScale: usesSecondaryYScale(series, input.layout)
774
896
  };
775
897
  });
776
898
  }).flat();
899
+ 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;
900
+ 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;
901
+ 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;
902
+ 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;
903
+ var _input_layout_shapes;
904
+ 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)=>{
905
+ var _shape_line;
906
+ const lineColor = (_shape_line = shape.line) === null || _shape_line === void 0 ? void 0 : _shape_line.color;
907
+ const resolveX = (val)=>{
908
+ if (shape.xref === 'paper') {
909
+ if (val === 0) {
910
+ return xMinValue;
911
+ }
912
+ if (val === 1) {
913
+ return xMaxValue;
914
+ }
915
+ if (typeof val === 'number' && typeof xMinValue === 'number' && typeof xMaxValue === 'number') {
916
+ return xMinValue + val * (xMaxValue - xMinValue);
917
+ }
918
+ return val;
919
+ }
920
+ return val;
921
+ };
922
+ const resolveY = (val)=>{
923
+ if (shape.yref === 'paper') {
924
+ if (val === 0) {
925
+ return yMinValue;
926
+ }
927
+ if (val === 1) {
928
+ return yMaxValue;
929
+ }
930
+ if (typeof val === 'number') {
931
+ return yMinValue + val * (yMaxValue - yMinValue);
932
+ }
933
+ return val;
934
+ }
935
+ return val;
936
+ };
937
+ var _rgb_formatHex8;
938
+ return {
939
+ legend: `Reference_${shapeIdx}`,
940
+ data: [
941
+ {
942
+ x: resolveX(shape.x0),
943
+ y: resolveY(shape.y0)
944
+ },
945
+ {
946
+ x: resolveX(shape.x1),
947
+ y: resolveY(shape.y1)
948
+ }
949
+ ],
950
+ color: (_rgb_formatHex8 = rgb(lineColor).formatHex8()) !== null && _rgb_formatHex8 !== void 0 ? _rgb_formatHex8 : lineColor,
951
+ lineOptions: getLineOptions(shape.line),
952
+ useSecondaryYScale: false
953
+ };
954
+ });
777
955
  const yMinMax = getYMinMaxValues(input.data[0], input.layout);
778
956
  if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
779
957
  const yMinMaxValues = findNumericMinMaxOfY(chartData);
@@ -782,7 +960,10 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
782
960
  }
783
961
  const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
784
962
  const chartProps = {
785
- lineChartData: chartData
963
+ lineChartData: [
964
+ ...chartData,
965
+ ...lineShape
966
+ ]
786
967
  };
787
968
  const scatterChartProps = {
788
969
  scatterChartData: chartData
@@ -791,8 +972,8 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
791
972
  const commonProps = {
792
973
  supportNegativeData: true,
793
974
  ...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,
975
+ width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
976
+ 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
977
  hideTickOverlap: true,
797
978
  hideLegend,
798
979
  useUTC: false,
@@ -819,7 +1000,13 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
819
1000
  ...isScatterChart ? {
820
1001
  showYAxisLablesTooltip: true,
821
1002
  ...getAxisCategoryOrderProps(input.data, input.layout)
822
- } : {}
1003
+ } : {},
1004
+ ...!isScatterChart && (()=>{
1005
+ const bars = mapColorFillBars(input.layout);
1006
+ return bars && !bars.includes(null) ? {
1007
+ colorFillBars: bars
1008
+ } : {};
1009
+ })()
823
1010
  };
824
1011
  }
825
1012
  };
@@ -834,16 +1021,16 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
834
1021
  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
1022
  const legend = legends[index];
836
1023
  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)) {
1024
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
1025
+ if (isInvalidValue(yValue)) {
839
1026
  return null;
840
1027
  }
841
1028
  // 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);
1029
+ 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
1030
  const opacity = getOpacity(series, i);
844
1031
  var _rgb_copy_formatHex8;
845
1032
  return {
846
- x: series.x[i],
1033
+ x: isInvalidValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]) ? 0 : series.x[i],
847
1034
  y: yValue,
848
1035
  legend,
849
1036
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
@@ -883,46 +1070,71 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
883
1070
  };
884
1071
  export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
885
1072
  var _input_layout, _input_layout1;
886
- const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1073
+ const data = input.data.filter((series)=>series.type !== 'scatter' || series.mode !== 'markers');
1074
+ const { legends, hideLegend } = getLegendProps(data, input.layout, isMultiPlot);
887
1075
  let colorScale = undefined;
888
- 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;
890
- colorScale = createColorScale(input.layout, series, colorScale);
891
- // extract colors for each series only once
892
- 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);
1076
+ const xAxisType = getAxisType(data, getAxisObjects(data, input.layout).x);
1077
+ const resolveXValue = getAxisValueResolver(xAxisType, parseLocalDate);
1078
+ const resolveGanttXValue = (value)=>{
1079
+ const resolvedValue = resolveXValue(value);
1080
+ return typeof resolvedValue === 'string' ? 0 : resolvedValue !== null && resolvedValue !== void 0 ? resolvedValue : 0;
1081
+ };
1082
+ const isXDate = xAxisType === 'date';
1083
+ const ganttData = [];
1084
+ data.forEach((series, index)=>{
893
1085
  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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
896
- const convertXValueToNumber = (value)=>{
897
- return isInvalidValue(value) ? 0 : isXDate ? +parseLocalDate(value) : +value;
898
- };
899
- return series.y.map((yVal, i)=>{
900
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _series_base, _series_x;
901
- if (isInvalidValue(yVal)) {
902
- return null;
1086
+ if (series.type === 'bar') {
1087
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker;
1088
+ colorScale = createColorScale(input.layout, series, colorScale);
1089
+ // extract colors for each series only once
1090
+ 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);
1091
+ series.y.forEach((yVal, i)=>{
1092
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_base, _series_x;
1093
+ if (isInvalidValue(yVal)) {
1094
+ return;
1095
+ }
1096
+ // resolve color for each legend's bars from the colorscale or extracted colors
1097
+ 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);
1098
+ const opacity = getOpacity(series, i);
1099
+ const base = +resolveGanttXValue((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
1100
+ const xVal = +resolveGanttXValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
1101
+ var _rgb_copy_formatHex8;
1102
+ ganttData.push({
1103
+ x: {
1104
+ start: isXDate ? new Date(base) : base,
1105
+ end: isXDate ? new Date(base + xVal) : base + xVal
1106
+ },
1107
+ y: yVal,
1108
+ legend,
1109
+ color: (_rgb_copy_formatHex8 = rgb(color).copy({
1110
+ opacity
1111
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
1112
+ });
1113
+ });
1114
+ } else if (series.type === 'scatter' && series.mode === 'none' && series.fill === 'toself') {
1115
+ for(let i = 0; i < series.y.length; i += 5){
1116
+ if (isInvalidValue(series.y[i]) || isInvalidValue(series.y[i + 3])) {
1117
+ continue;
1118
+ }
1119
+ const x0 = resolveGanttXValue(series.x[i]);
1120
+ const x1 = resolveGanttXValue(series.x[i + 1]);
1121
+ const y0 = series.y[i];
1122
+ const y1 = series.y[i + 3];
1123
+ ganttData.push({
1124
+ x: {
1125
+ start: x0,
1126
+ end: x1
1127
+ },
1128
+ y: Math.round((y0 + y1) / 2),
1129
+ legend,
1130
+ color: series.fillcolor
1131
+ });
903
1132
  }
904
- // 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);
906
- const opacity = getOpacity(series, i);
907
- const base = convertXValueToNumber((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
908
- const xVal = convertXValueToNumber((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
909
- var _rgb_copy_formatHex8;
910
- return {
911
- x: {
912
- start: isXDate ? new Date(base) : base,
913
- end: isXDate ? new Date(base + xVal) : base + xVal
914
- },
915
- y: yVal,
916
- legend,
917
- color: (_rgb_copy_formatHex8 = rgb(color).copy({
918
- opacity
919
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
920
- };
921
- }).filter((point)=>point !== null);
922
- }).flat();
1133
+ }
1134
+ });
923
1135
  var _input_layout_height;
924
1136
  return {
925
- data: chartData,
1137
+ data: ganttData,
926
1138
  showYAxisLables: true,
927
1139
  height: (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
928
1140
  width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
@@ -933,9 +1145,9 @@ export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMa
933
1145
  roundCorners: true,
934
1146
  useUTC: false,
935
1147
  ...getTitles(input.layout),
936
- ...getAxisCategoryOrderProps(input.data, input.layout),
937
- ...getBarProps(input.data, input.layout, true),
938
- ...getAxisTickProps(input.data, input.layout)
1148
+ ...getAxisCategoryOrderProps(data, input.layout),
1149
+ ...getBarProps(data, input.layout, true),
1150
+ ...getAxisTickProps(data, input.layout)
939
1151
  };
940
1152
  };
941
1153
  export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -951,8 +1163,9 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
951
1163
  const zValues = [];
952
1164
  (_firstData_x = firstData.x) === null || _firstData_x === void 0 ? void 0 : _firstData_x.forEach((xVal, index)=>{
953
1165
  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)) {
1166
+ var _getNumberAtIndexOrDefault;
1167
+ const zVal = (_getNumberAtIndexOrDefault = getNumberAtIndexOrDefault(firstData.z, index)) !== null && _getNumberAtIndexOrDefault !== void 0 ? _getNumberAtIndexOrDefault : 0;
1168
+ if (isInvalidValue(xVal) || isInvalidValue((_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y[index])) {
956
1169
  return;
957
1170
  }
958
1171
  xValues.push(xVal);
@@ -1091,7 +1304,8 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
1091
1304
  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
1305
  const sankeyChartData = {
1093
1306
  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);
1307
+ var _input_layout_template_layout, _input_layout_template, _input_layout;
1308
+ 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
1309
  return {
1096
1310
  nodeId: index,
1097
1311
  name: label,
@@ -1128,9 +1342,9 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
1128
1342
  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
1343
  var _firstData_gauge_axis_range_, _firstData_value, _firstData_gauge_axis_range_1, _firstData_value1;
1130
1344
  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;
1345
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _step_range, _step_range1;
1132
1346
  const legend = step.name || `Segment ${index + 1}`;
1133
- const color = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
1347
+ 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
1348
  return {
1135
1349
  legend,
1136
1350
  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 +1367,16 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
1153
1367
  if ((_firstData_delta = firstData.delta) === null || _firstData_delta === void 0 ? void 0 : _firstData_delta.reference) {
1154
1368
  const diff = firstData.value - firstData.delta.reference;
1155
1369
  if (diff >= 0) {
1156
- var _input_layout_template_layout2, _input_layout_template2, _input_layout4, _firstData_delta_increasing, _firstData_delta1;
1370
+ 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
1371
  sublabel = `\u25B2 ${diff}`;
1158
1372
  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);
1373
+ 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
1374
  sublabelColor = color;
1161
1375
  } else {
1162
- var _input_layout_template_layout3, _input_layout_template3, _input_layout5, _firstData_delta_decreasing, _firstData_delta2;
1376
+ 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
1377
  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);
1378
+ 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);
1379
+ 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
1380
  sublabelColor = color;
1167
1381
  }
1168
1382
  }
@@ -1415,13 +1629,13 @@ export const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorM
1415
1629
  // Assign a color per series/category and use it for all subValues of that category
1416
1630
  const seriesColors = {};
1417
1631
  input.data.forEach((series, seriesIdx)=>{
1418
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1;
1632
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1, _input_layout_template_layout1, _input_layout_template1, _input_layout1;
1419
1633
  const category = series.name || `Category ${seriesIdx + 1}`;
1420
1634
  var _series_marker_colors;
1421
1635
  // Use the same color for this category across all stages
1422
1636
  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
1637
  // Always use the first color for the series/category
1424
- const color = resolveColor(extractedColors, 0, category, colorMap, isDarkTheme);
1638
+ 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
1639
  seriesColors[category] = color;
1426
1640
  var _series_labels, _ref;
1427
1641
  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 +1683,8 @@ export const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorM
1469
1683
  var _series_marker_colors;
1470
1684
  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
1685
  categories.forEach((label, i)=>{
1472
- const color = resolveColor(extractedColors, i, label, colorMap, isDarkTheme);
1686
+ var _input_layout_template_layout, _input_layout_template, _input_layout;
1687
+ 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
1688
  const valueNum = Number(values[i]);
1474
1689
  if (isNaN(valueNum)) {
1475
1690
  return;
@@ -1808,11 +2023,13 @@ export const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, i
1808
2023
  var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker, _pieSeries_labels;
1809
2024
  const pieSeries = series;
1810
2025
  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);
2026
+ 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
2027
  (_pieSeries_labels = pieSeries.labels) === null || _pieSeries_labels === void 0 ? void 0 : _pieSeries_labels.forEach((label, labelIndex)=>{
2028
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1;
1813
2029
  const legend = `${label}`;
2030
+ var _input_layout_piecolorway;
1814
2031
  // resolve color for each legend from the extracted colors
1815
- const color = resolveColor(colors, labelIndex, legend, colorMap, isDarkTheme);
2032
+ 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
2033
  if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
1817
2034
  allupLegends.push({
1818
2035
  title: legend,
@@ -1869,7 +2086,7 @@ export const getNumberAtIndexOrDefault = (data, index)=>{
1869
2086
  }
1870
2087
  return 1;
1871
2088
  };
1872
- export const getValidXYRanges = (series)=>{
2089
+ export const getValidXYRanges = (series, resolveX, resolveY)=>{
1873
2090
  if (!isArrayOrTypedArray(series.x) || !isArrayOrTypedArray(series.y)) {
1874
2091
  return [];
1875
2092
  }
@@ -1877,7 +2094,7 @@ export const getValidXYRanges = (series)=>{
1877
2094
  let start = 0;
1878
2095
  let end = 0;
1879
2096
  for(; end < series.x.length; end++){
1880
- if (isInvalidValue(series.x[end]) || isInvalidValue(series.y[end])) {
2097
+ 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
2098
  if (end - start > 0) {
1882
2099
  ranges.push([
1883
2100
  start,
@@ -2084,6 +2301,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2084
2301
  });
2085
2302
  const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || isStringArray(values) && !isNumberArray(values) && !isDateArray(values);
2086
2303
  if (!isAxisTypeCategory) {
2304
+ result[propName] = 'data';
2087
2305
  return;
2088
2306
  }
2089
2307
  const isValidArray = isArrayOrTypedArray(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
@@ -2093,7 +2311,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2093
2311
  }
2094
2312
  if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
2095
2313
  const categoriesInTraceOrder = Array.from(new Set(values));
2096
- result[propName] = categoriesInTraceOrder;
2314
+ result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
2097
2315
  return;
2098
2316
  }
2099
2317
  result[propName] = ax.categoryorder;
@@ -2164,13 +2382,19 @@ const getAxisScaleTypeProps = (data, layout)=>{
2164
2382
  if (!ax) {
2165
2383
  return;
2166
2384
  }
2167
- const axType = getAxisType(data, axId[0], ax);
2385
+ const axType = getAxisType(data, ax);
2168
2386
  if ((!ax.tickmode || ax.tickmode === 'array') && isArrayOrTypedArray(ax.tickvals)) {
2169
2387
  const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
2170
2388
  if (axId === 'x') {
2171
2389
  props.tickValues = tickValues;
2390
+ props.xAxis = {
2391
+ tickText: ax.ticktext
2392
+ };
2172
2393
  } else if (axId === 'y') {
2173
2394
  props.yAxisTickValues = tickValues;
2395
+ props.yAxis = {
2396
+ tickText: ax.ticktext
2397
+ };
2174
2398
  }
2175
2399
  return;
2176
2400
  }
@@ -2180,12 +2404,12 @@ const getAxisScaleTypeProps = (data, layout)=>{
2180
2404
  if (axId === 'x') {
2181
2405
  props.xAxis = {
2182
2406
  tickStep: dtick,
2183
- tick0: tick0
2407
+ tick0
2184
2408
  };
2185
2409
  } else if (axId === 'y') {
2186
2410
  props.yAxis = {
2187
2411
  tickStep: dtick,
2188
- tick0: tick0
2412
+ tick0
2189
2413
  };
2190
2414
  }
2191
2415
  return;
@@ -2262,44 +2486,84 @@ const getAxisObjects = (data, layout)=>{
2262
2486
  xAxisId = axisIds.x;
2263
2487
  yAxisIds.add(axisIds.y);
2264
2488
  });
2489
+ const makeAxisObject = (axLetter, axId)=>({
2490
+ ...layout === null || layout === void 0 ? void 0 : layout[getAxisKey(axLetter, axId)],
2491
+ _id: `${axLetter}${axId > 1 ? axId : ''}`
2492
+ });
2265
2493
  const axisObjects = {};
2266
2494
  if (typeof xAxisId === 'number') {
2267
- axisObjects.x = layout === null || layout === void 0 ? void 0 : layout[getAxisKey('x', xAxisId)];
2495
+ axisObjects.x = makeAxisObject('x', xAxisId);
2268
2496
  }
2269
2497
  const sortedYAxisIds = Array.from(yAxisIds).sort();
2270
2498
  if (sortedYAxisIds.length > 0) {
2271
- axisObjects.y = layout === null || layout === void 0 ? void 0 : layout[getAxisKey('y', sortedYAxisIds[0])];
2499
+ axisObjects.y = makeAxisObject('y', sortedYAxisIds[0]);
2272
2500
  }
2273
2501
  if (sortedYAxisIds.length > 1) {
2274
- axisObjects.y2 = layout === null || layout === void 0 ? void 0 : layout[getAxisKey('y', sortedYAxisIds[1])];
2502
+ axisObjects.y2 = makeAxisObject('y', sortedYAxisIds[1]);
2275
2503
  }
2276
2504
  return axisObjects;
2277
2505
  };
2278
- const getAxisType = (data, axLetter, ax)=>{
2506
+ const getAxisType = (data, ax)=>{
2507
+ if (!ax) {
2508
+ return 'category';
2509
+ }
2510
+ var _ax_type;
2511
+ if ([
2512
+ 'linear',
2513
+ 'log',
2514
+ 'date',
2515
+ 'category'
2516
+ ].includes((_ax_type = ax.type) !== null && _ax_type !== void 0 ? _ax_type : '')) {
2517
+ return ax.type;
2518
+ }
2519
+ const axLetter = ax._id[0];
2279
2520
  const values = [];
2280
2521
  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';
2522
+ const axId = series[`${axLetter}axis`];
2523
+ if (axId === ax._id || !axId && ax._id === axLetter) {
2524
+ var _series_axLetter;
2525
+ (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
2526
+ if (!isInvalidValue(val)) {
2527
+ values.push(val);
2528
+ }
2529
+ });
2294
2530
  }
2531
+ });
2532
+ if (isNumberArray(values) && !isYearArray(values)) {
2295
2533
  return 'linear';
2296
2534
  }
2297
2535
  if (isDateArray(values)) {
2298
2536
  return 'date';
2299
2537
  }
2300
- if (isStringArray(values)) {
2301
- return 'category';
2302
- }
2538
+ return 'category';
2539
+ };
2540
+ const getAxisValueResolver = (axType, dateParser)=>{
2541
+ const toDate = (value)=>{
2542
+ const date = dateParser ? dateParser(value) : new Date(value);
2543
+ return isNaN(date.getTime()) ? null : date;
2544
+ };
2545
+ return (value)=>{
2546
+ if (isInvalidValue(value)) {
2547
+ return null;
2548
+ }
2549
+ switch(axType){
2550
+ case 'linear':
2551
+ case 'log':
2552
+ return isNumber(value) ? +value : null;
2553
+ case 'date':
2554
+ if (isNumber(value)) {
2555
+ return toDate(+value);
2556
+ }
2557
+ if (typeof value === 'string') {
2558
+ return toDate(value);
2559
+ }
2560
+ return null;
2561
+ case 'category':
2562
+ return `${value}`;
2563
+ default:
2564
+ return null;
2565
+ }
2566
+ };
2303
2567
  };
2304
2568
  /**
2305
2569
  * This is experimental. Use it only with valid datetime strings to verify if they conform to the ISO 8601 format.