@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
@@ -313,6 +313,62 @@ const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
313
313
  }
314
314
  return x;
315
315
  };
316
+ /**
317
+ * Formats text values according to the texttemplate specification
318
+ * Supports D3 format specifiers within %{text:format} patterns
319
+ * @param textValue The raw text value to format
320
+ * @param textTemplate The template string (e.g., "%{text:.1f}%", "%{text:.2%}", "%{text:,.0f}")
321
+ * @param index Optional index for array-based templates
322
+ * @returns Formatted text string
323
+ *
324
+ * Examples:
325
+ * - "%{text:.1f}%" → Formats number with 1 decimal place and adds % suffix
326
+ * - "%{text:.2%}" → Formats as percentage with 2 decimal places
327
+ * - "%{text:,.0f}" → Formats with thousands separator and no decimals
328
+ * - "%{text:$,.2f}" → Formats as currency with thousands separator and 2 decimals
329
+ */ const formatTextWithTemplate = (textValue, textTemplate, index)=>{
330
+ if (!textTemplate) {
331
+ return String(textValue);
332
+ }
333
+ const numVal = typeof textValue === 'number' ? textValue : parseFloat(String(textValue));
334
+ if (isNaN(numVal)) {
335
+ return String(textValue);
336
+ }
337
+ const template = typeof textTemplate === 'string' ? textTemplate : textTemplate[index || 0] || '';
338
+ // Match Plotly's texttemplate pattern: %{text:format} or %{text}
339
+ // Can be followed by any literal text like %, $, etc.
340
+ const plotlyPattern = /%\{text(?::([^}]+))?\}(.*)$/;
341
+ const match = template.match(plotlyPattern);
342
+ if (match) {
343
+ const formatSpec = match[1]; // The format specifier (e.g., ".1f", ".2%", ",.0f") or undefined
344
+ const suffix = match[2]; // Any text after the closing brace (e.g., "%", " units")
345
+ // If no format specifier is provided (e.g., %{text}%), try to infer from suffix
346
+ if (!formatSpec) {
347
+ // Check if suffix starts with % - assume simple percentage with 1 decimal
348
+ if (suffix.startsWith('%')) {
349
+ return `${numVal.toFixed(1)}${suffix}`;
350
+ }
351
+ // No format specifier, just return the number with the suffix
352
+ return `${numVal}${suffix}`;
353
+ }
354
+ try {
355
+ // Use D3 format function to apply the format specifier
356
+ const formatter = (0, _d3format.format)(formatSpec);
357
+ const formattedValue = formatter(numVal);
358
+ return `${formattedValue}${suffix}`;
359
+ } catch (error) {
360
+ // Try to extract precision for basic fallback
361
+ const precisionMatch = formatSpec.match(/\.(\d+)[f%]/);
362
+ const precision = precisionMatch ? parseInt(precisionMatch[1], 10) : 2;
363
+ // Check if it's a percentage format
364
+ if (formatSpec.includes('%')) {
365
+ return `${(numVal * 100).toFixed(precision)}%${suffix}`;
366
+ }
367
+ return `${numVal.toFixed(precision)}${suffix}`;
368
+ }
369
+ }
370
+ return String(textValue);
371
+ };
316
372
  /**
317
373
  * Extracts unique X-axis categories from Plotly data traces
318
374
  * @param data Array of Plotly data traces
@@ -377,62 +433,6 @@ const toFiniteNumber = (value)=>{
377
433
  const numeric = typeof value === 'number' ? value : Number(value);
378
434
  return Number.isFinite(numeric) ? numeric : undefined;
379
435
  };
380
- /**
381
- * Normalizes Plotly axis reference strings so equivalent aliases (e.g. `xaxis1`, `x1`) collapse to the base axis id.
382
- */ const normalizeAxisRef = (ref, axis)=>{
383
- if (!ref) {
384
- return axis;
385
- }
386
- const normalized = ref.toLowerCase();
387
- if (normalized === axis || normalized === `${axis}axis` || normalized === `${axis}axis1` || normalized === `${axis}1`) {
388
- return axis;
389
- }
390
- const match = normalized.match(/^([xy])(axis)?(\d+)$/);
391
- if (match && match[1] === axis && match[3]) {
392
- return match[3] === '1' ? axis : `${axis}${match[3]}`;
393
- }
394
- return normalized;
395
- };
396
- /**
397
- * Scans the data traces bound to a given axis and returns the numeric min/max values plotted on that axis.
398
- */ const getAxisNumericRangeFromData = (axis, ref, layout, data)=>{
399
- if (!data || data.length === 0) {
400
- return undefined;
401
- }
402
- const axisLayout = getAxisLayoutByRef(layout, ref, axis);
403
- const targetRef = normalizeAxisRef(ref, axis);
404
- const traceAxisKey = axis === 'x' ? 'xaxis' : 'yaxis';
405
- let minValue;
406
- let maxValue;
407
- data.forEach((trace)=>{
408
- const plotTrace = trace;
409
- const traceAxisRef = normalizeAxisRef(plotTrace[traceAxisKey], axis);
410
- if (traceAxisRef !== targetRef) {
411
- return;
412
- }
413
- const values = axis === 'x' ? plotTrace.x : plotTrace.y;
414
- if (!(0, _chartutilities.isArrayOrTypedArray)(values)) {
415
- return;
416
- }
417
- const arrayLike = values;
418
- for(let index = 0; index < arrayLike.length; index++){
419
- const value = arrayLike[index];
420
- const numeric = toNumericValue(convertDataValue(value, axisLayout));
421
- if (numeric === undefined || Number.isNaN(numeric)) {
422
- continue;
423
- }
424
- minValue = minValue === undefined ? numeric : Math.min(minValue, numeric);
425
- maxValue = maxValue === undefined ? numeric : Math.max(maxValue, numeric);
426
- }
427
- });
428
- if (minValue === undefined || maxValue === undefined || minValue === maxValue) {
429
- return undefined;
430
- }
431
- return [
432
- minValue,
433
- maxValue
434
- ];
435
- };
436
436
  /**
437
437
  * Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
438
438
  */ const transformRelativeYForChart = (value)=>{
@@ -533,49 +533,32 @@ const appendPx = (value)=>{
533
533
  if (value === undefined || value === null) {
534
534
  return undefined;
535
535
  }
536
- if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'date' || (0, _chartutilities.isDate)(value)) {
536
+ const axisType = axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type;
537
+ if (axisType === 'date') {
537
538
  const dateValue = value instanceof Date ? value : new Date(value);
538
539
  return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
539
540
  }
540
- if (typeof value === 'number') {
541
- return value;
542
- }
543
- if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'linear' || (axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'log') {
544
- const numeric = Number(value);
545
- return Number.isFinite(numeric) ? numeric : undefined;
546
- }
547
541
  if (value instanceof Date) {
548
- return value;
549
- }
550
- return value;
551
- };
552
- const toNumericValue = (value)=>{
553
- if (value instanceof Date) {
554
- const timestamp = value.getTime();
555
- return Number.isFinite(timestamp) ? timestamp : undefined;
542
+ return Number.isNaN(value.getTime()) ? undefined : value;
556
543
  }
557
544
  if (typeof value === 'number') {
558
545
  return Number.isFinite(value) ? value : undefined;
559
546
  }
560
- if (typeof value === 'string') {
547
+ if (axisType === 'linear' || axisType === 'log') {
561
548
  const numeric = Number(value);
562
549
  return Number.isFinite(numeric) ? numeric : undefined;
563
550
  }
564
- return undefined;
565
- };
566
- const toRelativeCoordinate = (value, axisLayout, fallbackRange)=>{
567
- const range = Array.isArray(axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.range) ? axisLayout.range : undefined;
568
- let start = range && range.length >= 2 ? toNumericValue(convertDataValue(range[0], axisLayout)) : undefined;
569
- let end = range && range.length >= 2 ? toNumericValue(convertDataValue(range[1], axisLayout)) : undefined;
570
- if ((start === undefined || end === undefined || start === end) && fallbackRange) {
571
- [start, end] = fallbackRange;
572
- }
573
- const current = toNumericValue(convertDataValue(value, axisLayout));
574
- if (start === undefined || end === undefined || current === undefined || start === end) {
575
- return undefined;
551
+ if (typeof value === 'string') {
552
+ const shouldTryParseDate = axisType === undefined || axisType === '-' || axisType === null;
553
+ if (shouldTryParseDate && (0, _chartutilities.isDate)(value)) {
554
+ const parsedDate = new Date(value);
555
+ if (!Number.isNaN(parsedDate.getTime()) && parsedDate.getFullYear() >= 1900) {
556
+ return parsedDate;
557
+ }
558
+ }
559
+ return value;
576
560
  }
577
- const relative = (current - start) / (end - start);
578
- return Number.isFinite(relative) ? relative : undefined;
561
+ return value;
579
562
  };
580
563
  const createAnnotationId = (text, index)=>{
581
564
  const normalized = text.replace(/\s+/g, ' ').trim();
@@ -640,10 +623,35 @@ const mapArrowDashToPattern = (value)=>{
640
623
  return value;
641
624
  }
642
625
  };
626
+ const mapRefTypeToCoordinateType = (refType)=>{
627
+ return refType === 'axis' ? 'data' : refType;
628
+ };
629
+ const normalizeCoordinateValueForType = (coordinateType, value)=>{
630
+ if (coordinateType === 'data') {
631
+ return value;
632
+ }
633
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
634
+ };
635
+ const getAnnotationCoordinateValue = (axis, refType, annotation, layout)=>{
636
+ if (refType === 'axis') {
637
+ const axisRef = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.xref : annotation === null || annotation === void 0 ? void 0 : annotation.yref;
638
+ const axisLayout = getAxisLayoutByRef(layout, axisRef, axis);
639
+ const rawValue = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y;
640
+ return convertDataValue(rawValue, axisLayout);
641
+ }
642
+ const numericValue = toFiniteNumber(axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y);
643
+ if (numericValue === undefined) {
644
+ return undefined;
645
+ }
646
+ if (refType === 'relative') {
647
+ return axis === 'y' ? transformRelativeYForChart(numericValue) : numericValue;
648
+ }
649
+ return numericValue;
650
+ };
643
651
  /**
644
652
  * Converts a Plotly annotation definition into the internal `ChartAnnotation` format, translating coordinates,
645
653
  * layout alignment, styling, and connector metadata while skipping unsupported configurations.
646
- */ const convertPlotlyAnnotation = (annotation, layout, data, index)=>{
654
+ */ const convertPlotlyAnnotation = (annotation, layout, index)=>{
647
655
  if (!annotation || annotation.visible === false) {
648
656
  return undefined;
649
657
  }
@@ -652,77 +660,51 @@ const mapArrowDashToPattern = (value)=>{
652
660
  if (!xRefType || !yRefType) {
653
661
  return undefined;
654
662
  }
663
+ const xValue = getAnnotationCoordinateValue('x', xRefType, annotation, layout);
664
+ const yValue = getAnnotationCoordinateValue('y', yRefType, annotation, layout);
665
+ if (xValue === undefined || yValue === undefined) {
666
+ return undefined;
667
+ }
668
+ const xCoordinateType = mapRefTypeToCoordinateType(xRefType);
669
+ const yCoordinateType = mapRefTypeToCoordinateType(yRefType);
670
+ const normalizedX = normalizeCoordinateValueForType(xCoordinateType, xValue);
671
+ const normalizedY = normalizeCoordinateValueForType(yCoordinateType, yValue);
672
+ if (normalizedX === undefined || normalizedY === undefined) {
673
+ return undefined;
674
+ }
675
+ const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
676
+ const yAxisProps = yCoordinateType === 'data' && yRefNormalized === 'y2' ? {
677
+ yAxis: 'secondary'
678
+ } : undefined;
655
679
  let coordinates;
656
- if (xRefType === 'axis' && yRefType === 'axis') {
657
- const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
658
- const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
659
- const xValue = convertDataValue(annotation.x, xAxisLayout);
660
- const yValue = convertDataValue(annotation.y, yAxisLayout);
661
- if (xValue === undefined || yValue === undefined) {
662
- return undefined;
663
- }
664
- const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
680
+ if (xCoordinateType === 'data' && yCoordinateType === 'data') {
665
681
  coordinates = {
666
682
  type: 'data',
667
- x: xValue,
668
- y: yValue,
669
- ...yRefNormalized === 'y2' ? {
670
- yAxis: 'secondary'
671
- } : {}
683
+ x: normalizedX,
684
+ y: normalizedY,
685
+ ...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
672
686
  };
673
- } else if (xRefType === 'relative' && yRefType === 'relative') {
674
- const xValue = toFiniteNumber(annotation.x);
675
- const yValue = toFiniteNumber(annotation.y);
676
- const chartRelativeY = transformRelativeYForChart(yValue);
677
- if (xValue === undefined || chartRelativeY === undefined) {
678
- return undefined;
679
- }
687
+ } else if (xCoordinateType === 'relative' && yCoordinateType === 'relative') {
680
688
  coordinates = {
681
689
  type: 'relative',
682
- x: xValue,
683
- y: chartRelativeY
690
+ x: normalizedX,
691
+ y: normalizedY
684
692
  };
685
- } else if (xRefType === 'relative' && yRefType === 'axis') {
686
- const xValue = toFiniteNumber(annotation.x);
687
- const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
688
- const yFallbackRange = getAxisNumericRangeFromData('y', annotation.yref, layout, data);
689
- const yRelative = toRelativeCoordinate(annotation.y, yAxisLayout, yFallbackRange);
690
- const chartRelativeY = transformRelativeYForChart(yRelative);
691
- if (xValue === undefined || chartRelativeY === undefined) {
692
- return undefined;
693
- }
694
- coordinates = {
695
- type: 'relative',
696
- x: xValue,
697
- y: chartRelativeY
698
- };
699
- } else if (xRefType === 'axis' && yRefType === 'relative') {
700
- const yValue = toFiniteNumber(annotation.y);
701
- const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
702
- const xFallbackRange = getAxisNumericRangeFromData('x', annotation.xref, layout, data);
703
- const xRelative = toRelativeCoordinate(annotation.x, xAxisLayout, xFallbackRange);
704
- const chartRelativeY = transformRelativeYForChart(yValue);
705
- if (xRelative === undefined || chartRelativeY === undefined) {
706
- return undefined;
707
- }
708
- coordinates = {
709
- type: 'relative',
710
- x: xRelative,
711
- y: chartRelativeY
712
- };
713
- } else if (xRefType === 'pixel' && yRefType === 'pixel') {
714
- const xValue = toFiniteNumber(annotation.x);
715
- const yValue = toFiniteNumber(annotation.y);
716
- if (xValue === undefined || yValue === undefined) {
717
- return undefined;
718
- }
693
+ } else if (xCoordinateType === 'pixel' && yCoordinateType === 'pixel') {
719
694
  coordinates = {
720
695
  type: 'pixel',
721
- x: xValue,
722
- y: yValue
696
+ x: normalizedX,
697
+ y: normalizedY
723
698
  };
724
699
  } else {
725
- return undefined;
700
+ coordinates = {
701
+ type: 'mixed',
702
+ xCoordinateType,
703
+ yCoordinateType,
704
+ x: normalizedX,
705
+ y: normalizedY,
706
+ ...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
707
+ };
726
708
  }
727
709
  const textValue = annotation.text;
728
710
  const rawText = textValue === undefined || textValue === null ? '' : String(textValue);
@@ -879,14 +861,14 @@ const mapArrowDashToPattern = (value)=>{
879
861
  }
880
862
  return chartAnnotation;
881
863
  };
882
- const getChartAnnotationsFromLayout = (layout, data, isMultiPlot)=>{
864
+ const getChartAnnotationsFromLayout = (layout, isMultiPlot)=>{
883
865
  if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
884
866
  return undefined;
885
867
  }
886
868
  const annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [
887
869
  layout.annotations
888
870
  ];
889
- const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, layout, data, index)).filter((annotation)=>annotation !== undefined);
871
+ const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, layout, index)).filter((annotation)=>annotation !== undefined);
890
872
  return converted.length > 0 ? converted : undefined;
891
873
  };
892
874
  const normalizeObjectArrayForGVBC = (data, xLabels)=>{
@@ -963,7 +945,7 @@ const normalizeObjectArrayForGVBC = (data, xLabels)=>{
963
945
  const transformPlotlyJsonToAnnotationChartProps = (input, isMultiPlot, _colorMap, _colorwayType, _isDarkTheme)=>{
964
946
  var _layoutWithMeta_meta, _input_layout, _input_layout1, _input_layout2, _input_layout3, _input_layout_font, _input_layout4, _input_layout_font1, _input_layout5, _input_layout6;
965
947
  var _getChartAnnotationsFromLayout;
966
- const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
948
+ const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.layout, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
967
949
  const titles = getTitles(input.layout);
968
950
  const layoutTitle = titles.chartTitle || undefined;
969
951
  const layoutWithMeta = input.layout;
@@ -1038,7 +1020,8 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
1038
1020
  const hideLabels = firstData.textinfo ? ![
1039
1021
  'value',
1040
1022
  'percent',
1041
- 'label+percent'
1023
+ 'label+percent',
1024
+ 'percent+label'
1042
1025
  ].includes(firstData.textinfo) : false;
1043
1026
  const donutMarginHorizontal = hideLabels ? 0 : 80;
1044
1027
  const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
@@ -1071,14 +1054,15 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
1071
1054
  hideLabels,
1072
1055
  showLabelsInPercent: firstData.textinfo ? [
1073
1056
  'percent',
1074
- 'label+percent'
1057
+ 'label+percent',
1058
+ 'percent+label'
1075
1059
  ].includes(firstData.textinfo) : true,
1076
1060
  roundCorners: true,
1077
1061
  order: 'sorted'
1078
1062
  };
1079
1063
  };
1080
1064
  const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
1081
- var _input_layout, _input_layout1, _input_layout2, _vsbcData_;
1065
+ var _input_layout, _input_layout1, _input_layout2;
1082
1066
  const mapXToDataPoints = {};
1083
1067
  let yMaxValue = 0;
1084
1068
  let yMinValue = 0;
@@ -1098,6 +1082,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
1098
1082
  validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
1099
1083
  const rangeXValues = series.x.slice(rangeStart, rangeEnd);
1100
1084
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
1085
+ const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : typeof series.text === 'string' ? series.text : undefined;
1101
1086
  rangeXValues.forEach((x, index2)=>{
1102
1087
  var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
1103
1088
  if (!mapXToDataPoints[x]) {
@@ -1113,6 +1098,11 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
1113
1098
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
1114
1099
  const yVal = rangeYValues[index2];
1115
1100
  const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
1101
+ let barLabel = Array.isArray(textValues) ? textValues[index2] : textValues;
1102
+ // Apply texttemplate formatting if specified
1103
+ if (barLabel && series.texttemplate) {
1104
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index2);
1105
+ }
1116
1106
  if (series.type === 'bar') {
1117
1107
  var _rgb_copy_formatHex8;
1118
1108
  mapXToDataPoints[x].chartData.push({
@@ -1121,7 +1111,10 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
1121
1111
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
1122
1112
  opacity
1123
1113
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1124
- yAxisCalloutData
1114
+ yAxisCalloutData,
1115
+ ...barLabel ? {
1116
+ barLabel: String(barLabel)
1117
+ } : {}
1125
1118
  });
1126
1119
  if (typeof yVal === 'number') {
1127
1120
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -1219,7 +1212,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
1219
1212
  }
1220
1213
  });
1221
1214
  const vsbcData = Object.values(mapXToDataPoints);
1222
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1215
+ const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1223
1216
  var _input_layout_height;
1224
1217
  return {
1225
1218
  data: vsbcData,
@@ -1230,7 +1223,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
1230
1223
  yMinValue,
1231
1224
  mode: 'plotly',
1232
1225
  ...secondaryYAxisValues,
1233
- wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
1234
1226
  hideTickOverlap: true,
1235
1227
  barGapMax: 2,
1236
1228
  hideLegend,
@@ -1308,6 +1300,12 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
1308
1300
  const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[xIndex % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, xIndex, legend, colorMap, (_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : (_processedInput_layout_template = _processedInput_layout.template) === null || _processedInput_layout_template === void 0 ? void 0 : (_processedInput_layout_template_layout = _processedInput_layout_template.layout) === null || _processedInput_layout_template_layout === void 0 ? void 0 : _processedInput_layout_template_layout.colorway, isDarkTheme);
1309
1301
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, xIndex);
1310
1302
  const yVal = series.y[xIndex];
1303
+ // Extract text value for barLabel
1304
+ let barLabel = Array.isArray(series.text) ? series.text[xIndex] : series.text;
1305
+ // Apply texttemplate formatting if specified
1306
+ if (barLabel && series.texttemplate) {
1307
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, xIndex);
1308
+ }
1311
1309
  var _rgb_copy_formatHex8;
1312
1310
  return {
1313
1311
  x: x.toString(),
@@ -1315,7 +1313,10 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
1315
1313
  yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
1316
1314
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
1317
1315
  opacity
1318
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
1316
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1317
+ ...barLabel ? {
1318
+ barLabel: String(barLabel)
1319
+ } : {}
1319
1320
  };
1320
1321
  }).filter((item)=>typeof item !== 'undefined'),
1321
1322
  useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
@@ -1356,7 +1357,7 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
1356
1357
  });
1357
1358
  }
1358
1359
  });
1359
- const annotations = getChartAnnotationsFromLayout(processedInput.layout, processedInput.data, isMultiPlot);
1360
+ const annotations = getChartAnnotationsFromLayout(processedInput.layout, isMultiPlot);
1360
1361
  var _processedInput_layout_height;
1361
1362
  return {
1362
1363
  dataV2: gvbcDataV2,
@@ -1366,7 +1367,6 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
1366
1367
  mode: 'plotly',
1367
1368
  ...secondaryYAxisValues,
1368
1369
  hideTickOverlap: true,
1369
- wrapXAxisLables: true,
1370
1370
  hideLegend,
1371
1371
  roundCorners: true,
1372
1372
  showYAxisLables: true,
@@ -1385,7 +1385,7 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
1385
1385
  };
1386
1386
  };
1387
1387
  const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1388
- var _input_layout, _input_layout1, _vbcData_;
1388
+ var _input_layout, _input_layout1;
1389
1389
  const vbcData = [];
1390
1390
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1391
1391
  let colorScale = undefined;
@@ -1432,6 +1432,11 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
1432
1432
  const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
1433
1433
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
1434
1434
  const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
1435
+ // Handle text values and texttemplate formatting for histogram bins
1436
+ let barLabel = Array.isArray(series.text) ? series.text[index] : series.text;
1437
+ if (barLabel && series.texttemplate) {
1438
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index);
1439
+ }
1435
1440
  var _rgb_copy_formatHex8;
1436
1441
  vbcData.push({
1437
1442
  x: isXString ? bin.join(', ') : getBinCenter(bin),
@@ -1442,11 +1447,14 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
1442
1447
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1443
1448
  ...isXString ? {} : {
1444
1449
  xAxisCalloutData: `[${bin.x0} - ${bin.x1})`
1445
- }
1450
+ },
1451
+ ...barLabel ? {
1452
+ barLabel: String(barLabel)
1453
+ } : {}
1446
1454
  });
1447
1455
  });
1448
1456
  });
1449
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1457
+ const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1450
1458
  var _input_layout_height;
1451
1459
  return {
1452
1460
  data: vbcData,
@@ -1454,7 +1462,6 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
1454
1462
  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,
1455
1463
  mode: 'histogram',
1456
1464
  hideTickOverlap: true,
1457
- wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
1458
1465
  maxBarWidth: 50,
1459
1466
  hideLegend,
1460
1467
  roundCorners: true,
@@ -1517,9 +1524,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1517
1524
  let mode = 'tonexty';
1518
1525
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1519
1526
  const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
1520
- const xAxisType = getAxisType(input.data, getAxisObjects(input.data, input.layout).x);
1521
- const resolveXValue = getAxisValueResolver(xAxisType);
1522
- const shouldWrapLabels = xAxisType === 'category';
1527
+ const resolveXValue = getAxisValueResolver(getAxisType(input.data, getAxisObjects(input.data, input.layout).x));
1523
1528
  const chartData = input.data.map((series, index)=>{
1524
1529
  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;
1525
1530
  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;
@@ -1668,7 +1673,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1668
1673
  ...lineShape
1669
1674
  ]
1670
1675
  };
1671
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1676
+ const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1672
1677
  var _input_layout_height;
1673
1678
  const commonProps = {
1674
1679
  supportNegativeData: true,
@@ -1678,7 +1683,6 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1678
1683
  hideTickOverlap: true,
1679
1684
  hideLegend,
1680
1685
  useUTC: false,
1681
- wrapXAxisLabels: shouldWrapLabels,
1682
1686
  optimizeLargeData: numDataPoints > 1000,
1683
1687
  showYAxisLables: true,
1684
1688
  roundedTicks: true,
@@ -1797,14 +1801,14 @@ const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colo
1797
1801
  // extract colors for each series only once
1798
1802
  const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
1799
1803
  series.y.forEach((yVal, i)=>{
1800
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_base, _series_x;
1804
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
1801
1805
  if ((0, _chartutilities.isInvalidValue)(yVal)) {
1802
1806
  return;
1803
1807
  }
1804
1808
  // resolve color for each legend's bars from the colorscale or extracted colors
1805
1809
  const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
1806
1810
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, i);
1807
- const base = +resolveGanttXValue((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
1811
+ const base = +resolveGanttXValue((0, _chartutilities.isArrayOrTypedArray)(series.base) ? series.base[i] : series.base);
1808
1812
  const xVal = +resolveGanttXValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
1809
1813
  var _rgb_copy_formatHex8;
1810
1814
  ganttData.push({
@@ -1859,11 +1863,53 @@ const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colo
1859
1863
  };
1860
1864
  };
1861
1865
  const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1862
- 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;
1866
+ 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;
1863
1867
  const firstData = input.data[0];
1864
1868
  const heatmapDataPoints = [];
1865
1869
  let zMin = Number.POSITIVE_INFINITY;
1866
1870
  let zMax = Number.NEGATIVE_INFINITY;
1871
+ // Build a 2D array of annotations based on their grid position
1872
+ const annotationGrid = [];
1873
+ const rawAnnotations = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.annotations;
1874
+ if (rawAnnotations) {
1875
+ const annotationsArray = Array.isArray(rawAnnotations) ? rawAnnotations : [
1876
+ rawAnnotations
1877
+ ];
1878
+ // Collect all unique x and y values from valid annotations
1879
+ const xSet = new Set();
1880
+ const ySet = new Set();
1881
+ const validAnnotations = [];
1882
+ annotationsArray.forEach((a)=>{
1883
+ 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)) {
1884
+ xSet.add(a.x);
1885
+ ySet.add(a.y);
1886
+ validAnnotations.push({
1887
+ x: a.x,
1888
+ y: a.y,
1889
+ text: cleanText(a.text)
1890
+ });
1891
+ }
1892
+ });
1893
+ if (validAnnotations.length > 0) {
1894
+ // Get sorted unique x and y values
1895
+ const xValues = Array.from(xSet).sort((a, b)=>a - b);
1896
+ const yValues = Array.from(ySet).sort((a, b)=>a - b);
1897
+ // Initialize 2D grid and populate
1898
+ validAnnotations.forEach((annotation)=>{
1899
+ const xIdx = xValues.indexOf(annotation.x);
1900
+ const yIdx = yValues.indexOf(annotation.y);
1901
+ if (!annotationGrid[yIdx]) {
1902
+ annotationGrid[yIdx] = [];
1903
+ }
1904
+ annotationGrid[yIdx][xIdx] = annotation.text;
1905
+ });
1906
+ }
1907
+ }
1908
+ // Helper function to get annotation from 2D grid by index
1909
+ const getAnnotationByIndex = (xIdx, yIdx)=>{
1910
+ var _annotationGrid_yIdx;
1911
+ return (_annotationGrid_yIdx = annotationGrid[yIdx]) === null || _annotationGrid_yIdx === void 0 ? void 0 : _annotationGrid_yIdx[xIdx];
1912
+ };
1867
1913
  if (firstData.type === 'histogram2d') {
1868
1914
  var _firstData_x, _firstData_xbins, _firstData_xbins1, _firstData_xbins2, _firstData_ybins, _firstData_ybins1, _firstData_ybins2;
1869
1915
  const xValues = [];
@@ -1903,11 +1949,12 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
1903
1949
  xBins.forEach((xBin, xIdx)=>{
1904
1950
  yBins.forEach((yBin, yIdx)=>{
1905
1951
  const zVal = calculateHistNorm(firstData.histnorm, z[yIdx][xIdx], total, isXString ? xBin.length : getBinSize(xBin), isYString ? yBin.length : getBinSize(yBin));
1952
+ const annotationText = getAnnotationByIndex(xIdx, yIdx);
1906
1953
  heatmapDataPoints.push({
1907
1954
  x: isXString ? xBin.join(', ') : getBinCenter(xBin),
1908
1955
  y: isYString ? yBin.join(', ') : getBinCenter(yBin),
1909
1956
  value: zVal,
1910
- rectText: zVal
1957
+ rectText: annotationText || zVal
1911
1958
  });
1912
1959
  if (typeof zVal === 'number') {
1913
1960
  zMin = Math.min(zMin, zVal);
@@ -1916,17 +1963,34 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
1916
1963
  });
1917
1964
  });
1918
1965
  } else {
1919
- var _firstData_x1;
1920
- (_firstData_x1 = firstData.x) === null || _firstData_x1 === void 0 ? void 0 : _firstData_x1.forEach((xVal, xIdx)=>{
1921
- var _firstData_y;
1922
- (_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y.forEach((yVal, yIdx)=>{
1923
- var _firstData_z_yIdx, _firstData_z, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
1924
- 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];
1966
+ var _zArray_;
1967
+ // If x and y are not provided, generate indices based on z dimensions
1968
+ const zArray = firstData.z;
1969
+ const xValues = firstData.x;
1970
+ const yValues = firstData.y;
1971
+ var _zArray_length;
1972
+ // Determine the dimensions from z array
1973
+ const yLength = (_zArray_length = zArray === null || zArray === void 0 ? void 0 : zArray.length) !== null && _zArray_length !== void 0 ? _zArray_length : 0;
1974
+ var _zArray__length;
1975
+ 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;
1976
+ // Use provided x/y values or generate indices
1977
+ const xData = xValues !== null && xValues !== void 0 ? xValues : Array.from({
1978
+ length: xLength
1979
+ }, (_, i)=>i);
1980
+ const yData = yValues !== null && yValues !== void 0 ? yValues : Array.from({
1981
+ length: yLength
1982
+ }, (_, i)=>yLength - 1 - i);
1983
+ xData.forEach((xVal, xIdx)=>{
1984
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1985
+ yData.forEach((yVal, yIdx)=>{
1986
+ var _zArray_yIdx, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
1987
+ const zVal = zArray === null || zArray === void 0 ? void 0 : (_zArray_yIdx = zArray[yIdx]) === null || _zArray_yIdx === void 0 ? void 0 : _zArray_yIdx[xIdx];
1988
+ const annotationText = getAnnotationByIndex(xIdx, yIdx);
1925
1989
  heatmapDataPoints.push({
1926
1990
  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,
1927
1991
  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,
1928
1992
  value: zVal,
1929
- rectText: zVal
1993
+ rectText: annotationText || zVal
1930
1994
  });
1931
1995
  if (typeof zVal === 'number') {
1932
1996
  zMin = Math.min(zMin, zVal);
@@ -1953,7 +2017,7 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
1953
2017
  (0, _colors.getColorFromToken)(_colors.DataVizPalette.color3)
1954
2018
  ];
1955
2019
  var _firstData_colorscale, _ref, _ref1, _ref2, _ref3;
1956
- 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;
2020
+ 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;
1957
2021
  // determine if the types diverging, sequential or sequentialminus are present in colorscale
1958
2022
  if (colorscale && typeof colorscale === 'object' && ('diverging' in colorscale || 'sequential' in colorscale || 'sequentialminus' in colorscale)) {
1959
2023
  const isDivergent = zMin < 0 && zMax > 0; // Data spans both positive and negative values
@@ -1979,12 +2043,11 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
1979
2043
  hideLegend: true,
1980
2044
  showYAxisLables: true,
1981
2045
  sortOrder: 'none',
1982
- width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
1983
- 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,
2046
+ width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
2047
+ 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,
1984
2048
  hideTickOverlap: true,
1985
2049
  noOfCharsToTruncate: 20,
1986
2050
  showYAxisLablesTooltip: true,
1987
- wrapXAxisLables: true,
1988
2051
  ...getTitles(input.layout),
1989
2052
  ...getAxisCategoryOrderProps([
1990
2053
  firstData
@@ -2829,7 +2892,10 @@ const isNonPlotType = (chartType)=>{
2829
2892
  'donut',
2830
2893
  'sankey',
2831
2894
  'pie',
2832
- 'annotation'
2895
+ 'annotation',
2896
+ 'table',
2897
+ 'gauge',
2898
+ 'funnel'
2833
2899
  ].includes(chartType);
2834
2900
  };
2835
2901
  const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
@@ -3015,7 +3081,7 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
3015
3081
  }
3016
3082
  const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
3017
3083
  if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
3018
- result[propName] = ax.categoryarray;
3084
+ result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? ax.categoryarray.slice().reverse() : ax.categoryarray;
3019
3085
  return;
3020
3086
  }
3021
3087
  if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
@@ -3092,16 +3158,23 @@ const getAxisScaleTypeProps = (data, layout)=>{
3092
3158
  return;
3093
3159
  }
3094
3160
  const axType = getAxisType(data, ax);
3161
+ if (axId === 'x' && axType === 'category') {
3162
+ props.xAxis = {
3163
+ tickLayout: 'auto'
3164
+ };
3165
+ }
3095
3166
  if ((!ax.tickmode || ax.tickmode === 'array') && (0, _chartutilities.isArrayOrTypedArray)(ax.tickvals)) {
3096
3167
  const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
3097
3168
  if (axId === 'x') {
3098
3169
  props.tickValues = tickValues;
3099
3170
  props.xAxis = {
3171
+ ...props.xAxis,
3100
3172
  tickText: ax.ticktext
3101
3173
  };
3102
3174
  } else if (axId === 'y') {
3103
3175
  props.yAxisTickValues = tickValues;
3104
3176
  props.yAxis = {
3177
+ ...props.yAxis,
3105
3178
  tickText: ax.ticktext
3106
3179
  };
3107
3180
  }
@@ -3112,11 +3185,13 @@ const getAxisScaleTypeProps = (data, layout)=>{
3112
3185
  const tick0 = plotlyTick0(ax.tick0, axType, dtick);
3113
3186
  if (axId === 'x') {
3114
3187
  props.xAxis = {
3188
+ ...props.xAxis,
3115
3189
  tickStep: dtick,
3116
3190
  tick0
3117
3191
  };
3118
3192
  } else if (axId === 'y') {
3119
3193
  props.yAxis = {
3194
+ ...props.yAxis,
3120
3195
  tickStep: dtick,
3121
3196
  tick0
3122
3197
  };