@fluentui/react-charts 9.3.7 → 9.3.8

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 (143) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/dist/index.d.ts +55 -7
  3. package/lib/components/AreaChart/AreaChart.js +1 -28
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
  6. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  7. package/lib/components/ChartTable/ChartTable.js +6 -1
  8. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  9. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
  10. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  11. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
  12. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  13. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
  14. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  15. package/lib/components/CommonComponents/CartesianChart.js +50 -32
  16. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  17. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  18. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +5 -5
  19. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  20. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -3
  21. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  22. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +261 -187
  23. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  24. package/lib/components/DonutChart/DonutChart.js +6 -3
  25. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  26. package/lib/components/FunnelChart/FunnelChart.js +6 -3
  27. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  28. package/lib/components/GanttChart/GanttChart.js +1 -1
  29. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  30. package/lib/components/GaugeChart/GaugeChart.js +6 -3
  31. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  32. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +17 -17
  33. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  34. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
  35. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  36. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -4
  37. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  38. package/lib/components/Legends/Legends.js +3 -4
  39. package/lib/components/Legends/Legends.js.map +1 -1
  40. package/lib/components/LineChart/LineChart.js +66 -64
  41. package/lib/components/LineChart/LineChart.js.map +1 -1
  42. package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
  43. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  44. package/lib/components/SankeyChart/SankeyChart.js +1 -1
  45. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  46. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +1 -2
  47. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  48. package/lib/components/ScatterChart/ScatterChart.js +18 -26
  49. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  50. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  51. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
  52. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  53. package/lib/components/VerticalBarChart/VerticalBarChart.js +13 -78
  54. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  55. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
  56. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  57. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +21 -32
  58. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  59. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
  60. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  61. package/lib/types/ChartAnnotation.js.map +1 -1
  62. package/lib/types/DataPoint.js.map +1 -1
  63. package/lib/utilities/Common.styles.js +0 -1
  64. package/lib/utilities/Common.styles.js.map +1 -1
  65. package/lib/utilities/Common.styles.raw.js +0 -1
  66. package/lib/utilities/Common.styles.raw.js.map +1 -1
  67. package/lib/utilities/image-export-utils.js +4 -4
  68. package/lib/utilities/image-export-utils.js.map +1 -1
  69. package/lib/utilities/utilities.js +220 -78
  70. package/lib/utilities/utilities.js.map +1 -1
  71. package/lib-commonjs/components/AreaChart/AreaChart.js +0 -26
  72. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  73. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
  74. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  75. package/lib-commonjs/components/ChartTable/ChartTable.js +6 -1
  76. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  77. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
  78. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  79. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
  80. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  81. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
  82. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  83. package/lib-commonjs/components/CommonComponents/CartesianChart.js +49 -31
  84. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  85. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  86. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +3 -4
  87. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  88. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +3 -2
  89. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  90. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +261 -186
  91. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  92. package/lib-commonjs/components/DonutChart/DonutChart.js +5 -2
  93. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  94. package/lib-commonjs/components/FunnelChart/FunnelChart.js +5 -2
  95. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  96. package/lib-commonjs/components/GanttChart/GanttChart.js +1 -1
  97. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  98. package/lib-commonjs/components/GaugeChart/GaugeChart.js +5 -2
  99. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  100. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +15 -15
  101. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  102. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
  103. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  104. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -4
  105. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  106. package/lib-commonjs/components/Legends/Legends.js +3 -4
  107. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  108. package/lib-commonjs/components/LineChart/LineChart.js +65 -63
  109. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  110. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
  111. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  112. package/lib-commonjs/components/SankeyChart/SankeyChart.js +1 -1
  113. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  114. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +0 -2
  115. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  116. package/lib-commonjs/components/ScatterChart/ScatterChart.js +17 -25
  117. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  118. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  119. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
  120. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  121. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +12 -77
  122. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  123. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
  124. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  125. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +20 -31
  126. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  127. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
  128. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  129. package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
  130. package/lib-commonjs/types/DataPoint.js.map +1 -1
  131. package/lib-commonjs/utilities/Common.styles.js +0 -1
  132. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  133. package/lib-commonjs/utilities/Common.styles.raw.js +0 -1
  134. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  135. package/lib-commonjs/utilities/image-export-utils.js +3 -3
  136. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  137. package/lib-commonjs/utilities/utilities.js +232 -81
  138. package/lib-commonjs/utilities/utilities.js.map +1 -1
  139. package/package.json +9 -9
  140. package/lib/components/DeclarativeChart/imageExporter.js +0 -223
  141. package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
  142. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
  143. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
@@ -217,6 +217,62 @@ export const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNum
217
217
  }
218
218
  return x;
219
219
  };
220
+ /**
221
+ * Formats text values according to the texttemplate specification
222
+ * Supports D3 format specifiers within %{text:format} patterns
223
+ * @param textValue The raw text value to format
224
+ * @param textTemplate The template string (e.g., "%{text:.1f}%", "%{text:.2%}", "%{text:,.0f}")
225
+ * @param index Optional index for array-based templates
226
+ * @returns Formatted text string
227
+ *
228
+ * Examples:
229
+ * - "%{text:.1f}%" → Formats number with 1 decimal place and adds % suffix
230
+ * - "%{text:.2%}" → Formats as percentage with 2 decimal places
231
+ * - "%{text:,.0f}" → Formats with thousands separator and no decimals
232
+ * - "%{text:$,.2f}" → Formats as currency with thousands separator and 2 decimals
233
+ */ const formatTextWithTemplate = (textValue, textTemplate, index)=>{
234
+ if (!textTemplate) {
235
+ return String(textValue);
236
+ }
237
+ const numVal = typeof textValue === 'number' ? textValue : parseFloat(String(textValue));
238
+ if (isNaN(numVal)) {
239
+ return String(textValue);
240
+ }
241
+ const template = typeof textTemplate === 'string' ? textTemplate : textTemplate[index || 0] || '';
242
+ // Match Plotly's texttemplate pattern: %{text:format} or %{text}
243
+ // Can be followed by any literal text like %, $, etc.
244
+ const plotlyPattern = /%\{text(?::([^}]+))?\}(.*)$/;
245
+ const match = template.match(plotlyPattern);
246
+ if (match) {
247
+ const formatSpec = match[1]; // The format specifier (e.g., ".1f", ".2%", ",.0f") or undefined
248
+ const suffix = match[2]; // Any text after the closing brace (e.g., "%", " units")
249
+ // If no format specifier is provided (e.g., %{text}%), try to infer from suffix
250
+ if (!formatSpec) {
251
+ // Check if suffix starts with % - assume simple percentage with 1 decimal
252
+ if (suffix.startsWith('%')) {
253
+ return `${numVal.toFixed(1)}${suffix}`;
254
+ }
255
+ // No format specifier, just return the number with the suffix
256
+ return `${numVal}${suffix}`;
257
+ }
258
+ try {
259
+ // Use D3 format function to apply the format specifier
260
+ const formatter = d3Format(formatSpec);
261
+ const formattedValue = formatter(numVal);
262
+ return `${formattedValue}${suffix}`;
263
+ } catch (error) {
264
+ // Try to extract precision for basic fallback
265
+ const precisionMatch = formatSpec.match(/\.(\d+)[f%]/);
266
+ const precision = precisionMatch ? parseInt(precisionMatch[1], 10) : 2;
267
+ // Check if it's a percentage format
268
+ if (formatSpec.includes('%')) {
269
+ return `${(numVal * 100).toFixed(precision)}%${suffix}`;
270
+ }
271
+ return `${numVal.toFixed(precision)}${suffix}`;
272
+ }
273
+ }
274
+ return String(textValue);
275
+ };
220
276
  /**
221
277
  * Extracts unique X-axis categories from Plotly data traces
222
278
  * @param data Array of Plotly data traces
@@ -281,62 +337,6 @@ const toFiniteNumber = (value)=>{
281
337
  const numeric = typeof value === 'number' ? value : Number(value);
282
338
  return Number.isFinite(numeric) ? numeric : undefined;
283
339
  };
284
- /**
285
- * Normalizes Plotly axis reference strings so equivalent aliases (e.g. `xaxis1`, `x1`) collapse to the base axis id.
286
- */ const normalizeAxisRef = (ref, axis)=>{
287
- if (!ref) {
288
- return axis;
289
- }
290
- const normalized = ref.toLowerCase();
291
- if (normalized === axis || normalized === `${axis}axis` || normalized === `${axis}axis1` || normalized === `${axis}1`) {
292
- return axis;
293
- }
294
- const match = normalized.match(/^([xy])(axis)?(\d+)$/);
295
- if (match && match[1] === axis && match[3]) {
296
- return match[3] === '1' ? axis : `${axis}${match[3]}`;
297
- }
298
- return normalized;
299
- };
300
- /**
301
- * Scans the data traces bound to a given axis and returns the numeric min/max values plotted on that axis.
302
- */ const getAxisNumericRangeFromData = (axis, ref, layout, data)=>{
303
- if (!data || data.length === 0) {
304
- return undefined;
305
- }
306
- const axisLayout = getAxisLayoutByRef(layout, ref, axis);
307
- const targetRef = normalizeAxisRef(ref, axis);
308
- const traceAxisKey = axis === 'x' ? 'xaxis' : 'yaxis';
309
- let minValue;
310
- let maxValue;
311
- data.forEach((trace)=>{
312
- const plotTrace = trace;
313
- const traceAxisRef = normalizeAxisRef(plotTrace[traceAxisKey], axis);
314
- if (traceAxisRef !== targetRef) {
315
- return;
316
- }
317
- const values = axis === 'x' ? plotTrace.x : plotTrace.y;
318
- if (!isArrayOrTypedArray(values)) {
319
- return;
320
- }
321
- const arrayLike = values;
322
- for(let index = 0; index < arrayLike.length; index++){
323
- const value = arrayLike[index];
324
- const numeric = toNumericValue(convertDataValue(value, axisLayout));
325
- if (numeric === undefined || Number.isNaN(numeric)) {
326
- continue;
327
- }
328
- minValue = minValue === undefined ? numeric : Math.min(minValue, numeric);
329
- maxValue = maxValue === undefined ? numeric : Math.max(maxValue, numeric);
330
- }
331
- });
332
- if (minValue === undefined || maxValue === undefined || minValue === maxValue) {
333
- return undefined;
334
- }
335
- return [
336
- minValue,
337
- maxValue
338
- ];
339
- };
340
340
  /**
341
341
  * Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
342
342
  */ const transformRelativeYForChart = (value)=>{
@@ -437,49 +437,32 @@ const appendPx = (value)=>{
437
437
  if (value === undefined || value === null) {
438
438
  return undefined;
439
439
  }
440
- if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'date' || isDate(value)) {
440
+ const axisType = axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type;
441
+ if (axisType === 'date') {
441
442
  const dateValue = value instanceof Date ? value : new Date(value);
442
443
  return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
443
444
  }
444
- if (typeof value === 'number') {
445
- return value;
446
- }
447
- if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'linear' || (axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'log') {
448
- const numeric = Number(value);
449
- return Number.isFinite(numeric) ? numeric : undefined;
450
- }
451
- if (value instanceof Date) {
452
- return value;
453
- }
454
- return value;
455
- };
456
- const toNumericValue = (value)=>{
457
445
  if (value instanceof Date) {
458
- const timestamp = value.getTime();
459
- return Number.isFinite(timestamp) ? timestamp : undefined;
446
+ return Number.isNaN(value.getTime()) ? undefined : value;
460
447
  }
461
448
  if (typeof value === 'number') {
462
449
  return Number.isFinite(value) ? value : undefined;
463
450
  }
464
- if (typeof value === 'string') {
451
+ if (axisType === 'linear' || axisType === 'log') {
465
452
  const numeric = Number(value);
466
453
  return Number.isFinite(numeric) ? numeric : undefined;
467
454
  }
468
- return undefined;
469
- };
470
- const toRelativeCoordinate = (value, axisLayout, fallbackRange)=>{
471
- const range = Array.isArray(axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.range) ? axisLayout.range : undefined;
472
- let start = range && range.length >= 2 ? toNumericValue(convertDataValue(range[0], axisLayout)) : undefined;
473
- let end = range && range.length >= 2 ? toNumericValue(convertDataValue(range[1], axisLayout)) : undefined;
474
- if ((start === undefined || end === undefined || start === end) && fallbackRange) {
475
- [start, end] = fallbackRange;
476
- }
477
- const current = toNumericValue(convertDataValue(value, axisLayout));
478
- if (start === undefined || end === undefined || current === undefined || start === end) {
479
- return undefined;
455
+ if (typeof value === 'string') {
456
+ const shouldTryParseDate = axisType === undefined || axisType === '-' || axisType === null;
457
+ if (shouldTryParseDate && isDate(value)) {
458
+ const parsedDate = new Date(value);
459
+ if (!Number.isNaN(parsedDate.getTime()) && parsedDate.getFullYear() >= 1900) {
460
+ return parsedDate;
461
+ }
462
+ }
463
+ return value;
480
464
  }
481
- const relative = (current - start) / (end - start);
482
- return Number.isFinite(relative) ? relative : undefined;
465
+ return value;
483
466
  };
484
467
  const createAnnotationId = (text, index)=>{
485
468
  const normalized = text.replace(/\s+/g, ' ').trim();
@@ -544,10 +527,35 @@ const mapArrowDashToPattern = (value)=>{
544
527
  return value;
545
528
  }
546
529
  };
530
+ const mapRefTypeToCoordinateType = (refType)=>{
531
+ return refType === 'axis' ? 'data' : refType;
532
+ };
533
+ const normalizeCoordinateValueForType = (coordinateType, value)=>{
534
+ if (coordinateType === 'data') {
535
+ return value;
536
+ }
537
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
538
+ };
539
+ const getAnnotationCoordinateValue = (axis, refType, annotation, layout)=>{
540
+ if (refType === 'axis') {
541
+ const axisRef = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.xref : annotation === null || annotation === void 0 ? void 0 : annotation.yref;
542
+ const axisLayout = getAxisLayoutByRef(layout, axisRef, axis);
543
+ const rawValue = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y;
544
+ return convertDataValue(rawValue, axisLayout);
545
+ }
546
+ const numericValue = toFiniteNumber(axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y);
547
+ if (numericValue === undefined) {
548
+ return undefined;
549
+ }
550
+ if (refType === 'relative') {
551
+ return axis === 'y' ? transformRelativeYForChart(numericValue) : numericValue;
552
+ }
553
+ return numericValue;
554
+ };
547
555
  /**
548
556
  * Converts a Plotly annotation definition into the internal `ChartAnnotation` format, translating coordinates,
549
557
  * layout alignment, styling, and connector metadata while skipping unsupported configurations.
550
- */ const convertPlotlyAnnotation = (annotation, layout, data, index)=>{
558
+ */ const convertPlotlyAnnotation = (annotation, layout, index)=>{
551
559
  if (!annotation || annotation.visible === false) {
552
560
  return undefined;
553
561
  }
@@ -556,77 +564,51 @@ const mapArrowDashToPattern = (value)=>{
556
564
  if (!xRefType || !yRefType) {
557
565
  return undefined;
558
566
  }
567
+ const xValue = getAnnotationCoordinateValue('x', xRefType, annotation, layout);
568
+ const yValue = getAnnotationCoordinateValue('y', yRefType, annotation, layout);
569
+ if (xValue === undefined || yValue === undefined) {
570
+ return undefined;
571
+ }
572
+ const xCoordinateType = mapRefTypeToCoordinateType(xRefType);
573
+ const yCoordinateType = mapRefTypeToCoordinateType(yRefType);
574
+ const normalizedX = normalizeCoordinateValueForType(xCoordinateType, xValue);
575
+ const normalizedY = normalizeCoordinateValueForType(yCoordinateType, yValue);
576
+ if (normalizedX === undefined || normalizedY === undefined) {
577
+ return undefined;
578
+ }
579
+ const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
580
+ const yAxisProps = yCoordinateType === 'data' && yRefNormalized === 'y2' ? {
581
+ yAxis: 'secondary'
582
+ } : undefined;
559
583
  let coordinates;
560
- if (xRefType === 'axis' && yRefType === 'axis') {
561
- const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
562
- const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
563
- const xValue = convertDataValue(annotation.x, xAxisLayout);
564
- const yValue = convertDataValue(annotation.y, yAxisLayout);
565
- if (xValue === undefined || yValue === undefined) {
566
- return undefined;
567
- }
568
- const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
584
+ if (xCoordinateType === 'data' && yCoordinateType === 'data') {
569
585
  coordinates = {
570
586
  type: 'data',
571
- x: xValue,
572
- y: yValue,
573
- ...yRefNormalized === 'y2' ? {
574
- yAxis: 'secondary'
575
- } : {}
587
+ x: normalizedX,
588
+ y: normalizedY,
589
+ ...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
576
590
  };
577
- } else if (xRefType === 'relative' && yRefType === 'relative') {
578
- const xValue = toFiniteNumber(annotation.x);
579
- const yValue = toFiniteNumber(annotation.y);
580
- const chartRelativeY = transformRelativeYForChart(yValue);
581
- if (xValue === undefined || chartRelativeY === undefined) {
582
- return undefined;
583
- }
591
+ } else if (xCoordinateType === 'relative' && yCoordinateType === 'relative') {
584
592
  coordinates = {
585
593
  type: 'relative',
586
- x: xValue,
587
- y: chartRelativeY
594
+ x: normalizedX,
595
+ y: normalizedY
588
596
  };
589
- } else if (xRefType === 'relative' && yRefType === 'axis') {
590
- const xValue = toFiniteNumber(annotation.x);
591
- const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
592
- const yFallbackRange = getAxisNumericRangeFromData('y', annotation.yref, layout, data);
593
- const yRelative = toRelativeCoordinate(annotation.y, yAxisLayout, yFallbackRange);
594
- const chartRelativeY = transformRelativeYForChart(yRelative);
595
- if (xValue === undefined || chartRelativeY === undefined) {
596
- return undefined;
597
- }
598
- coordinates = {
599
- type: 'relative',
600
- x: xValue,
601
- y: chartRelativeY
602
- };
603
- } else if (xRefType === 'axis' && yRefType === 'relative') {
604
- const yValue = toFiniteNumber(annotation.y);
605
- const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
606
- const xFallbackRange = getAxisNumericRangeFromData('x', annotation.xref, layout, data);
607
- const xRelative = toRelativeCoordinate(annotation.x, xAxisLayout, xFallbackRange);
608
- const chartRelativeY = transformRelativeYForChart(yValue);
609
- if (xRelative === undefined || chartRelativeY === undefined) {
610
- return undefined;
611
- }
612
- coordinates = {
613
- type: 'relative',
614
- x: xRelative,
615
- y: chartRelativeY
616
- };
617
- } else if (xRefType === 'pixel' && yRefType === 'pixel') {
618
- const xValue = toFiniteNumber(annotation.x);
619
- const yValue = toFiniteNumber(annotation.y);
620
- if (xValue === undefined || yValue === undefined) {
621
- return undefined;
622
- }
597
+ } else if (xCoordinateType === 'pixel' && yCoordinateType === 'pixel') {
623
598
  coordinates = {
624
599
  type: 'pixel',
625
- x: xValue,
626
- y: yValue
600
+ x: normalizedX,
601
+ y: normalizedY
627
602
  };
628
603
  } else {
629
- return undefined;
604
+ coordinates = {
605
+ type: 'mixed',
606
+ xCoordinateType,
607
+ yCoordinateType,
608
+ x: normalizedX,
609
+ y: normalizedY,
610
+ ...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
611
+ };
630
612
  }
631
613
  const textValue = annotation.text;
632
614
  const rawText = textValue === undefined || textValue === null ? '' : String(textValue);
@@ -783,14 +765,14 @@ const mapArrowDashToPattern = (value)=>{
783
765
  }
784
766
  return chartAnnotation;
785
767
  };
786
- const getChartAnnotationsFromLayout = (layout, data, isMultiPlot)=>{
768
+ const getChartAnnotationsFromLayout = (layout, isMultiPlot)=>{
787
769
  if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
788
770
  return undefined;
789
771
  }
790
772
  const annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [
791
773
  layout.annotations
792
774
  ];
793
- const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, layout, data, index)).filter((annotation)=>annotation !== undefined);
775
+ const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, layout, index)).filter((annotation)=>annotation !== undefined);
794
776
  return converted.length > 0 ? converted : undefined;
795
777
  };
796
778
  /**
@@ -872,7 +854,7 @@ const getChartAnnotationsFromLayout = (layout, data, isMultiPlot)=>{
872
854
  export const transformPlotlyJsonToAnnotationChartProps = (input, isMultiPlot, _colorMap, _colorwayType, _isDarkTheme)=>{
873
855
  var _layoutWithMeta_meta, _input_layout, _input_layout1, _input_layout2, _input_layout3, _input_layout_font, _input_layout4, _input_layout_font1, _input_layout5, _input_layout6;
874
856
  var _getChartAnnotationsFromLayout;
875
- const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
857
+ const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.layout, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
876
858
  const titles = getTitles(input.layout);
877
859
  const layoutTitle = titles.chartTitle || undefined;
878
860
  const layoutWithMeta = input.layout;
@@ -947,7 +929,8 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
947
929
  const hideLabels = firstData.textinfo ? ![
948
930
  'value',
949
931
  'percent',
950
- 'label+percent'
932
+ 'label+percent',
933
+ 'percent+label'
951
934
  ].includes(firstData.textinfo) : false;
952
935
  const donutMarginHorizontal = hideLabels ? 0 : 80;
953
936
  const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
@@ -980,14 +963,15 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
980
963
  hideLabels,
981
964
  showLabelsInPercent: firstData.textinfo ? [
982
965
  'percent',
983
- 'label+percent'
966
+ 'label+percent',
967
+ 'percent+label'
984
968
  ].includes(firstData.textinfo) : true,
985
969
  roundCorners: true,
986
970
  order: 'sorted'
987
971
  };
988
972
  };
989
973
  export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
990
- var _input_layout, _input_layout1, _input_layout2, _vsbcData_;
974
+ var _input_layout, _input_layout1, _input_layout2;
991
975
  const mapXToDataPoints = {};
992
976
  let yMaxValue = 0;
993
977
  let yMinValue = 0;
@@ -1007,6 +991,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1007
991
  validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
1008
992
  const rangeXValues = series.x.slice(rangeStart, rangeEnd);
1009
993
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
994
+ const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : typeof series.text === 'string' ? series.text : undefined;
1010
995
  rangeXValues.forEach((x, index2)=>{
1011
996
  var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
1012
997
  if (!mapXToDataPoints[x]) {
@@ -1022,6 +1007,11 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1022
1007
  const opacity = getOpacity(series, index2);
1023
1008
  const yVal = rangeYValues[index2];
1024
1009
  const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
1010
+ let barLabel = Array.isArray(textValues) ? textValues[index2] : textValues;
1011
+ // Apply texttemplate formatting if specified
1012
+ if (barLabel && series.texttemplate) {
1013
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index2);
1014
+ }
1025
1015
  if (series.type === 'bar') {
1026
1016
  var _rgb_copy_formatHex8;
1027
1017
  mapXToDataPoints[x].chartData.push({
@@ -1030,7 +1020,10 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1030
1020
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
1031
1021
  opacity
1032
1022
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1033
- yAxisCalloutData
1023
+ yAxisCalloutData,
1024
+ ...barLabel ? {
1025
+ barLabel: String(barLabel)
1026
+ } : {}
1034
1027
  });
1035
1028
  if (typeof yVal === 'number') {
1036
1029
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -1128,7 +1121,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1128
1121
  }
1129
1122
  });
1130
1123
  const vsbcData = Object.values(mapXToDataPoints);
1131
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1124
+ const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1132
1125
  var _input_layout_height;
1133
1126
  return {
1134
1127
  data: vsbcData,
@@ -1139,7 +1132,6 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1139
1132
  yMinValue,
1140
1133
  mode: 'plotly',
1141
1134
  ...secondaryYAxisValues,
1142
- wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
1143
1135
  hideTickOverlap: true,
1144
1136
  barGapMax: 2,
1145
1137
  hideLegend,
@@ -1217,6 +1209,12 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1217
1209
  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);
1218
1210
  const opacity = getOpacity(series, xIndex);
1219
1211
  const yVal = series.y[xIndex];
1212
+ // Extract text value for barLabel
1213
+ let barLabel = Array.isArray(series.text) ? series.text[xIndex] : series.text;
1214
+ // Apply texttemplate formatting if specified
1215
+ if (barLabel && series.texttemplate) {
1216
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, xIndex);
1217
+ }
1220
1218
  var _rgb_copy_formatHex8;
1221
1219
  return {
1222
1220
  x: x.toString(),
@@ -1224,7 +1222,10 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1224
1222
  yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
1225
1223
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
1226
1224
  opacity
1227
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
1225
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1226
+ ...barLabel ? {
1227
+ barLabel: String(barLabel)
1228
+ } : {}
1228
1229
  };
1229
1230
  }).filter((item)=>typeof item !== 'undefined'),
1230
1231
  useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
@@ -1265,7 +1266,7 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1265
1266
  });
1266
1267
  }
1267
1268
  });
1268
- const annotations = getChartAnnotationsFromLayout(processedInput.layout, processedInput.data, isMultiPlot);
1269
+ const annotations = getChartAnnotationsFromLayout(processedInput.layout, isMultiPlot);
1269
1270
  var _processedInput_layout_height;
1270
1271
  return {
1271
1272
  dataV2: gvbcDataV2,
@@ -1275,7 +1276,6 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1275
1276
  mode: 'plotly',
1276
1277
  ...secondaryYAxisValues,
1277
1278
  hideTickOverlap: true,
1278
- wrapXAxisLables: true,
1279
1279
  hideLegend,
1280
1280
  roundCorners: true,
1281
1281
  showYAxisLables: true,
@@ -1294,7 +1294,7 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1294
1294
  };
1295
1295
  };
1296
1296
  export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1297
- var _input_layout, _input_layout1, _vbcData_;
1297
+ var _input_layout, _input_layout1;
1298
1298
  const vbcData = [];
1299
1299
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1300
1300
  let colorScale = undefined;
@@ -1341,6 +1341,11 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
1341
1341
  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);
1342
1342
  const opacity = getOpacity(series, index);
1343
1343
  const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
1344
+ // Handle text values and texttemplate formatting for histogram bins
1345
+ let barLabel = Array.isArray(series.text) ? series.text[index] : series.text;
1346
+ if (barLabel && series.texttemplate) {
1347
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index);
1348
+ }
1344
1349
  var _rgb_copy_formatHex8;
1345
1350
  vbcData.push({
1346
1351
  x: isXString ? bin.join(', ') : getBinCenter(bin),
@@ -1351,11 +1356,14 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
1351
1356
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1352
1357
  ...isXString ? {} : {
1353
1358
  xAxisCalloutData: `[${bin.x0} - ${bin.x1})`
1354
- }
1359
+ },
1360
+ ...barLabel ? {
1361
+ barLabel: String(barLabel)
1362
+ } : {}
1355
1363
  });
1356
1364
  });
1357
1365
  });
1358
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1366
+ const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1359
1367
  var _input_layout_height;
1360
1368
  return {
1361
1369
  data: vbcData,
@@ -1363,7 +1371,6 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
1363
1371
  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,
1364
1372
  mode: 'histogram',
1365
1373
  hideTickOverlap: true,
1366
- wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
1367
1374
  maxBarWidth: 50,
1368
1375
  hideLegend,
1369
1376
  roundCorners: true,
@@ -1426,9 +1433,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1426
1433
  let mode = 'tonexty';
1427
1434
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1428
1435
  const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
1429
- const xAxisType = getAxisType(input.data, getAxisObjects(input.data, input.layout).x);
1430
- const resolveXValue = getAxisValueResolver(xAxisType);
1431
- const shouldWrapLabels = xAxisType === 'category';
1436
+ const resolveXValue = getAxisValueResolver(getAxisType(input.data, getAxisObjects(input.data, input.layout).x));
1432
1437
  const chartData = input.data.map((series, index)=>{
1433
1438
  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;
1434
1439
  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;
@@ -1577,7 +1582,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1577
1582
  ...lineShape
1578
1583
  ]
1579
1584
  };
1580
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1585
+ const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1581
1586
  var _input_layout_height;
1582
1587
  const commonProps = {
1583
1588
  supportNegativeData: true,
@@ -1587,7 +1592,6 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1587
1592
  hideTickOverlap: true,
1588
1593
  hideLegend,
1589
1594
  useUTC: false,
1590
- wrapXAxisLabels: shouldWrapLabels,
1591
1595
  optimizeLargeData: numDataPoints > 1000,
1592
1596
  showYAxisLables: true,
1593
1597
  roundedTicks: true,
@@ -1706,14 +1710,14 @@ export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMa
1706
1710
  // extract colors for each series only once
1707
1711
  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);
1708
1712
  series.y.forEach((yVal, i)=>{
1709
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_base, _series_x;
1713
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
1710
1714
  if (isInvalidValue(yVal)) {
1711
1715
  return;
1712
1716
  }
1713
1717
  // resolve color for each legend's bars from the colorscale or extracted colors
1714
1718
  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);
1715
1719
  const opacity = getOpacity(series, i);
1716
- const base = +resolveGanttXValue((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
1720
+ const base = +resolveGanttXValue(isArrayOrTypedArray(series.base) ? series.base[i] : series.base);
1717
1721
  const xVal = +resolveGanttXValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
1718
1722
  var _rgb_copy_formatHex8;
1719
1723
  ganttData.push({
@@ -1768,11 +1772,53 @@ export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMa
1768
1772
  };
1769
1773
  };
1770
1774
  export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1771
- var _input_layout, _input_layout_coloraxis, _input_layout1, _input_layout_template_layout, _input_layout_template, _input_layout2, _input_layout_template_data_histogram2d_, _input_layout_template_data_histogram2d, _input_layout_template_data, _input_layout_template1, _input_layout3, _input_layout_template_data_heatmap_, _input_layout_template_data_heatmap, _input_layout_template_data1, _input_layout_template2, _input_layout4, _input_layout5, _input_layout6;
1775
+ var _input_layout, _input_layout1, _input_layout_coloraxis, _input_layout2, _input_layout_template_layout, _input_layout_template, _input_layout3, _input_layout_template_data_histogram2d_, _input_layout_template_data_histogram2d, _input_layout_template_data, _input_layout_template1, _input_layout4, _input_layout_template_data_heatmap_, _input_layout_template_data_heatmap, _input_layout_template_data1, _input_layout_template2, _input_layout5, _input_layout6, _input_layout7;
1772
1776
  const firstData = input.data[0];
1773
1777
  const heatmapDataPoints = [];
1774
1778
  let zMin = Number.POSITIVE_INFINITY;
1775
1779
  let zMax = Number.NEGATIVE_INFINITY;
1780
+ // Build a 2D array of annotations based on their grid position
1781
+ const annotationGrid = [];
1782
+ const rawAnnotations = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.annotations;
1783
+ if (rawAnnotations) {
1784
+ const annotationsArray = Array.isArray(rawAnnotations) ? rawAnnotations : [
1785
+ rawAnnotations
1786
+ ];
1787
+ // Collect all unique x and y values from valid annotations
1788
+ const xSet = new Set();
1789
+ const ySet = new Set();
1790
+ const validAnnotations = [];
1791
+ annotationsArray.forEach((a)=>{
1792
+ if (a && typeof a.x === 'number' && typeof a.y === 'number' && typeof a.text === 'string' && (a.xref === 'x' || a.xref === undefined) && (a.yref === 'y' || a.yref === undefined)) {
1793
+ xSet.add(a.x);
1794
+ ySet.add(a.y);
1795
+ validAnnotations.push({
1796
+ x: a.x,
1797
+ y: a.y,
1798
+ text: cleanText(a.text)
1799
+ });
1800
+ }
1801
+ });
1802
+ if (validAnnotations.length > 0) {
1803
+ // Get sorted unique x and y values
1804
+ const xValues = Array.from(xSet).sort((a, b)=>a - b);
1805
+ const yValues = Array.from(ySet).sort((a, b)=>a - b);
1806
+ // Initialize 2D grid and populate
1807
+ validAnnotations.forEach((annotation)=>{
1808
+ const xIdx = xValues.indexOf(annotation.x);
1809
+ const yIdx = yValues.indexOf(annotation.y);
1810
+ if (!annotationGrid[yIdx]) {
1811
+ annotationGrid[yIdx] = [];
1812
+ }
1813
+ annotationGrid[yIdx][xIdx] = annotation.text;
1814
+ });
1815
+ }
1816
+ }
1817
+ // Helper function to get annotation from 2D grid by index
1818
+ const getAnnotationByIndex = (xIdx, yIdx)=>{
1819
+ var _annotationGrid_yIdx;
1820
+ return (_annotationGrid_yIdx = annotationGrid[yIdx]) === null || _annotationGrid_yIdx === void 0 ? void 0 : _annotationGrid_yIdx[xIdx];
1821
+ };
1776
1822
  if (firstData.type === 'histogram2d') {
1777
1823
  var _firstData_x, _firstData_xbins, _firstData_xbins1, _firstData_xbins2, _firstData_ybins, _firstData_ybins1, _firstData_ybins2;
1778
1824
  const xValues = [];
@@ -1812,11 +1858,12 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1812
1858
  xBins.forEach((xBin, xIdx)=>{
1813
1859
  yBins.forEach((yBin, yIdx)=>{
1814
1860
  const zVal = calculateHistNorm(firstData.histnorm, z[yIdx][xIdx], total, isXString ? xBin.length : getBinSize(xBin), isYString ? yBin.length : getBinSize(yBin));
1861
+ const annotationText = getAnnotationByIndex(xIdx, yIdx);
1815
1862
  heatmapDataPoints.push({
1816
1863
  x: isXString ? xBin.join(', ') : getBinCenter(xBin),
1817
1864
  y: isYString ? yBin.join(', ') : getBinCenter(yBin),
1818
1865
  value: zVal,
1819
- rectText: zVal
1866
+ rectText: annotationText || zVal
1820
1867
  });
1821
1868
  if (typeof zVal === 'number') {
1822
1869
  zMin = Math.min(zMin, zVal);
@@ -1825,18 +1872,34 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1825
1872
  });
1826
1873
  });
1827
1874
  } else {
1828
- var _firstData_x1;
1829
- (_firstData_x1 = firstData.x) === null || _firstData_x1 === void 0 ? void 0 : _firstData_x1.forEach((xVal, xIdx)=>{
1830
- var // eslint-disable-next-line @typescript-eslint/no-explicit-any
1831
- _firstData_y;
1832
- (_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y.forEach((yVal, yIdx)=>{
1833
- var _firstData_z_yIdx, _firstData_z, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
1834
- const zVal = (_firstData_z = firstData.z) === null || _firstData_z === void 0 ? void 0 : (_firstData_z_yIdx = _firstData_z[yIdx]) === null || _firstData_z_yIdx === void 0 ? void 0 : _firstData_z_yIdx[xIdx];
1875
+ var _zArray_;
1876
+ // If x and y are not provided, generate indices based on z dimensions
1877
+ const zArray = firstData.z;
1878
+ const xValues = firstData.x;
1879
+ const yValues = firstData.y;
1880
+ var _zArray_length;
1881
+ // Determine the dimensions from z array
1882
+ const yLength = (_zArray_length = zArray === null || zArray === void 0 ? void 0 : zArray.length) !== null && _zArray_length !== void 0 ? _zArray_length : 0;
1883
+ var _zArray__length;
1884
+ const xLength = (_zArray__length = zArray === null || zArray === void 0 ? void 0 : (_zArray_ = zArray[0]) === null || _zArray_ === void 0 ? void 0 : _zArray_.length) !== null && _zArray__length !== void 0 ? _zArray__length : 0;
1885
+ // Use provided x/y values or generate indices
1886
+ const xData = xValues !== null && xValues !== void 0 ? xValues : Array.from({
1887
+ length: xLength
1888
+ }, (_, i)=>i);
1889
+ const yData = yValues !== null && yValues !== void 0 ? yValues : Array.from({
1890
+ length: yLength
1891
+ }, (_, i)=>yLength - 1 - i);
1892
+ xData.forEach((xVal, xIdx)=>{
1893
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1894
+ yData.forEach((yVal, yIdx)=>{
1895
+ var _zArray_yIdx, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
1896
+ const zVal = zArray === null || zArray === void 0 ? void 0 : (_zArray_yIdx = zArray[yIdx]) === null || _zArray_yIdx === void 0 ? void 0 : _zArray_yIdx[xIdx];
1897
+ const annotationText = getAnnotationByIndex(xIdx, yIdx);
1835
1898
  heatmapDataPoints.push({
1836
1899
  x: ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_xaxis = _input_layout.xaxis) === null || _input_layout_xaxis === void 0 ? void 0 : _input_layout_xaxis.type) === 'date' ? xVal : xVal !== null && xVal !== void 0 ? xVal : 0,
1837
1900
  y: ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_yaxis = _input_layout1.yaxis) === null || _input_layout_yaxis === void 0 ? void 0 : _input_layout_yaxis.type) === 'date' ? yVal : yVal,
1838
1901
  value: zVal,
1839
- rectText: zVal
1902
+ rectText: annotationText || zVal
1840
1903
  });
1841
1904
  if (typeof zVal === 'number') {
1842
1905
  zMin = Math.min(zMin, zVal);
@@ -1863,7 +1926,7 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1863
1926
  getColorFromToken(DataVizPalette.color3)
1864
1927
  ];
1865
1928
  var _firstData_colorscale, _ref, _ref1, _ref2, _ref3;
1866
- let colorscale = (_ref3 = (_ref2 = (_ref1 = (_ref = (_firstData_colorscale = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _firstData_colorscale !== void 0 ? _firstData_colorscale : (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.colorscale) !== null && _ref !== void 0 ? _ref : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout1.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : _input_layout_coloraxis.colorscale) !== null && _ref1 !== void 0 ? _ref1 : (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template = _input_layout2.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.colorscale) !== null && _ref2 !== void 0 ? _ref2 : firstData.type === 'histogram2d' && ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_template1 = _input_layout3.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template1.data) === null || _input_layout_template_data === void 0 ? void 0 : (_input_layout_template_data_histogram2d = _input_layout_template_data.histogram2d) === null || _input_layout_template_data_histogram2d === void 0 ? void 0 : (_input_layout_template_data_histogram2d_ = _input_layout_template_data_histogram2d[0]) === null || _input_layout_template_data_histogram2d_ === void 0 ? void 0 : _input_layout_template_data_histogram2d_.colorscale)) !== null && _ref3 !== void 0 ? _ref3 : (_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_data1 = _input_layout_template2.data) === null || _input_layout_template_data1 === void 0 ? void 0 : (_input_layout_template_data_heatmap = _input_layout_template_data1.heatmap) === null || _input_layout_template_data_heatmap === void 0 ? void 0 : (_input_layout_template_data_heatmap_ = _input_layout_template_data_heatmap[0]) === null || _input_layout_template_data_heatmap_ === void 0 ? void 0 : _input_layout_template_data_heatmap_.colorscale;
1929
+ let colorscale = (_ref3 = (_ref2 = (_ref1 = (_ref = (_firstData_colorscale = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _firstData_colorscale !== void 0 ? _firstData_colorscale : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.colorscale) !== null && _ref !== void 0 ? _ref : (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout2.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : _input_layout_coloraxis.colorscale) !== null && _ref1 !== void 0 ? _ref1 : (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_template = _input_layout3.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.colorscale) !== null && _ref2 !== void 0 ? _ref2 : firstData.type === 'histogram2d' && ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_template1 = _input_layout4.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template1.data) === null || _input_layout_template_data === void 0 ? void 0 : (_input_layout_template_data_histogram2d = _input_layout_template_data.histogram2d) === null || _input_layout_template_data_histogram2d === void 0 ? void 0 : (_input_layout_template_data_histogram2d_ = _input_layout_template_data_histogram2d[0]) === null || _input_layout_template_data_histogram2d_ === void 0 ? void 0 : _input_layout_template_data_histogram2d_.colorscale)) !== null && _ref3 !== void 0 ? _ref3 : (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template2 = _input_layout5.template) === null || _input_layout_template2 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template2.data) === null || _input_layout_template_data1 === void 0 ? void 0 : (_input_layout_template_data_heatmap = _input_layout_template_data1.heatmap) === null || _input_layout_template_data_heatmap === void 0 ? void 0 : (_input_layout_template_data_heatmap_ = _input_layout_template_data_heatmap[0]) === null || _input_layout_template_data_heatmap_ === void 0 ? void 0 : _input_layout_template_data_heatmap_.colorscale;
1867
1930
  // determine if the types diverging, sequential or sequentialminus are present in colorscale
1868
1931
  if (colorscale && typeof colorscale === 'object' && ('diverging' in colorscale || 'sequential' in colorscale || 'sequentialminus' in colorscale)) {
1869
1932
  const isDivergent = zMin < 0 && zMax > 0; // Data spans both positive and negative values
@@ -1889,12 +1952,11 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1889
1952
  hideLegend: true,
1890
1953
  showYAxisLables: true,
1891
1954
  sortOrder: 'none',
1892
- width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
1893
- height: (_input_layout_height = (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
1955
+ width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
1956
+ height: (_input_layout_height = (_input_layout7 = input.layout) === null || _input_layout7 === void 0 ? void 0 : _input_layout7.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
1894
1957
  hideTickOverlap: true,
1895
1958
  noOfCharsToTruncate: 20,
1896
1959
  showYAxisLablesTooltip: true,
1897
- wrapXAxisLables: true,
1898
1960
  ...getTitles(input.layout),
1899
1961
  ...getAxisCategoryOrderProps([
1900
1962
  firstData
@@ -2744,7 +2806,10 @@ export const isNonPlotType = (chartType)=>{
2744
2806
  'donut',
2745
2807
  'sankey',
2746
2808
  'pie',
2747
- 'annotation'
2809
+ 'annotation',
2810
+ 'table',
2811
+ 'gauge',
2812
+ 'funnel'
2748
2813
  ].includes(chartType);
2749
2814
  };
2750
2815
  export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
@@ -2930,7 +2995,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2930
2995
  }
2931
2996
  const isValidArray = isArrayOrTypedArray(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
2932
2997
  if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
2933
- result[propName] = ax.categoryarray;
2998
+ result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? ax.categoryarray.slice().reverse() : ax.categoryarray;
2934
2999
  return;
2935
3000
  }
2936
3001
  if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
@@ -3007,16 +3072,23 @@ const getAxisScaleTypeProps = (data, layout)=>{
3007
3072
  return;
3008
3073
  }
3009
3074
  const axType = getAxisType(data, ax);
3075
+ if (axId === 'x' && axType === 'category') {
3076
+ props.xAxis = {
3077
+ tickLayout: 'auto'
3078
+ };
3079
+ }
3010
3080
  if ((!ax.tickmode || ax.tickmode === 'array') && isArrayOrTypedArray(ax.tickvals)) {
3011
3081
  const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
3012
3082
  if (axId === 'x') {
3013
3083
  props.tickValues = tickValues;
3014
3084
  props.xAxis = {
3085
+ ...props.xAxis,
3015
3086
  tickText: ax.ticktext
3016
3087
  };
3017
3088
  } else if (axId === 'y') {
3018
3089
  props.yAxisTickValues = tickValues;
3019
3090
  props.yAxis = {
3091
+ ...props.yAxis,
3020
3092
  tickText: ax.ticktext
3021
3093
  };
3022
3094
  }
@@ -3027,11 +3099,13 @@ const getAxisScaleTypeProps = (data, layout)=>{
3027
3099
  const tick0 = plotlyTick0(ax.tick0, axType, dtick);
3028
3100
  if (axId === 'x') {
3029
3101
  props.xAxis = {
3102
+ ...props.xAxis,
3030
3103
  tickStep: dtick,
3031
3104
  tick0
3032
3105
  };
3033
3106
  } else if (axId === 'y') {
3034
3107
  props.yAxis = {
3108
+ ...props.yAxis,
3035
3109
  tickStep: dtick,
3036
3110
  tick0
3037
3111
  };