@fluentui/react-charting 5.24.39 → 5.25.0

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 (111) hide show
  1. package/CHANGELOG.json +60 -1
  2. package/CHANGELOG.md +21 -2
  3. package/dist/react-charting.d.ts +127 -0
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +74 -0
  7. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  8. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +343 -0
  9. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  10. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  11. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +111 -0
  12. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  13. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  14. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +2 -0
  15. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  16. package/lib/components/CommonComponents/CartesianChart.base.js +38 -46
  17. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  18. package/lib/components/CommonComponents/CartesianChart.styles.js +9 -1
  19. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  20. package/lib/components/CommonComponents/CartesianChart.types.d.ts +17 -1
  21. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  22. package/lib/components/CommonComponents/index.d.ts +2 -0
  23. package/lib/components/CommonComponents/index.js +2 -0
  24. package/lib/components/CommonComponents/index.js.map +1 -1
  25. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
  26. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  27. package/lib/index.d.ts +1 -1
  28. package/lib/index.js.map +1 -1
  29. package/lib/types/IChartAnnotation.d.ts +99 -0
  30. package/lib/types/IChartAnnotation.js +2 -0
  31. package/lib/types/IChartAnnotation.js.map +1 -0
  32. package/lib/types/IDataPoint.d.ts +4 -0
  33. package/lib/types/IDataPoint.js.map +1 -1
  34. package/lib/types/index.d.ts +1 -0
  35. package/lib/types/index.js +1 -0
  36. package/lib/types/index.js.map +1 -1
  37. package/lib/utilities/image-export-utils.js +55 -0
  38. package/lib/utilities/image-export-utils.js.map +1 -1
  39. package/lib/utilities/utilities.js +72 -20
  40. package/lib/utilities/utilities.js.map +1 -1
  41. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  42. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +344 -0
  43. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  44. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  45. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +119 -0
  46. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  47. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  48. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +5 -0
  49. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  50. package/lib-amd/components/CommonComponents/CartesianChart.base.js +38 -47
  51. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  52. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +9 -1
  53. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  54. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +17 -1
  55. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  56. package/lib-amd/components/CommonComponents/index.d.ts +2 -0
  57. package/lib-amd/components/CommonComponents/index.js +3 -1
  58. package/lib-amd/components/CommonComponents/index.js.map +1 -1
  59. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
  60. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  61. package/lib-amd/index.d.ts +1 -1
  62. package/lib-amd/index.js.map +1 -1
  63. package/lib-amd/types/IChartAnnotation.d.ts +99 -0
  64. package/lib-amd/types/IChartAnnotation.js +5 -0
  65. package/lib-amd/types/IChartAnnotation.js.map +1 -0
  66. package/lib-amd/types/IDataPoint.d.ts +4 -0
  67. package/lib-amd/types/IDataPoint.js.map +1 -1
  68. package/lib-amd/types/index.d.ts +1 -0
  69. package/lib-amd/types/index.js +2 -1
  70. package/lib-amd/types/index.js.map +1 -1
  71. package/lib-amd/utilities/image-export-utils.js +55 -0
  72. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  73. package/lib-amd/utilities/utilities.js +72 -20
  74. package/lib-amd/utilities/utilities.js.map +1 -1
  75. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  76. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +346 -0
  77. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  78. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  79. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +118 -0
  80. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  81. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  82. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +3 -0
  83. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  84. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +38 -46
  85. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  86. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +9 -1
  87. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  88. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +17 -1
  89. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  90. package/lib-commonjs/components/CommonComponents/index.d.ts +2 -0
  91. package/lib-commonjs/components/CommonComponents/index.js +2 -0
  92. package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
  93. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
  94. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  95. package/lib-commonjs/index.d.ts +1 -1
  96. package/lib-commonjs/index.js.map +1 -1
  97. package/lib-commonjs/types/IChartAnnotation.d.ts +99 -0
  98. package/lib-commonjs/types/IChartAnnotation.js +3 -0
  99. package/lib-commonjs/types/IChartAnnotation.js.map +1 -0
  100. package/lib-commonjs/types/IDataPoint.d.ts +4 -0
  101. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  102. package/lib-commonjs/types/index.d.ts +1 -0
  103. package/lib-commonjs/types/index.js +1 -0
  104. package/lib-commonjs/types/index.js.map +1 -1
  105. package/lib-commonjs/utilities/image-export-utils.js +55 -0
  106. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  107. package/lib-commonjs/utilities/utilities.js +72 -20
  108. package/lib-commonjs/utilities/utilities.js.map +1 -1
  109. package/package.json +9 -9
  110. package/src/components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts +58 -0
  111. package/src/components/CommonComponents/CartesianChart.types.ts +21 -0
@@ -255,6 +255,508 @@ var flattenObject = function (obj, prefix) {
255
255
  }
256
256
  return flattened;
257
257
  };
258
+ var toFiniteNumber = function (value) {
259
+ if (value === undefined || value === null) {
260
+ return undefined;
261
+ }
262
+ var numeric = typeof value === 'number' ? value : Number(value);
263
+ return Number.isFinite(numeric) ? numeric : undefined;
264
+ };
265
+ /**
266
+ * Normalizes Plotly axis reference strings so equivalent aliases (e.g. `xaxis1`, `x1`) collapse to the base axis id.
267
+ */
268
+ var normalizeAxisRef = function (ref, axis) {
269
+ if (!ref) {
270
+ return axis;
271
+ }
272
+ var normalized = ref.toLowerCase();
273
+ if (normalized === axis ||
274
+ normalized === "".concat(axis, "axis") ||
275
+ normalized === "".concat(axis, "axis1") ||
276
+ normalized === "".concat(axis, "1")) {
277
+ return axis;
278
+ }
279
+ var match = normalized.match(/^([xy])(axis)?(\d+)$/);
280
+ if (match && match[1] === axis && match[3]) {
281
+ return match[3] === '1' ? axis : "".concat(axis).concat(match[3]);
282
+ }
283
+ return normalized;
284
+ };
285
+ /**
286
+ * Scans the data traces bound to a given axis and returns the numeric min/max values plotted on that axis.
287
+ */
288
+ var getAxisNumericRangeFromData = function (axis, ref, layout, data) {
289
+ if (!data || data.length === 0) {
290
+ return undefined;
291
+ }
292
+ var axisLayout = getAxisLayoutByRef(layout, ref, axis);
293
+ var targetRef = normalizeAxisRef(ref, axis);
294
+ var traceAxisKey = axis === 'x' ? 'xaxis' : 'yaxis';
295
+ var minValue;
296
+ var maxValue;
297
+ data.forEach(function (trace) {
298
+ var plotTrace = trace;
299
+ var traceAxisRef = normalizeAxisRef(plotTrace[traceAxisKey], axis);
300
+ if (traceAxisRef !== targetRef) {
301
+ return;
302
+ }
303
+ var values = (axis === 'x' ? plotTrace.x : plotTrace.y);
304
+ if (!isArrayOrTypedArray(values)) {
305
+ return;
306
+ }
307
+ var arrayLike = values;
308
+ for (var index = 0; index < arrayLike.length; index++) {
309
+ var value = arrayLike[index];
310
+ var numeric = toNumericValue(convertDataValue(value, axisLayout));
311
+ if (numeric === undefined || Number.isNaN(numeric)) {
312
+ continue;
313
+ }
314
+ minValue = minValue === undefined ? numeric : Math.min(minValue, numeric);
315
+ maxValue = maxValue === undefined ? numeric : Math.max(maxValue, numeric);
316
+ }
317
+ });
318
+ if (minValue === undefined || maxValue === undefined || minValue === maxValue) {
319
+ return undefined;
320
+ }
321
+ return [minValue, maxValue];
322
+ };
323
+ /**
324
+ * Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
325
+ */
326
+ var transformRelativeYForChart = function (value) {
327
+ if (value === undefined) {
328
+ return undefined;
329
+ }
330
+ if (!Number.isFinite(value)) {
331
+ return undefined;
332
+ }
333
+ return 1 - value;
334
+ };
335
+ var mapHorizontalAlign = function (anchor) {
336
+ switch ((anchor !== null && anchor !== void 0 ? anchor : '').toLowerCase()) {
337
+ case 'left':
338
+ return 'start';
339
+ case 'center':
340
+ return 'center';
341
+ case 'right':
342
+ return 'end';
343
+ default:
344
+ return undefined;
345
+ }
346
+ };
347
+ var mapVerticalAlign = function (anchor) {
348
+ switch ((anchor !== null && anchor !== void 0 ? anchor : '').toLowerCase()) {
349
+ case 'top':
350
+ return 'top';
351
+ case 'middle':
352
+ return 'middle';
353
+ case 'bottom':
354
+ return 'bottom';
355
+ default:
356
+ return undefined;
357
+ }
358
+ };
359
+ var appendPx = function (value) {
360
+ if (value === undefined || value === null) {
361
+ return undefined;
362
+ }
363
+ if (typeof value === 'string') {
364
+ return value;
365
+ }
366
+ if (typeof value === 'number' && Number.isFinite(value)) {
367
+ return "".concat(value, "px");
368
+ }
369
+ return undefined;
370
+ };
371
+ /**
372
+ * Maps Plotly's axis reference string to one of our coordinate interpretation modes (axis, relative, or pixel).
373
+ */
374
+ var resolveRefType = function (ref, axis) {
375
+ if (!ref) {
376
+ return 'axis';
377
+ }
378
+ var normalized = ref.toLowerCase();
379
+ if (normalized === 'pixel') {
380
+ return 'pixel';
381
+ }
382
+ if (normalized === 'paper') {
383
+ return 'relative';
384
+ }
385
+ if (normalized.endsWith(' domain')) {
386
+ return normalized.startsWith(axis) ? 'relative' : undefined;
387
+ }
388
+ var match = normalized.match(/^([xy])(\d*)$/);
389
+ if (match && match[1] === axis) {
390
+ return 'axis';
391
+ }
392
+ return undefined;
393
+ };
394
+ /**
395
+ * Retrieves the appropriate axis layout section from Plotly's layout given an axis reference alias.
396
+ */
397
+ var getAxisLayoutByRef = function (layout, ref, axis) {
398
+ if (!layout) {
399
+ return undefined;
400
+ }
401
+ var defaultAxisKey = "".concat(axis, "axis");
402
+ if (!ref) {
403
+ return layout[defaultAxisKey];
404
+ }
405
+ var normalized = ref.toLowerCase();
406
+ if (normalized === 'paper' || normalized === 'pixel' || normalized.endsWith(' domain')) {
407
+ return layout[defaultAxisKey];
408
+ }
409
+ var match = normalized.match(/^([xy])(\d*)$/);
410
+ if (match && match[1] === axis) {
411
+ var index = match[2];
412
+ if (index && index !== '' && index !== '1') {
413
+ var axisKey = "".concat(axis, "axis").concat(index);
414
+ return layout[axisKey];
415
+ }
416
+ return layout[defaultAxisKey];
417
+ }
418
+ return layout[defaultAxisKey];
419
+ };
420
+ /**
421
+ * Normalizes raw Plotly data values into canonical number/date/string types based on axis configuration.
422
+ */
423
+ var convertDataValue = function (value, axisLayout) {
424
+ if (value === undefined || value === null) {
425
+ return undefined;
426
+ }
427
+ if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'date' || isDate(value)) {
428
+ var dateValue = value instanceof Date ? value : new Date(value);
429
+ return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
430
+ }
431
+ if (typeof value === 'number') {
432
+ return value;
433
+ }
434
+ if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'linear' || (axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'log') {
435
+ var numeric = Number(value);
436
+ return Number.isFinite(numeric) ? numeric : undefined;
437
+ }
438
+ if (value instanceof Date) {
439
+ return value;
440
+ }
441
+ return value;
442
+ };
443
+ var toNumericValue = function (value) {
444
+ if (value instanceof Date) {
445
+ var timestamp = value.getTime();
446
+ return Number.isFinite(timestamp) ? timestamp : undefined;
447
+ }
448
+ if (typeof value === 'number') {
449
+ return Number.isFinite(value) ? value : undefined;
450
+ }
451
+ if (typeof value === 'string') {
452
+ var numeric = Number(value);
453
+ return Number.isFinite(numeric) ? numeric : undefined;
454
+ }
455
+ return undefined;
456
+ };
457
+ var toRelativeCoordinate = function (value, axisLayout, fallbackRange) {
458
+ var range = Array.isArray(axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.range) ? axisLayout.range : undefined;
459
+ var start = range && range.length >= 2 ? toNumericValue(convertDataValue(range[0], axisLayout)) : undefined;
460
+ var end = range && range.length >= 2 ? toNumericValue(convertDataValue(range[1], axisLayout)) : undefined;
461
+ if ((start === undefined || end === undefined || start === end) && fallbackRange) {
462
+ start = fallbackRange[0], end = fallbackRange[1];
463
+ }
464
+ var current = toNumericValue(convertDataValue(value, axisLayout));
465
+ if (start === undefined || end === undefined || current === undefined || start === end) {
466
+ return undefined;
467
+ }
468
+ var relative = (current - start) / (end - start);
469
+ return Number.isFinite(relative) ? relative : undefined;
470
+ };
471
+ var createAnnotationId = function (text, index) {
472
+ var normalized = text.replace(/\s+/g, ' ').trim();
473
+ if (normalized) {
474
+ var slug = normalized
475
+ .toLowerCase()
476
+ .replace(/[^a-z0-9]+/g, '-')
477
+ .replace(/^-+|-+$/g, '')
478
+ .slice(0, 32);
479
+ if (slug) {
480
+ return "annotation-".concat(index, "-").concat(slug);
481
+ }
482
+ }
483
+ return "annotation-".concat(index);
484
+ };
485
+ var DEFAULT_ARROW_OFFSET = -40;
486
+ var mapArrowsideToArrow = function (annotation) {
487
+ var includeStart = false;
488
+ var includeEnd = false;
489
+ var arrowSide = typeof (annotation === null || annotation === void 0 ? void 0 : annotation.arrowside) === 'string' ? annotation === null || annotation === void 0 ? void 0 : annotation.arrowside.toLowerCase() : undefined;
490
+ if (arrowSide) {
491
+ includeStart = arrowSide.includes('start');
492
+ includeEnd = arrowSide.includes('end');
493
+ }
494
+ var endHead = toFiniteNumber(annotation === null || annotation === void 0 ? void 0 : annotation.arrowhead);
495
+ var startHead = toFiniteNumber(annotation.startarrowhead);
496
+ if (endHead !== undefined && endHead > 0) {
497
+ includeEnd = true;
498
+ }
499
+ if (startHead !== undefined && startHead > 0) {
500
+ includeStart = true;
501
+ }
502
+ if (includeStart && includeEnd) {
503
+ return 'both';
504
+ }
505
+ if (includeStart) {
506
+ return 'start';
507
+ }
508
+ if (includeEnd) {
509
+ return 'end';
510
+ }
511
+ return 'none';
512
+ };
513
+ var mapArrowDashToPattern = function (value) {
514
+ if (!value) {
515
+ return undefined;
516
+ }
517
+ var normalized = value.trim().toLowerCase();
518
+ switch (normalized) {
519
+ case 'solid':
520
+ return undefined;
521
+ case 'dot':
522
+ return '1, 5';
523
+ case 'dash':
524
+ return '5, 5';
525
+ case 'longdash':
526
+ return '10, 5';
527
+ case 'dashdot':
528
+ return '5, 5, 1, 5';
529
+ case 'longdashdot':
530
+ return '10, 5, 1, 5';
531
+ default:
532
+ if (/^\d+(\s|,)*\d*$/.test(normalized.replace(/\s+/g, ' '))) {
533
+ return normalized.replace(/\s+/g, ' ');
534
+ }
535
+ return value;
536
+ }
537
+ };
538
+ /**
539
+ * Converts a Plotly annotation definition into the internal `ChartAnnotation` format, translating coordinates,
540
+ * layout alignment, styling, and connector metadata while skipping unsupported configurations.
541
+ */
542
+ var convertPlotlyAnnotation = function (annotation, layout, data, index) {
543
+ var _a;
544
+ if (!annotation || annotation.visible === false) {
545
+ return undefined;
546
+ }
547
+ var xRefType = resolveRefType(annotation.xref, 'x');
548
+ var yRefType = resolveRefType(annotation.yref, 'y');
549
+ if (!xRefType || !yRefType) {
550
+ return undefined;
551
+ }
552
+ var coordinates;
553
+ if (xRefType === 'axis' && yRefType === 'axis') {
554
+ var xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
555
+ var yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
556
+ var xValue = convertDataValue(annotation.x, xAxisLayout);
557
+ var yValue = convertDataValue(annotation.y, yAxisLayout);
558
+ if (xValue === undefined || yValue === undefined) {
559
+ return undefined;
560
+ }
561
+ var yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
562
+ coordinates = __assign({ type: 'data', x: xValue, y: yValue }, (yRefNormalized === 'y2' ? { yAxis: 'secondary' } : {}));
563
+ }
564
+ else if (xRefType === 'relative' && yRefType === 'relative') {
565
+ var xValue = toFiniteNumber(annotation.x);
566
+ var yValue = toFiniteNumber(annotation.y);
567
+ var chartRelativeY = transformRelativeYForChart(yValue);
568
+ if (xValue === undefined || chartRelativeY === undefined) {
569
+ return undefined;
570
+ }
571
+ coordinates = {
572
+ type: 'relative',
573
+ x: xValue,
574
+ y: chartRelativeY,
575
+ };
576
+ }
577
+ else if (xRefType === 'relative' && yRefType === 'axis') {
578
+ var xValue = toFiniteNumber(annotation.x);
579
+ var yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
580
+ var yFallbackRange = getAxisNumericRangeFromData('y', annotation.yref, layout, data);
581
+ var yRelative = toRelativeCoordinate(annotation.y, yAxisLayout, yFallbackRange);
582
+ var chartRelativeY = transformRelativeYForChart(yRelative);
583
+ if (xValue === undefined || chartRelativeY === undefined) {
584
+ return undefined;
585
+ }
586
+ coordinates = {
587
+ type: 'relative',
588
+ x: xValue,
589
+ y: chartRelativeY,
590
+ };
591
+ }
592
+ else if (xRefType === 'axis' && yRefType === 'relative') {
593
+ var yValue = toFiniteNumber(annotation.y);
594
+ var xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
595
+ var xFallbackRange = getAxisNumericRangeFromData('x', annotation.xref, layout, data);
596
+ var xRelative = toRelativeCoordinate(annotation.x, xAxisLayout, xFallbackRange);
597
+ var chartRelativeY = transformRelativeYForChart(yValue);
598
+ if (xRelative === undefined || chartRelativeY === undefined) {
599
+ return undefined;
600
+ }
601
+ coordinates = {
602
+ type: 'relative',
603
+ x: xRelative,
604
+ y: chartRelativeY,
605
+ };
606
+ }
607
+ else if (xRefType === 'pixel' && yRefType === 'pixel') {
608
+ var xValue = toFiniteNumber(annotation.x);
609
+ var yValue = toFiniteNumber(annotation.y);
610
+ if (xValue === undefined || yValue === undefined) {
611
+ return undefined;
612
+ }
613
+ coordinates = {
614
+ type: 'pixel',
615
+ x: xValue,
616
+ y: yValue,
617
+ };
618
+ }
619
+ else {
620
+ return undefined;
621
+ }
622
+ var textValue = annotation.text;
623
+ var text = textValue === undefined || textValue === null ? '' : String(textValue);
624
+ var chartAnnotation = {
625
+ id: createAnnotationId(text, index),
626
+ text: text,
627
+ coordinates: coordinates,
628
+ };
629
+ var layoutProps = {};
630
+ var styleProps = {};
631
+ var showArrow = annotation.showarrow === undefined ? false : !!annotation.showarrow;
632
+ var clipOnAxis = annotation.cliponaxis;
633
+ if (clipOnAxis !== undefined) {
634
+ layoutProps.clipToBounds = !!clipOnAxis;
635
+ }
636
+ else if (coordinates.type === 'data') {
637
+ layoutProps.clipToBounds = true;
638
+ }
639
+ var horizontalAlign = mapHorizontalAlign(annotation.xanchor);
640
+ if (horizontalAlign) {
641
+ layoutProps.align = horizontalAlign;
642
+ }
643
+ if (!layoutProps.align) {
644
+ var alignProp = mapHorizontalAlign(annotation.align);
645
+ if (alignProp) {
646
+ layoutProps.align = alignProp;
647
+ }
648
+ }
649
+ var verticalAlign = mapVerticalAlign(annotation.yanchor);
650
+ if (verticalAlign) {
651
+ layoutProps.verticalAlign = verticalAlign;
652
+ }
653
+ if (!layoutProps.verticalAlign) {
654
+ var valignProp = mapVerticalAlign(annotation.valign);
655
+ if (valignProp) {
656
+ layoutProps.verticalAlign = valignProp;
657
+ }
658
+ }
659
+ var offsetXComponents = [];
660
+ var hasExplicitOffset = false;
661
+ var ax = toFiniteNumber(annotation.ax);
662
+ var axRef = typeof annotation.axref === 'string' ? annotation.axref.toLowerCase() : undefined;
663
+ if (ax !== undefined && (axRef === undefined || axRef === 'pixel')) {
664
+ offsetXComponents.push(ax);
665
+ hasExplicitOffset = true;
666
+ }
667
+ var xShift = toFiniteNumber(annotation.xshift);
668
+ if (xShift !== undefined) {
669
+ offsetXComponents.push(xShift);
670
+ hasExplicitOffset = true;
671
+ }
672
+ if (offsetXComponents.length > 0) {
673
+ var offsetX = offsetXComponents.reduce(function (sum, value) { return sum + value; }, 0);
674
+ if (offsetX !== 0) {
675
+ layoutProps.offsetX = offsetX;
676
+ }
677
+ }
678
+ var offsetYComponents = [];
679
+ var ay = toFiniteNumber(annotation.ay);
680
+ var ayRef = typeof annotation.ayref === 'string' ? annotation.ayref.toLowerCase() : undefined;
681
+ if (ay !== undefined && (ayRef === undefined || ayRef === 'pixel')) {
682
+ offsetYComponents.push(ay);
683
+ hasExplicitOffset = true;
684
+ }
685
+ var yShift = toFiniteNumber(annotation.yshift);
686
+ if (yShift !== undefined) {
687
+ offsetYComponents.push(yShift);
688
+ hasExplicitOffset = true;
689
+ }
690
+ if (offsetYComponents.length > 0) {
691
+ var offsetY = offsetYComponents.reduce(function (sum, value) { return sum + value; }, 0);
692
+ if (offsetY !== 0) {
693
+ layoutProps.offsetY = offsetY;
694
+ }
695
+ }
696
+ if (showArrow && !hasExplicitOffset && layoutProps.offsetY === undefined) {
697
+ layoutProps.offsetY = DEFAULT_ARROW_OFFSET;
698
+ }
699
+ var maxWidth = toFiniteNumber(annotation.width);
700
+ if (maxWidth !== undefined) {
701
+ layoutProps.maxWidth = maxWidth;
702
+ }
703
+ if (annotation.bgcolor) {
704
+ styleProps.backgroundColor = annotation.bgcolor;
705
+ }
706
+ if (annotation.bordercolor) {
707
+ styleProps.borderColor = annotation.bordercolor;
708
+ }
709
+ var borderWidth = toFiniteNumber(annotation.borderwidth);
710
+ if (borderWidth !== undefined) {
711
+ styleProps.borderWidth = borderWidth;
712
+ }
713
+ var borderPad = appendPx(annotation.borderpad);
714
+ if (borderPad) {
715
+ styleProps.padding = borderPad;
716
+ }
717
+ var opacity = toFiniteNumber(annotation.opacity);
718
+ if (opacity !== undefined) {
719
+ styleProps.opacity = opacity;
720
+ }
721
+ if (annotation.font) {
722
+ var font = annotation.font;
723
+ if (font === null || font === void 0 ? void 0 : font.color) {
724
+ styleProps.textColor = font.color;
725
+ }
726
+ var fontSize = appendPx(font === null || font === void 0 ? void 0 : font.size);
727
+ if (fontSize) {
728
+ styleProps.fontSize = fontSize;
729
+ }
730
+ if (font === null || font === void 0 ? void 0 : font.weight) {
731
+ styleProps.fontWeight = font.weight;
732
+ }
733
+ }
734
+ if (Object.keys(layoutProps).length > 0) {
735
+ chartAnnotation.layout = layoutProps;
736
+ }
737
+ if (Object.keys(styleProps).length > 0) {
738
+ chartAnnotation.style = styleProps;
739
+ }
740
+ if (showArrow) {
741
+ var arrowColor = (_a = annotation.arrowcolor) !== null && _a !== void 0 ? _a : styleProps.textColor;
742
+ var arrowWidth = toFiniteNumber(annotation.arrowwidth);
743
+ var endPadding = toFiniteNumber(annotation.standoff);
744
+ var startPadding = toFiniteNumber(annotation.startstandoff);
745
+ var dashPattern = mapArrowDashToPattern(annotation.arrowdash);
746
+ chartAnnotation.connector = __assign(__assign(__assign(__assign(__assign(__assign({}, (arrowColor ? { strokeColor: arrowColor } : {})), (arrowWidth !== undefined ? { strokeWidth: arrowWidth } : {})), (endPadding !== undefined ? { endPadding: Math.max(endPadding, 0) } : {})), (startPadding !== undefined ? { startPadding: Math.max(startPadding, 0) } : {})), (dashPattern ? { dashArray: dashPattern } : {})), { arrow: mapArrowsideToArrow(annotation) });
747
+ }
748
+ return chartAnnotation;
749
+ };
750
+ var getChartAnnotationsFromLayout = function (layout, data, isMultiPlot) {
751
+ if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
752
+ return undefined;
753
+ }
754
+ var annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [layout.annotations];
755
+ var converted = annotationsArray
756
+ .map(function (annotation, index) { return convertPlotlyAnnotation(annotation, layout, data, index); })
757
+ .filter(function (annotation) { return annotation !== undefined; });
758
+ return converted.length > 0 ? converted : undefined;
759
+ };
258
760
  /**
259
761
  * Normalizes an array of objects by flattening nested structures and creating grouped data
260
762
  * Uses json_normalize approach with D3 color detection and filtering
@@ -417,7 +919,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
417
919
  var _j = getLegendProps(input.data, input.layout, isMultiPlot), legends = _j.legends, hideLegend = _j.hideLegend;
418
920
  var colorScale = undefined;
419
921
  var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
420
- var resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
922
+ var resolveXValue = getAxisValueResolver(getAxisType(input.data, getAxisObjects(input.data, input.layout).x));
421
923
  input.data.forEach(function (series, index1) {
422
924
  var _a, _b, _c, _d, _e, _f, _g, _h;
423
925
  colorScale = createColorScale(input.layout, series, colorScale);
@@ -425,7 +927,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
425
927
  var extractedBarColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
426
928
  // extract line colors for each series only once
427
929
  var extractedLineColors = extractColor((_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, colorwayType, (_h = series.line) === null || _h === void 0 ? void 0 : _h.color, colorMap, isDarkTheme);
428
- var validXYRanges = getValidXYRanges(series, resolveXAxisValue);
930
+ var validXYRanges = getValidXYRanges(series, resolveXValue);
429
931
  validXYRanges.forEach(function (_a, rangeIdx) {
430
932
  var rangeStart = _a[0], rangeEnd = _a[1];
431
933
  var rangeXValues = series.x.slice(rangeStart, rangeEnd);
@@ -434,7 +936,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
434
936
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
435
937
  if (!mapXToDataPoints[x]) {
436
938
  mapXToDataPoints[x] = {
437
- xAxisPoint: resolveXAxisValue(x),
939
+ xAxisPoint: resolveXValue(x),
438
940
  chartData: [],
439
941
  lineData: [],
440
942
  };
@@ -487,7 +989,6 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
487
989
  .forEach(function (shape, shapeIdx) {
488
990
  var _a, _b, _c;
489
991
  var lineColor = (_a = shape.line) === null || _a === void 0 ? void 0 : _a.color;
490
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
491
992
  var resolveX = function (val) {
492
993
  if (typeof val === 'number' && Array.isArray(xCategories) && xCategories[val] !== undefined) {
493
994
  return xCategories[val];
@@ -496,7 +997,6 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
496
997
  };
497
998
  var x0Key = resolveX(shape.x0);
498
999
  var x1Key = resolveX(shape.x1);
499
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
500
1000
  var resolveY = function (val) {
501
1001
  if (shape.yref === 'paper') {
502
1002
  if (val === 0) {
@@ -505,7 +1005,10 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
505
1005
  if (val === 1) {
506
1006
  return yMaxValue;
507
1007
  }
508
- return yMinValue + val * (yMaxValue - yMinValue);
1008
+ if (typeof val === 'number') {
1009
+ return yMinValue + val * (yMaxValue - yMinValue);
1010
+ }
1011
+ return val;
509
1012
  }
510
1013
  return val;
511
1014
  };
@@ -527,7 +1030,8 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
527
1030
  });
528
1031
  });
529
1032
  var vsbcData = Object.values(mapXToDataPoints);
530
- return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ data: vsbcData, width: (_e = input.layout) === null || _e === void 0 ? void 0 : _e.width, height: (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_h = vsbcData[0]) === null || _h === void 0 ? void 0 : _h.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getBarProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout));
1033
+ var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1034
+ return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ data: vsbcData, width: (_e = input.layout) === null || _e === void 0 ? void 0 : _e.width, height: (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_h = vsbcData[0]) === null || _h === void 0 ? void 0 : _h.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getBarProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout)), (annotations ? { annotations: annotations } : {}));
531
1035
  };
532
1036
  export var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
533
1037
  var _a, _b, _c;
@@ -625,7 +1129,8 @@ export var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorM
625
1129
  });
626
1130
  }
627
1131
  });
628
- return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ dataV2: gvbcDataV2, width: (_a = processedInput.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = processedInput.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barwidth: 'auto', mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: true }), getTitles(processedInput.layout)), getAxisCategoryOrderProps(processedInput.data, processedInput.layout)), getYMinMaxValues(processedInput.data[0], processedInput.layout)), getXAxisTickFormat(processedInput.data[0], processedInput.layout)), yAxisTickFormat), getBarProps(processedInput.data, processedInput.layout)), getAxisTickProps(processedInput.data, processedInput.layout));
1132
+ var annotations = getChartAnnotationsFromLayout(processedInput.layout, processedInput.data, isMultiPlot);
1133
+ return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ dataV2: gvbcDataV2, width: (_a = processedInput.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = processedInput.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barwidth: 'auto', mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: true }), getTitles(processedInput.layout)), getAxisCategoryOrderProps(processedInput.data, processedInput.layout)), getYMinMaxValues(processedInput.data[0], processedInput.layout)), getXAxisTickFormat(processedInput.data[0], processedInput.layout)), yAxisTickFormat), getBarProps(processedInput.data, processedInput.layout)), getAxisTickProps(processedInput.data, processedInput.layout)), (annotations ? { annotations: annotations } : {}));
629
1134
  };
630
1135
  export var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
631
1136
  var _a, _b, _c, _d;
@@ -684,7 +1189,8 @@ export var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMa
684
1189
  : { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
685
1190
  });
686
1191
  });
687
- return __assign(__assign(__assign({ data: vbcData, width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, supportNegativeData: true, mode: 'histogram', hideTickOverlap: true, maxBarWidth: 50, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: typeof ((_d = vbcData[0]) === null || _d === void 0 ? void 0 : _d.x) === 'string' }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout));
1192
+ var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1193
+ return __assign(__assign(__assign(__assign({ data: vbcData, width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, supportNegativeData: true, mode: 'histogram', hideTickOverlap: true, maxBarWidth: 50, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: typeof ((_d = vbcData[0]) === null || _d === void 0 ? void 0 : _d.x) === 'string' }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), (annotations ? { annotations: annotations } : {}));
688
1194
  };
689
1195
  export var transformPlotlyJsonToAreaChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
690
1196
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'area', colorMap, colorwayType, isDarkTheme);
@@ -695,7 +1201,6 @@ export var transformPlotlyJsonToLineChartProps = function (input, isMultiPlot, c
695
1201
  export var transformPlotlyJsonToScatterChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
696
1202
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
697
1203
  };
698
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
699
1204
  var mapColorFillBars = function (layout) {
700
1205
  if (!Array.isArray(layout === null || layout === void 0 ? void 0 : layout.shapes)) {
701
1206
  return [];
@@ -715,7 +1220,7 @@ var mapColorFillBars = function (layout) {
715
1220
  });
716
1221
  };
717
1222
  var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
718
- var _a, _b, _c, _d, _e, _f, _g;
1223
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
719
1224
  var isScatterMarkers = [
720
1225
  'text',
721
1226
  'markers',
@@ -730,10 +1235,11 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
730
1235
  var isScatterChart = chartType === 'scatter';
731
1236
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
732
1237
  var mode = 'tonexty';
733
- var _h = getLegendProps(input.data, input.layout, isMultiPlot), legends = _h.legends, hideLegend = _h.hideLegend;
1238
+ var _q = getLegendProps(input.data, input.layout, isMultiPlot), legends = _q.legends, hideLegend = _q.hideLegend;
734
1239
  var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
735
- var resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
736
- var shouldWrapLabels = getAxisType(input.data, input.layout, 'x') === 'category';
1240
+ var xAxisType = getAxisType(input.data, getAxisObjects(input.data, input.layout).x);
1241
+ var resolveXValue = getAxisValueResolver(xAxisType);
1242
+ var shouldWrapLabels = xAxisType === 'category';
737
1243
  var chartData = input.data
738
1244
  .map(function (series, index) {
739
1245
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
@@ -753,7 +1259,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
753
1259
  // if mode contains 'text', we prioritize showing the text over curving the line
754
1260
  var lineOptions = !((_l = series.mode) === null || _l === void 0 ? void 0 : _l.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
755
1261
  var legendShape = getLegendShape(series);
756
- var validXYRanges = getValidXYRanges(series, resolveXAxisValue);
1262
+ var validXYRanges = getValidXYRanges(series, resolveXValue);
757
1263
  return validXYRanges.map(function (_a, rangeIdx) {
758
1264
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
759
1265
  var rangeStart = _a[0], rangeEnd = _a[1];
@@ -773,7 +1279,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
773
1279
  legendShape: legendShape,
774
1280
  data: rangeXValues.map(function (x, i) {
775
1281
  var _a, _b;
776
- return (__assign(__assign(__assign(__assign({ x: resolveXAxisValue(x), y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
1282
+ return (__assign(__assign(__assign(__assign({ x: resolveXValue(x), y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
777
1283
  ? { markerSize: markerSizes[i] }
778
1284
  : typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
779
1285
  ? { markerSize: series.marker.size }
@@ -796,16 +1302,49 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
796
1302
  });
797
1303
  })
798
1304
  .flat();
799
- var lineShape = ((_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.shapes) !== null && _c !== void 0 ? _c : [])
1305
+ var xMinValue = (_c = (_b = chartData[0]) === null || _b === void 0 ? void 0 : _b.data[0]) === null || _c === void 0 ? void 0 : _c.x;
1306
+ var xMaxValue = (_e = (_d = chartData[0]) === null || _d === void 0 ? void 0 : _d.data[chartData[0].data.length - 1]) === null || _e === void 0 ? void 0 : _e.x;
1307
+ var yMinValue = (_g = (_f = chartData[0]) === null || _f === void 0 ? void 0 : _f.data[0]) === null || _g === void 0 ? void 0 : _g.y;
1308
+ var yMaxValue = (_j = (_h = chartData[0]) === null || _h === void 0 ? void 0 : _h.data[chartData[0].data.length - 1]) === null || _j === void 0 ? void 0 : _j.y;
1309
+ var lineShape = ((_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.shapes) !== null && _l !== void 0 ? _l : [])
800
1310
  .filter(function (shape) { return shape.type === 'line'; })
801
1311
  .map(function (shape, shapeIdx) {
802
1312
  var _a, _b;
803
1313
  var lineColor = (_a = shape.line) === null || _a === void 0 ? void 0 : _a.color;
1314
+ var resolveX = function (val) {
1315
+ if (shape.xref === 'paper') {
1316
+ if (val === 0) {
1317
+ return xMinValue;
1318
+ }
1319
+ if (val === 1) {
1320
+ return xMaxValue;
1321
+ }
1322
+ return typeof xMinValue === 'number' && typeof xMaxValue === 'number' && typeof val === 'number'
1323
+ ? xMinValue + val * (xMaxValue - xMinValue)
1324
+ : val;
1325
+ }
1326
+ return val;
1327
+ };
1328
+ var resolveY = function (val) {
1329
+ if (shape.yref === 'paper') {
1330
+ if (val === 0) {
1331
+ return yMinValue;
1332
+ }
1333
+ if (val === 1) {
1334
+ return yMaxValue;
1335
+ }
1336
+ if (typeof val === 'number') {
1337
+ return yMinValue + val * (yMaxValue - yMinValue);
1338
+ }
1339
+ return val;
1340
+ }
1341
+ return val;
1342
+ };
804
1343
  return {
805
1344
  legend: "Reference_".concat(shapeIdx),
806
1345
  data: [
807
- { x: shape.x0, y: shape.y0 },
808
- { x: shape.x1, y: shape.y1 },
1346
+ { x: resolveX(shape.x0), y: resolveY(shape.y0) },
1347
+ { x: resolveX(shape.x1), y: resolveY(shape.y1) },
809
1348
  ],
810
1349
  color: (_b = rgb(lineColor).formatHex8()) !== null && _b !== void 0 ? _b : lineColor,
811
1350
  lineOptions: getLineOptions(shape.line),
@@ -825,15 +1364,18 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
825
1364
  var scatterChartProps = {
826
1365
  scatterChartData: chartData,
827
1366
  };
828
- var commonProps = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ supportNegativeData: true }, secondaryYAxisValues), { width: (_d = input.layout) === null || _d === void 0 ? void 0 : _d.width, height: (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : 350, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000, shouldWrapLabels: shouldWrapLabels }), getTitles(input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getAxisScaleTypeProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout));
1367
+ var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1368
+ var commonProps = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ supportNegativeData: true }, secondaryYAxisValues), { width: (_m = input.layout) === null || _m === void 0 ? void 0 : _m.width, height: (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : 350, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000, shouldWrapLabels: shouldWrapLabels }), getTitles(input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getAxisScaleTypeProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout)), (annotations ? { annotations: annotations } : {}));
829
1369
  if (isAreaChart) {
830
1370
  return __assign({ data: chartProps, mode: mode }, commonProps);
831
1371
  }
832
1372
  else {
833
1373
  return __assign(__assign(__assign(__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax), (isScatterChart
834
- ? __assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {})), (!isScatterChart && ((_g = mapColorFillBars(input.layout)) === null || _g === void 0 ? void 0 : _g.length)
835
- ? { colorFillBars: mapColorFillBars(input.layout) }
836
- : {}));
1374
+ ? __assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {})), (!isScatterChart &&
1375
+ (function () {
1376
+ var bars = mapColorFillBars(input.layout);
1377
+ return bars && !bars.includes(null) ? { colorFillBars: bars } : {};
1378
+ })()));
837
1379
  }
838
1380
  };
839
1381
  export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -884,49 +1426,71 @@ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, is
884
1426
  };
885
1427
  export var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
886
1428
  var _a, _b, _c;
887
- var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
1429
+ var data = input.data.filter(function (series) { return series.type !== 'scatter' || series.mode !== 'markers'; });
1430
+ var _d = getLegendProps(data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
888
1431
  var colorScale = undefined;
889
- var isXDate = getAxisType(input.data, input.layout, 'x') === 'date';
890
- var chartData = input.data
891
- .map(function (series, index) {
1432
+ var xAxisType = getAxisType(data, getAxisObjects(data, input.layout).x);
1433
+ var resolveXValue = getAxisValueResolver(xAxisType, parseLocalDate);
1434
+ var resolveGanttXValue = function (value) {
1435
+ var resolvedValue = resolveXValue(value);
1436
+ return typeof resolvedValue === 'string' ? 0 : resolvedValue !== null && resolvedValue !== void 0 ? resolvedValue : 0;
1437
+ };
1438
+ var isXDate = xAxisType === 'date';
1439
+ var ganttData = [];
1440
+ data.forEach(function (series, index) {
892
1441
  var _a, _b, _c, _d;
893
- colorScale = createColorScale(input.layout, series, colorScale);
894
- // extract colors for each series only once
895
- var extractedColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
896
1442
  var legend = legends[index];
897
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
898
- var convertXValueToNumber = function (value) {
899
- return isInvalidValue(value) ? 0 : isXDate ? +parseLocalDate(value) : +value;
900
- };
901
- return series.y
902
- .map(function (yVal, i) {
903
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
904
- if (isInvalidValue(yVal)) {
905
- return null;
1443
+ if (series.type === 'bar') {
1444
+ colorScale = createColorScale(input.layout, series, colorScale);
1445
+ // extract colors for each series only once
1446
+ var extractedColors_1 = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
1447
+ series.y.forEach(function (yVal, i) {
1448
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1449
+ if (isInvalidValue(yVal)) {
1450
+ return;
1451
+ }
1452
+ // resolve color for each legend's bars from the colorscale or extracted colors
1453
+ var color = colorScale
1454
+ ? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
1455
+ ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[i % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
1456
+ : 0)
1457
+ : resolveColor(extractedColors_1, i, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
1458
+ var opacity = getOpacity(series, i);
1459
+ var base = +resolveGanttXValue((_h = series.base) === null || _h === void 0 ? void 0 : _h[i]);
1460
+ var xVal = +resolveGanttXValue((_j = series.x) === null || _j === void 0 ? void 0 : _j[i]);
1461
+ ganttData.push({
1462
+ x: {
1463
+ start: isXDate ? new Date(base) : base,
1464
+ end: isXDate ? new Date(base + xVal) : base + xVal,
1465
+ },
1466
+ y: yVal,
1467
+ legend: legend,
1468
+ color: (_k = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _k !== void 0 ? _k : color,
1469
+ });
1470
+ });
1471
+ }
1472
+ else if (series.type === 'scatter' && series.mode === 'none' && series.fill === 'toself') {
1473
+ for (var i = 0; i < series.y.length; i += 5) {
1474
+ if (isInvalidValue(series.y[i]) || isInvalidValue(series.y[i + 3])) {
1475
+ continue;
1476
+ }
1477
+ var x0 = resolveGanttXValue(series.x[i]);
1478
+ var x1 = resolveGanttXValue(series.x[i + 1]);
1479
+ var y0 = series.y[i];
1480
+ var y1 = series.y[i + 3];
1481
+ ganttData.push({
1482
+ x: {
1483
+ start: x0,
1484
+ end: x1,
1485
+ },
1486
+ y: Math.round((y0 + y1) / 2),
1487
+ legend: legend,
1488
+ color: series.fillcolor,
1489
+ });
906
1490
  }
907
- // resolve color for each legend's bars from the colorscale or extracted colors
908
- var color = colorScale
909
- ? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
910
- ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[i % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
911
- : 0)
912
- : resolveColor(extractedColors, i, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
913
- var opacity = getOpacity(series, i);
914
- var base = convertXValueToNumber((_h = series.base) === null || _h === void 0 ? void 0 : _h[i]);
915
- var xVal = convertXValueToNumber((_j = series.x) === null || _j === void 0 ? void 0 : _j[i]);
916
- return {
917
- x: {
918
- start: isXDate ? new Date(base) : base,
919
- end: isXDate ? new Date(base + xVal) : base + xVal,
920
- },
921
- y: yVal,
922
- legend: legend,
923
- color: (_k = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _k !== void 0 ? _k : color,
924
- };
925
- })
926
- .filter(function (point) { return point !== null; });
927
- })
928
- .flat();
929
- return __assign(__assign(__assign(__assign({ data: chartData, showYAxisLables: true, height: (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 350, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true, useUTC: false }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true)), getAxisTickProps(input.data, input.layout));
1491
+ }
1492
+ });
1493
+ return __assign(__assign(__assign(__assign({ data: ganttData, showYAxisLables: true, height: (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 350, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true, useUTC: false }, getTitles(input.layout)), getAxisCategoryOrderProps(data, input.layout)), getBarProps(data, input.layout, true)), getAxisTickProps(data, input.layout));
930
1494
  };
931
1495
  export var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
932
1496
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
@@ -2099,9 +2663,15 @@ var getAxisTickProps = function (data, layout) {
2099
2663
  var tickValues = axType === 'date' ? ax.tickvals.map(function (v) { return new Date(v); }) : ax.tickvals;
2100
2664
  if (axId === 'x') {
2101
2665
  props.tickValues = tickValues;
2666
+ props.xAxis = {
2667
+ tickText: ax.ticktext,
2668
+ };
2102
2669
  }
2103
2670
  else if (axId === 'y') {
2104
2671
  props.yAxisTickValues = tickValues;
2672
+ props.yAxis = {
2673
+ tickText: ax.ticktext,
2674
+ };
2105
2675
  }
2106
2676
  return;
2107
2677
  }
@@ -2215,16 +2785,8 @@ var getAxisObjects = function (data, layout) {
2215
2785
  }
2216
2786
  return axisObjects;
2217
2787
  };
2218
- function getAxisType(data, arg2, arg3) {
2788
+ var getAxisType = function (data, ax) {
2219
2789
  var _a;
2220
- var ax;
2221
- if (arg2 && typeof arg2 === 'object' && '_id' in arg2) {
2222
- ax = arg2;
2223
- }
2224
- else if (typeof arg3 === 'string') {
2225
- var layout = arg2;
2226
- ax = getAxisObjects(data, layout)[arg3];
2227
- }
2228
2790
  if (!ax) {
2229
2791
  return 'category';
2230
2792
  }
@@ -2251,9 +2813,12 @@ function getAxisType(data, arg2, arg3) {
2251
2813
  return 'date';
2252
2814
  }
2253
2815
  return 'category';
2254
- }
2255
- var getAxisValueResolver = function (data, layout, axisId) {
2256
- var axType = getAxisType(data, layout, axisId);
2816
+ };
2817
+ var getAxisValueResolver = function (axType, dateParser) {
2818
+ var toDate = function (value) {
2819
+ var date = dateParser ? dateParser(value) : new Date(value);
2820
+ return isNaN(date.getTime()) ? null : date;
2821
+ };
2257
2822
  return function (value) {
2258
2823
  if (isInvalidValue(value)) {
2259
2824
  return null;
@@ -2264,10 +2829,10 @@ var getAxisValueResolver = function (data, layout, axisId) {
2264
2829
  return isNumber(value) ? +value : null;
2265
2830
  case 'date':
2266
2831
  if (isNumber(value)) {
2267
- return new Date(+value);
2832
+ return toDate(+value);
2268
2833
  }
2269
2834
  if (typeof value === 'string') {
2270
- return new Date(value);
2835
+ return toDate(value);
2271
2836
  }
2272
2837
  return null;
2273
2838
  case 'category':