@fluentui/react-charting 5.25.4 → 5.25.5

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 (112) hide show
  1. package/CHANGELOG.json +48 -1
  2. package/CHANGELOG.md +15 -2
  3. package/dist/react-charting.d.ts +36 -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 +8 -0
  7. package/lib/components/CommonComponents/CartesianChart.base.js +1 -1
  8. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  9. package/lib/components/CommonComponents/CartesianChart.types.d.ts +4 -0
  10. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  11. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +199 -61
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  13. package/lib/components/DonutChart/Pie/Pie.js +4 -2
  14. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  15. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +4 -0
  16. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  17. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
  18. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +55 -5
  19. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  20. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -1
  21. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
  22. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
  23. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  24. package/lib/components/LineChart/LineChart.base.js +1 -1
  25. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  26. package/lib/components/SankeyChart/SankeyChart.base.js +1 -1
  27. package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
  28. package/lib/components/ScatterChart/ScatterChart.base.js +13 -4
  29. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  30. package/lib/components/ScatterChart/ScatterChart.types.d.ts +4 -0
  31. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  32. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +11 -7
  33. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  34. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +18 -5
  35. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  36. package/lib/types/IDataPoint.d.ts +19 -0
  37. package/lib/types/IDataPoint.js.map +1 -1
  38. package/lib/utilities/utilities.d.ts +4 -2
  39. package/lib/utilities/utilities.js +22 -7
  40. package/lib/utilities/utilities.js.map +1 -1
  41. package/lib-amd/components/CommonComponents/CartesianChart.base.js +1 -1
  42. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  43. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +4 -0
  44. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  45. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +199 -61
  46. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  47. package/lib-amd/components/DonutChart/Pie/Pie.js +4 -2
  48. package/lib-amd/components/DonutChart/Pie/Pie.js.map +1 -1
  49. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +4 -0
  50. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  51. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
  52. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +54 -4
  53. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  54. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -2
  55. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
  56. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
  57. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  58. package/lib-amd/components/LineChart/LineChart.base.js +1 -1
  59. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  60. package/lib-amd/components/SankeyChart/SankeyChart.base.js +1 -1
  61. package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
  62. package/lib-amd/components/ScatterChart/ScatterChart.base.js +13 -4
  63. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  64. package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +4 -0
  65. package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
  66. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +11 -7
  67. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  68. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +18 -5
  69. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  70. package/lib-amd/types/IDataPoint.d.ts +19 -0
  71. package/lib-amd/types/IDataPoint.js.map +1 -1
  72. package/lib-amd/utilities/utilities.d.ts +4 -2
  73. package/lib-amd/utilities/utilities.js +22 -7
  74. package/lib-amd/utilities/utilities.js.map +1 -1
  75. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +1 -1
  76. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  77. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +4 -0
  78. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  79. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +199 -61
  80. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  81. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
  82. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  83. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +4 -0
  84. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  85. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
  86. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +54 -4
  87. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  88. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -1
  89. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
  90. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
  91. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  92. package/lib-commonjs/components/LineChart/LineChart.base.js +1 -1
  93. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  94. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +1 -1
  95. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
  96. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +13 -4
  97. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  98. package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +4 -0
  99. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  100. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +11 -7
  101. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  102. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +18 -5
  103. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  104. package/lib-commonjs/types/IDataPoint.d.ts +19 -0
  105. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  106. package/lib-commonjs/utilities/utilities.d.ts +4 -2
  107. package/lib-commonjs/utilities/utilities.js +22 -7
  108. package/lib-commonjs/utilities/utilities.js.map +1 -1
  109. package/package.json +1 -1
  110. package/src/components/CommonComponents/CartesianChart.types.ts +5 -0
  111. package/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.ts +11 -0
  112. package/src/components/ScatterChart/ScatterChart.types.ts +5 -0
@@ -88,6 +88,18 @@ var getYMinMaxValues = function (series, layout) {
88
88
  }
89
89
  return {};
90
90
  };
91
+ var getXMinMaxValues = function (series, layout) {
92
+ var _a;
93
+ var range = (_a = getXAxisProperties(series, layout)) === null || _a === void 0 ? void 0 : _a.range;
94
+ if (range && range.length === 2) {
95
+ return {
96
+ xMinValue: range[0],
97
+ xMaxValue: range[1],
98
+ showRoundOffXTickValues: false,
99
+ };
100
+ }
101
+ return {};
102
+ };
91
103
  var getYAxisProperties = function (series, layout) {
92
104
  return layout === null || layout === void 0 ? void 0 : layout.yaxis;
93
105
  };
@@ -212,6 +224,64 @@ export var resolveXAxisPoint = function (x, isXYearCategory, isXString, isXDate,
212
224
  }
213
225
  return x;
214
226
  };
227
+ /**
228
+ * Formats text values according to the texttemplate specification
229
+ * Supports D3 format specifiers within %{text:format} patterns
230
+ * @param textValue The raw text value to format
231
+ * @param textTemplate The template string (e.g., "%{text:.1f}%", "%{text:.2%}", "%{text:,.0f}")
232
+ * @param index Optional index for array-based templates
233
+ * @returns Formatted text string
234
+ *
235
+ * Examples:
236
+ * - "%{text:.1f}%" → Formats number with 1 decimal place and adds % suffix
237
+ * - "%{text:.2%}" → Formats as percentage with 2 decimal places
238
+ * - "%{text:,.0f}" → Formats with thousands separator and no decimals
239
+ * - "%{text:$,.2f}" → Formats as currency with thousands separator and 2 decimals
240
+ */
241
+ var formatTextWithTemplate = function (textValue, textTemplate, index) {
242
+ if (!textTemplate) {
243
+ return String(textValue);
244
+ }
245
+ var numVal = typeof textValue === 'number' ? textValue : parseFloat(String(textValue));
246
+ if (isNaN(numVal)) {
247
+ return String(textValue);
248
+ }
249
+ var template = typeof textTemplate === 'string' ? textTemplate : textTemplate[index || 0] || '';
250
+ // Match Plotly's texttemplate pattern: %{text:format} or %{text}
251
+ // Can be followed by any literal text like %, $, etc.
252
+ var plotlyPattern = /%\{text(?::([^}]+))?\}(.*)$/;
253
+ var match = template.match(plotlyPattern);
254
+ if (match) {
255
+ var formatSpec = match[1]; // The format specifier (e.g., ".1f", ".2%", ",.0f") or undefined
256
+ var suffix = match[2]; // Any text after the closing brace (e.g., "%", " units")
257
+ // If no format specifier is provided (e.g., %{text}%), try to infer from suffix
258
+ if (!formatSpec) {
259
+ // Check if suffix starts with % - assume simple percentage with 1 decimal
260
+ if (suffix.startsWith('%')) {
261
+ return "".concat(numVal.toFixed(1)).concat(suffix);
262
+ }
263
+ // No format specifier, just return the number with the suffix
264
+ return "".concat(numVal).concat(suffix);
265
+ }
266
+ try {
267
+ // Use D3 format function to apply the format specifier
268
+ var formatter = d3Format(formatSpec);
269
+ var formattedValue = formatter(numVal);
270
+ return "".concat(formattedValue).concat(suffix);
271
+ }
272
+ catch (error) {
273
+ // Try to extract precision for basic fallback
274
+ var precisionMatch = formatSpec.match(/\.(\d+)[f%]/);
275
+ var precision = precisionMatch ? parseInt(precisionMatch[1], 10) : 2;
276
+ // Check if it's a percentage format
277
+ if (formatSpec.includes('%')) {
278
+ return "".concat((numVal * 100).toFixed(precision), "%").concat(suffix);
279
+ }
280
+ return "".concat(numVal.toFixed(precision)).concat(suffix);
281
+ }
282
+ }
283
+ return String(textValue);
284
+ };
215
285
  /**
216
286
  * Extracts unique X-axis categories from Plotly data traces
217
287
  * @param data Array of Plotly data traces
@@ -978,7 +1048,9 @@ colorMap, colorwayType, isDarkTheme) {
978
1048
  height: height,
979
1049
  innerRadius: innerRadius,
980
1050
  hideLabels: hideLabels,
981
- showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
1051
+ showLabelsInPercent: firstData.textinfo
1052
+ ? ['percent', 'label+percent', 'percent+label'].includes(firstData.textinfo)
1053
+ : true,
982
1054
  roundCorners: true,
983
1055
  order: 'sorted',
984
1056
  };
@@ -1007,6 +1079,11 @@ colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
1007
1079
  var rangeStart = _a[0], rangeEnd = _a[1];
1008
1080
  var rangeXValues = series.x.slice(rangeStart, rangeEnd);
1009
1081
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
1082
+ var textValues = Array.isArray(series.text)
1083
+ ? series.text.slice(rangeStart, rangeEnd)
1084
+ : typeof series.text === 'string'
1085
+ ? series.text
1086
+ : undefined;
1010
1087
  rangeXValues.forEach(function (x, index2) {
1011
1088
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1012
1089
  if (!mapXToDataPoints[x]) {
@@ -1026,13 +1103,13 @@ colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
1026
1103
  var opacity = getOpacity(series, index2);
1027
1104
  var yVal = rangeYValues[index2];
1028
1105
  var yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
1106
+ var barLabel = Array.isArray(textValues) ? textValues[index2] : textValues;
1107
+ // Apply texttemplate formatting if specified
1108
+ if (barLabel && series.texttemplate) {
1109
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index2);
1110
+ }
1029
1111
  if (series.type === 'bar') {
1030
- mapXToDataPoints[x].chartData.push({
1031
- legend: legend,
1032
- data: yVal,
1033
- color: (_h = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color,
1034
- yAxisCalloutData: yAxisCalloutData,
1035
- });
1112
+ mapXToDataPoints[x].chartData.push(__assign({ legend: legend, data: yVal, color: (_h = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color, yAxisCalloutData: yAxisCalloutData }, (barLabel ? { barLabel: String(barLabel) } : {})));
1036
1113
  if (typeof yVal === 'number') {
1037
1114
  yMaxValue = Math.max(yMaxValue, yVal);
1038
1115
  }
@@ -1065,6 +1142,14 @@ colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
1065
1142
  var _a, _b, _c;
1066
1143
  var lineColor = (_a = shape.line) === null || _a === void 0 ? void 0 : _a.color;
1067
1144
  var resolveX = function (val) {
1145
+ if (shape.xref === 'x domain') {
1146
+ if (val === 0) {
1147
+ return xCategories[0];
1148
+ }
1149
+ if (val === 1) {
1150
+ return xCategories[xCategories.length - 1];
1151
+ }
1152
+ }
1068
1153
  if (typeof val === 'number' && Array.isArray(xCategories)) {
1069
1154
  if (xCategories[val] !== undefined) {
1070
1155
  return xCategories[val];
@@ -1115,7 +1200,7 @@ colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
1115
1200
  });
1116
1201
  var vsbcData = Object.values(mapXToDataPoints);
1117
1202
  var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1118
- return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ data: vsbcData, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, height: (_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.height) !== null && _e !== void 0 ? _e : 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 ((_f = vsbcData[0]) === null || _f === void 0 ? void 0 : _f.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 } : {}));
1203
+ return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ data: vsbcData, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, height: (_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.height) !== null && _e !== void 0 ? _e : 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, roundedTicks: true, wrapXAxisLables: typeof ((_f = vsbcData[0]) === null || _f === void 0 ? void 0 : _f.xAxisPoint) === 'string' }), getXMinMaxValues(input.data[0], input.layout)), 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 } : {}));
1119
1204
  };
1120
1205
  export var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot,
1121
1206
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -1173,12 +1258,13 @@ colorMap, colorwayType, isDarkTheme) {
1173
1258
  : resolveColor(extractedBarColors_1, xIndex, legend, colorMap, (_h = (_g = (_f = processedInput.layout) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.layout) === null || _h === void 0 ? void 0 : _h.colorway, isDarkTheme);
1174
1259
  var opacity = getOpacity(series, xIndex);
1175
1260
  var yVal = series.y[xIndex];
1176
- return {
1177
- x: x.toString(),
1178
- y: yVal,
1179
- yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
1180
- color: (_j = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
1181
- };
1261
+ // Extract text value for barLabel
1262
+ var barLabel = Array.isArray(series.text) ? series.text[xIndex] : series.text;
1263
+ // Apply texttemplate formatting if specified
1264
+ if (barLabel && series.texttemplate) {
1265
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, xIndex);
1266
+ }
1267
+ return __assign({ x: x.toString(), y: yVal, yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat), color: (_j = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color }, (barLabel ? { barLabel: String(barLabel) } : {}));
1182
1268
  })
1183
1269
  .filter(function (item) { return typeof item !== 'undefined'; }),
1184
1270
  useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
@@ -1216,7 +1302,7 @@ colorMap, colorwayType, isDarkTheme) {
1216
1302
  }
1217
1303
  });
1218
1304
  var annotations = getChartAnnotationsFromLayout(processedInput.layout, processedInput.data, isMultiPlot);
1219
- 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, showYAxisLables: 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 } : {}));
1305
+ return __assign(__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, roundedTicks: true, wrapXAxisLables: true, showYAxisLables: true }), getXMinMaxValues(processedInput.data[0], processedInput.layout)), 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 } : {}));
1220
1306
  };
1221
1307
  export var transformPlotlyJsonToVBCProps = function (input, isMultiPlot,
1222
1308
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -1272,13 +1358,18 @@ colorMap, colorwayType, isDarkTheme) {
1272
1358
  : resolveColor(extractedColors, index, 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);
1273
1359
  var opacity = getOpacity(series, index);
1274
1360
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
1275
- vbcData.push(__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (_h = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color }, (isXString
1361
+ // Handle text values and texttemplate formatting for histogram bins
1362
+ var barLabel = Array.isArray(series.text) ? series.text[index] : series.text;
1363
+ if (barLabel && series.texttemplate) {
1364
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index);
1365
+ }
1366
+ vbcData.push(__assign(__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (_h = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color }, (isXString
1276
1367
  ? {}
1277
- : { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
1368
+ : { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })), (barLabel ? { barLabel: String(barLabel) } : {})));
1278
1369
  });
1279
1370
  });
1280
1371
  var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1281
- 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', showYAxisLables: true }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), (annotations ? { annotations: annotations } : {}));
1372
+ return __assign(__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, roundedTicks: true, wrapXAxisLables: typeof ((_d = vbcData[0]) === null || _d === void 0 ? void 0 : _d.x) === 'string', showYAxisLables: true }, getXMinMaxValues(input.data[0], input.layout)), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), (annotations ? { annotations: annotations } : {}));
1282
1373
  };
1283
1374
  export var transformPlotlyJsonToAreaChartProps = function (input, isMultiPlot,
1284
1375
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -1470,12 +1561,12 @@ colorMap, colorwayType, isDarkTheme) {
1470
1561
  scatterChartData: __spreadArray(__spreadArray([], chartData, true), lineShape, true),
1471
1562
  };
1472
1563
  var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1473
- 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, wrapXAxisLables: shouldWrapLabels, showYAxisLables: true }), getTitles(input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getAxisScaleTypeProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout)), (annotations ? { annotations: annotations } : {}));
1564
+ var commonProps = __assign(__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, wrapXAxisLables: shouldWrapLabels, showYAxisLables: true, roundedTicks: true }), getXMinMaxValues(input.data[0], input.layout)), getTitles(input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getAxisScaleTypeProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout)), (annotations ? { annotations: annotations } : {}));
1474
1565
  if (isAreaChart) {
1475
1566
  return __assign({ data: chartProps, mode: mode }, commonProps);
1476
1567
  }
1477
1568
  else {
1478
- return __assign(__assign(__assign(__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax), (isScatterChart
1569
+ return __assign(__assign(__assign(__assign({ data: isScatterChart ? scatterChartProps : chartProps, enableReflow: false }, commonProps), yMinMax), (isScatterChart
1479
1570
  ? __assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {})), (!isScatterChart &&
1480
1571
  (function () {
1481
1572
  var bars = mapColorFillBars(input.layout);
@@ -1498,7 +1589,7 @@ colorMap, colorwayType, isDarkTheme) {
1498
1589
  var legend = legends[index];
1499
1590
  return series.y
1500
1591
  .map(function (yValue, i) {
1501
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1592
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1502
1593
  if (isInvalidValue(yValue)) {
1503
1594
  return null;
1504
1595
  }
@@ -1509,12 +1600,7 @@ colorMap, colorwayType, isDarkTheme) {
1509
1600
  : 0)
1510
1601
  : 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);
1511
1602
  var opacity = getOpacity(series, i);
1512
- return {
1513
- x: isInvalidValue((_h = series.x) === null || _h === void 0 ? void 0 : _h[i]) ? 0 : series.x[i],
1514
- y: yValue,
1515
- legend: legend,
1516
- color: (_j = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
1517
- };
1603
+ return __assign({ x: isInvalidValue((_h = series.x) === null || _h === void 0 ? void 0 : _h[i]) ? 0 : series.x[i], y: yValue, legend: legend, color: (_j = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color }, (((_k = series.text) === null || _k === void 0 ? void 0 : _k[i]) ? { barLabel: series.text[i].toString() } : {}));
1518
1604
  })
1519
1605
  .filter(function (point) { return point !== null; });
1520
1606
  })
@@ -1527,9 +1613,9 @@ colorMap, colorwayType, isDarkTheme) {
1527
1613
  var scalingFactor = 0.01;
1528
1614
  var gapFactor = 1 / (1 + scalingFactor * numberOfRows);
1529
1615
  var barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
1530
- return __assign(__assign(__assign(__assign({ data: chartData, secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
1616
+ return __assign(__assign(__assign(__assign(__assign({ data: chartData, secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
1531
1617
  ? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
1532
- : ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '', barHeight: barHeight, showYAxisLables: true, height: chartHeight, width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true)), getAxisTickProps(input.data, input.layout));
1618
+ : ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '', barHeight: barHeight, showYAxisLables: true, height: chartHeight, width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true, roundedTicks: true }, getXMinMaxValues(input.data[0], input.layout)), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true)), getAxisTickProps(input.data, input.layout));
1533
1619
  };
1534
1620
  export var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot,
1535
1621
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -1604,34 +1690,72 @@ colorMap, colorwayType, isDarkTheme) {
1604
1690
  export var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot,
1605
1691
  // eslint-disable-next-line @typescript-eslint/no-deprecated
1606
1692
  colorMap, colorwayType, isDarkTheme) {
1607
- 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;
1693
+ 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, _9, _10, _11;
1608
1694
  var firstData = input.data[0];
1609
1695
  var heatmapDataPoints = [];
1610
1696
  var zMin = Number.POSITIVE_INFINITY;
1611
1697
  var zMax = Number.NEGATIVE_INFINITY;
1698
+ // Build a 2D array of annotations based on their grid position
1699
+ var annotationGrid = [];
1700
+ var rawAnnotations = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.annotations;
1701
+ if (rawAnnotations) {
1702
+ var annotationsArray = Array.isArray(rawAnnotations) ? rawAnnotations : [rawAnnotations];
1703
+ // Collect all unique x and y values from valid annotations
1704
+ var xSet_1 = new Set();
1705
+ var ySet_1 = new Set();
1706
+ var validAnnotations_1 = [];
1707
+ annotationsArray.forEach(function (a) {
1708
+ if (a &&
1709
+ typeof a.x === 'number' &&
1710
+ typeof a.y === 'number' &&
1711
+ typeof a.text === 'string' &&
1712
+ (a.xref === 'x' || a.xref === undefined) &&
1713
+ (a.yref === 'y' || a.yref === undefined)) {
1714
+ xSet_1.add(a.x);
1715
+ ySet_1.add(a.y);
1716
+ validAnnotations_1.push({ x: a.x, y: a.y, text: cleanText(a.text) });
1717
+ }
1718
+ });
1719
+ if (validAnnotations_1.length > 0) {
1720
+ // Get sorted unique x and y values
1721
+ var xValues_1 = Array.from(xSet_1).sort(function (a, b) { return a - b; });
1722
+ var yValues_1 = Array.from(ySet_1).sort(function (a, b) { return a - b; });
1723
+ // Initialize 2D grid and populate
1724
+ validAnnotations_1.forEach(function (annotation) {
1725
+ var xIdx = xValues_1.indexOf(annotation.x);
1726
+ var yIdx = yValues_1.indexOf(annotation.y);
1727
+ if (!annotationGrid[yIdx]) {
1728
+ annotationGrid[yIdx] = [];
1729
+ }
1730
+ annotationGrid[yIdx][xIdx] = annotation.text;
1731
+ });
1732
+ }
1733
+ }
1734
+ // Helper function to get annotation from 2D grid by index
1735
+ var getAnnotationByIndex = function (xIdx, yIdx) { var _a; return (_a = annotationGrid[yIdx]) === null || _a === void 0 ? void 0 : _a[xIdx]; };
1612
1736
  if (firstData.type === 'histogram2d') {
1613
- var xValues_1 = [];
1614
- var yValues_1 = [];
1737
+ var xValues_2 = [];
1738
+ var yValues_2 = [];
1615
1739
  var zValues_1 = [];
1616
- (_a = firstData.x) === null || _a === void 0 ? void 0 : _a.forEach(function (xVal, index) {
1740
+ (_b = firstData.x) === null || _b === void 0 ? void 0 : _b.forEach(function (xVal, index) {
1617
1741
  var _a, _b;
1618
1742
  var zVal = (_a = getNumberAtIndexOrDefault(firstData.z, index)) !== null && _a !== void 0 ? _a : 0;
1619
1743
  if (isInvalidValue(xVal) || isInvalidValue((_b = firstData.y) === null || _b === void 0 ? void 0 : _b[index])) {
1620
1744
  return;
1621
1745
  }
1622
- xValues_1.push(xVal);
1623
- yValues_1.push(firstData.y[index]);
1746
+ xValues_2.push(xVal);
1747
+ yValues_2.push(firstData.y[index]);
1624
1748
  zValues_1.push(zVal);
1625
1749
  });
1626
- var isXString_1 = isStringArray(xValues_1);
1627
- var isYString_1 = isStringArray(yValues_1);
1628
- var xBins_1 = createBins(xValues_1, (_b = firstData.xbins) === null || _b === void 0 ? void 0 : _b.start, (_c = firstData.xbins) === null || _c === void 0 ? void 0 : _c.end, (_d = firstData.xbins) === null || _d === void 0 ? void 0 : _d.size);
1629
- var yBins_1 = createBins(yValues_1, (_e = firstData.ybins) === null || _e === void 0 ? void 0 : _e.start, (_f = firstData.ybins) === null || _f === void 0 ? void 0 : _f.end, (_g = firstData.ybins) === null || _g === void 0 ? void 0 : _g.size);
1750
+ var isXString_1 = isStringArray(xValues_2);
1751
+ var isYString_1 = isStringArray(yValues_2);
1752
+ var xBins_1 = createBins(xValues_2, (_c = firstData.xbins) === null || _c === void 0 ? void 0 : _c.start, (_d = firstData.xbins) === null || _d === void 0 ? void 0 : _d.end, (_e = firstData.xbins) === null || _e === void 0 ? void 0 : _e.size);
1753
+ var yBins_1 = createBins(yValues_2, (_f = firstData.ybins) === null || _f === void 0 ? void 0 : _f.start, (_g = firstData.ybins) === null || _g === void 0 ? void 0 : _g.end, (_h = firstData.ybins) === null || _h === void 0 ? void 0 : _h.size);
1630
1754
  var zBins_1 = yBins_1.map(function () { return xBins_1.map(function () { return []; }); });
1631
1755
  var total_1 = 0;
1632
- xValues_1.forEach(function (xVal, index) {
1756
+ xValues_2.forEach(function (xVal, index) {
1633
1757
  var xBinIdx = findBinIndex(xBins_1, xVal, isXString_1);
1634
- var yBinIdx = findBinIndex(yBins_1, yValues_1[index], isYString_1);
1758
+ var yBinIdx = findBinIndex(yBins_1, yValues_2[index], isYString_1);
1635
1759
  if (xBinIdx !== -1 && yBinIdx !== -1) {
1636
1760
  zBins_1[yBinIdx][xBinIdx].push(zValues_1[index]);
1637
1761
  }
@@ -1646,11 +1770,12 @@ colorMap, colorwayType, isDarkTheme) {
1646
1770
  xBins_1.forEach(function (xBin, xIdx) {
1647
1771
  yBins_1.forEach(function (yBin, yIdx) {
1648
1772
  var zVal = calculateHistNorm(firstData.histnorm, z_1[yIdx][xIdx], total_1, isXString_1 ? xBin.length : getBinSize(xBin), isYString_1 ? yBin.length : getBinSize(yBin));
1773
+ var annotationText = getAnnotationByIndex(xIdx, yIdx);
1649
1774
  heatmapDataPoints.push({
1650
1775
  x: isXString_1 ? xBin.join(', ') : getBinCenter(xBin),
1651
1776
  y: isYString_1 ? yBin.join(', ') : getBinCenter(yBin),
1652
1777
  value: zVal,
1653
- rectText: zVal,
1778
+ rectText: annotationText || zVal,
1654
1779
  });
1655
1780
  if (typeof zVal === 'number') {
1656
1781
  zMin = Math.min(zMin, zVal);
@@ -1660,17 +1785,27 @@ colorMap, colorwayType, isDarkTheme) {
1660
1785
  });
1661
1786
  }
1662
1787
  else {
1663
- (_h = firstData.x) === null || _h === void 0 ? void 0 : _h.forEach(function (xVal, xIdx) {
1664
- var _a;
1788
+ // If x and y are not provided, generate indices based on z dimensions
1789
+ var zArray_1 = firstData.z;
1790
+ var xValues = firstData.x;
1791
+ var yValues = firstData.y;
1792
+ // Determine the dimensions from z array
1793
+ var yLength_1 = (_j = zArray_1 === null || zArray_1 === void 0 ? void 0 : zArray_1.length) !== null && _j !== void 0 ? _j : 0;
1794
+ var xLength = (_l = (_k = zArray_1 === null || zArray_1 === void 0 ? void 0 : zArray_1[0]) === null || _k === void 0 ? void 0 : _k.length) !== null && _l !== void 0 ? _l : 0;
1795
+ // Use provided x/y values or generate indices
1796
+ var xData = xValues !== null && xValues !== void 0 ? xValues : Array.from({ length: xLength }, function (_, i) { return i; });
1797
+ var yData_1 = yValues !== null && yValues !== void 0 ? yValues : Array.from({ length: yLength_1 }, function (_, i) { return yLength_1 - 1 - i; });
1798
+ xData.forEach(function (xVal, xIdx) {
1665
1799
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1666
- (_a = firstData.y) === null || _a === void 0 ? void 0 : _a.forEach(function (yVal, yIdx) {
1667
- var _a, _b, _c, _d, _e, _f;
1668
- var zVal = (_b = (_a = firstData.z) === null || _a === void 0 ? void 0 : _a[yIdx]) === null || _b === void 0 ? void 0 : _b[xIdx];
1800
+ yData_1.forEach(function (yVal, yIdx) {
1801
+ var _a, _b, _c, _d, _e;
1802
+ var zVal = (_a = zArray_1 === null || zArray_1 === void 0 ? void 0 : zArray_1[yIdx]) === null || _a === void 0 ? void 0 : _a[xIdx];
1803
+ var annotationText = getAnnotationByIndex(xIdx, yIdx);
1669
1804
  heatmapDataPoints.push({
1670
- x: ((_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.xaxis) === null || _d === void 0 ? void 0 : _d.type) === 'date' ? xVal : xVal !== null && xVal !== void 0 ? xVal : 0,
1671
- y: ((_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.yaxis) === null || _f === void 0 ? void 0 : _f.type) === 'date' ? yVal : yVal,
1805
+ x: ((_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.xaxis) === null || _c === void 0 ? void 0 : _c.type) === 'date' ? xVal : xVal !== null && xVal !== void 0 ? xVal : 0,
1806
+ y: ((_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.yaxis) === null || _e === void 0 ? void 0 : _e.type) === 'date' ? yVal : yVal,
1672
1807
  value: zVal,
1673
- rectText: zVal,
1808
+ rectText: annotationText || zVal,
1674
1809
  });
1675
1810
  if (typeof zVal === 'number') {
1676
1811
  zMin = Math.min(zMin, zVal);
@@ -1680,7 +1815,7 @@ colorMap, colorwayType, isDarkTheme) {
1680
1815
  });
1681
1816
  }
1682
1817
  var heatmapData = {
1683
- legend: (_j = firstData.name) !== null && _j !== void 0 ? _j : '',
1818
+ legend: (_m = firstData.name) !== null && _m !== void 0 ? _m : '',
1684
1819
  data: heatmapDataPoints,
1685
1820
  value: 0,
1686
1821
  };
@@ -1691,7 +1826,7 @@ colorMap, colorwayType, isDarkTheme) {
1691
1826
  getColorFromToken(DataVizPalette.color2),
1692
1827
  getColorFromToken(DataVizPalette.color3),
1693
1828
  ];
1694
- var colorscale = (_0 = (_u = (_q = (_m = (_k = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _k !== void 0 ? _k : (_l = input.layout) === null || _l === void 0 ? void 0 : _l.colorscale) !== null && _m !== void 0 ? _m : (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.coloraxis) === null || _p === void 0 ? void 0 : _p.colorscale) !== null && _q !== void 0 ? _q : (_t = (_s = (_r = input.layout) === null || _r === void 0 ? void 0 : _r.template) === null || _s === void 0 ? void 0 : _s.layout) === null || _t === void 0 ? void 0 : _t.colorscale) !== null && _u !== void 0 ? _u : (firstData.type === 'histogram2d' && ((_z = (_y = (_x = (_w = (_v = input.layout) === null || _v === void 0 ? void 0 : _v.template) === null || _w === void 0 ? void 0 : _w.data) === null || _x === void 0 ? void 0 : _x.histogram2d) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.colorscale))) !== null && _0 !== void 0 ? _0 : (_5 = (_4 = (_3 = (_2 = (_1 = input.layout) === null || _1 === void 0 ? void 0 : _1.template) === null || _2 === void 0 ? void 0 : _2.data) === null || _3 === void 0 ? void 0 : _3.heatmap) === null || _4 === void 0 ? void 0 : _4[0]) === null || _5 === void 0 ? void 0 : _5.colorscale;
1829
+ var colorscale = (_3 = (_x = (_t = (_q = (_o = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _o !== void 0 ? _o : (_p = input.layout) === null || _p === void 0 ? void 0 : _p.colorscale) !== null && _q !== void 0 ? _q : (_s = (_r = input.layout) === null || _r === void 0 ? void 0 : _r.coloraxis) === null || _s === void 0 ? void 0 : _s.colorscale) !== null && _t !== void 0 ? _t : (_w = (_v = (_u = input.layout) === null || _u === void 0 ? void 0 : _u.template) === null || _v === void 0 ? void 0 : _v.layout) === null || _w === void 0 ? void 0 : _w.colorscale) !== null && _x !== void 0 ? _x : (firstData.type === 'histogram2d' && ((_2 = (_1 = (_0 = (_z = (_y = input.layout) === null || _y === void 0 ? void 0 : _y.template) === null || _z === void 0 ? void 0 : _z.data) === null || _0 === void 0 ? void 0 : _0.histogram2d) === null || _1 === void 0 ? void 0 : _1[0]) === null || _2 === void 0 ? void 0 : _2.colorscale))) !== null && _3 !== void 0 ? _3 : (_8 = (_7 = (_6 = (_5 = (_4 = input.layout) === null || _4 === void 0 ? void 0 : _4.template) === null || _5 === void 0 ? void 0 : _5.data) === null || _6 === void 0 ? void 0 : _6.heatmap) === null || _7 === void 0 ? void 0 : _7[0]) === null || _8 === void 0 ? void 0 : _8.colorscale;
1695
1830
  // determine if the types diverging, sequential or sequentialminus are present in colorscale
1696
1831
  if (colorscale &&
1697
1832
  typeof colorscale === 'object' &&
@@ -1715,13 +1850,13 @@ colorMap, colorwayType, isDarkTheme) {
1715
1850
  var rangeValuesForColorScale = Array.isArray(colorscale)
1716
1851
  ? colorscale.map(function (arr) { return arr[1]; })
1717
1852
  : defaultRange;
1718
- return __assign(__assign(__assign({ data: [heatmapData], domainValuesForColorScale: domainValuesForColorScale, rangeValuesForColorScale: rangeValuesForColorScale, hideLegend: true, showYAxisLables: true, sortOrder: 'none', width: (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.width, height: (_8 = (_7 = input.layout) === null || _7 === void 0 ? void 0 : _7.height) !== null && _8 !== void 0 ? _8 : 350, hideTickOverlap: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: true }, getTitles(input.layout)), getAxisCategoryOrderProps([firstData], input.layout)), getAxisTickProps(input.data, input.layout));
1853
+ return __assign(__assign(__assign({ data: [heatmapData], domainValuesForColorScale: domainValuesForColorScale, rangeValuesForColorScale: rangeValuesForColorScale, hideLegend: true, showYAxisLables: true, sortOrder: 'none', width: (_9 = input.layout) === null || _9 === void 0 ? void 0 : _9.width, height: (_11 = (_10 = input.layout) === null || _10 === void 0 ? void 0 : _10.height) !== null && _11 !== void 0 ? _11 : 350, hideTickOverlap: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: true }, getTitles(input.layout)), getAxisCategoryOrderProps([firstData], input.layout)), getAxisTickProps(input.data, input.layout));
1719
1854
  };
1720
1855
  export var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot,
1721
1856
  // eslint-disable-next-line @typescript-eslint/no-deprecated
1722
1857
  colorMap, colorwayType, isDarkTheme) {
1723
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1724
- var _m = input.data[0], link = _m.link, node = _m.node;
1858
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1859
+ var _q = input.data[0], link = _q.link, node = _q.node;
1725
1860
  var validLinks = ((_a = link === null || link === void 0 ? void 0 : link.value) !== null && _a !== void 0 ? _a : [])
1726
1861
  .map(function (val, index) {
1727
1862
  var _a, _b;
@@ -1737,8 +1872,9 @@ colorMap, colorwayType, isDarkTheme) {
1737
1872
  // Filter out negative nodes, unequal nodes and self-references (circular links)
1738
1873
  .filter(function (x) { return x !== null && x.source >= 0 && x.target >= 0 && x.source !== x.target; });
1739
1874
  var extractedNodeColors = extractColor((_d = (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.template) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.colorway, colorwayType, node === null || node === void 0 ? void 0 : node.color, colorMap, isDarkTheme);
1875
+ var extractedLinkColors = 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, link === null || link === void 0 ? void 0 : link.color, colorMap, isDarkTheme);
1740
1876
  var sankeyChartData = {
1741
- nodes: (_e = node.label) === null || _e === void 0 ? void 0 : _e.map(function (label, index) {
1877
+ nodes: (_h = node.label) === null || _h === void 0 ? void 0 : _h.map(function (label, index) {
1742
1878
  var _a, _b, _c;
1743
1879
  var color = resolveColor(extractedNodeColors, index, label, colorMap, (_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, isDarkTheme);
1744
1880
  return {
@@ -1749,11 +1885,13 @@ colorMap, colorwayType, isDarkTheme) {
1749
1885
  }),
1750
1886
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1751
1887
  links: validLinks.map(function (validLink, index) {
1752
- return __assign({}, validLink);
1888
+ var _a, _b, _c;
1889
+ var color = resolveColor(extractedLinkColors, index, validLink.target, colorMap, (_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, isDarkTheme);
1890
+ return __assign(__assign({}, validLink), { color: color });
1753
1891
  }),
1754
1892
  };
1755
1893
  var styles = {
1756
- root: __assign({}, (((_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.font) === null || _g === void 0 ? void 0 : _g.size) ? { fontSize: (_h = input.layout.font) === null || _h === void 0 ? void 0 : _h.size } : {})),
1894
+ root: __assign({}, (((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.font) === null || _k === void 0 ? void 0 : _k.size) ? { fontSize: (_l = input.layout.font) === null || _l === void 0 ? void 0 : _l.size } : {})),
1757
1895
  };
1758
1896
  var chartTitle = getTitles(input.layout).chartTitle;
1759
1897
  return {
@@ -1761,8 +1899,8 @@ colorMap, colorwayType, isDarkTheme) {
1761
1899
  chartTitle: chartTitle,
1762
1900
  SankeyChartData: sankeyChartData,
1763
1901
  },
1764
- width: (_j = input.layout) === null || _j === void 0 ? void 0 : _j.width,
1765
- height: (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : 468,
1902
+ width: (_m = input.layout) === null || _m === void 0 ? void 0 : _m.width,
1903
+ height: (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : 468,
1766
1904
  styles: styles,
1767
1905
  enableReflow: false,
1768
1906
  };
@@ -2488,7 +2626,7 @@ var getIndexFromKey = function (key, pattern) {
2488
2626
  return parseInt(normalizedKey, 10) - 1;
2489
2627
  };
2490
2628
  export var isNonPlotType = function (chartType) {
2491
- return ['donut', 'sankey', 'pie', 'annotation'].includes(chartType);
2629
+ return ['donut', 'sankey', 'pie', 'annotation', 'table', 'gauge', 'funnel'].includes(chartType);
2492
2630
  };
2493
2631
  export var getGridProperties = function (schema, isMultiPlot, validTracesInfo) {
2494
2632
  var _a;