@fluentui/react-charts 9.3.6 → 9.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/CHANGELOG.md +46 -2
  2. package/dist/index.d.ts +70 -17
  3. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
  4. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
  6. package/lib/components/AreaChart/AreaChart.js +3 -43
  7. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  8. package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
  9. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  10. package/lib/components/ChartTable/ChartTable.js +8 -11
  11. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  12. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  13. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
  14. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  15. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
  16. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  17. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
  18. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  19. package/lib/components/CommonComponents/CartesianChart.js +52 -32
  20. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  21. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  22. package/lib/components/CommonComponents/ChartPopover.js +1 -2
  23. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  24. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +9 -7
  25. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  26. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +8 -5
  27. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  28. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  29. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
  30. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  31. package/lib/components/DeclarativeChart/DeclarativeChart.js +48 -25
  32. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -209
  34. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  35. package/lib/components/DonutChart/DonutChart.js +9 -15
  36. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  37. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  38. package/lib/components/DonutChart/Pie/Pie.js +4 -2
  39. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  40. package/lib/components/FunnelChart/FunnelChart.js +8 -13
  41. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  42. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  43. package/lib/components/GanttChart/GanttChart.js +4 -17
  44. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  45. package/lib/components/GaugeChart/GaugeChart.js +8 -13
  46. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  47. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  48. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +24 -36
  49. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  50. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
  51. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  52. package/lib/components/HeatMapChart/HeatMapChart.js +3 -16
  53. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  54. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +5 -25
  55. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  56. package/lib/components/Legends/Legends.js +3 -4
  57. package/lib/components/Legends/Legends.js.map +1 -1
  58. package/lib/components/Legends/Legends.types.js.map +1 -1
  59. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  60. package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  61. package/lib/components/LineChart/LineChart.js +68 -75
  62. package/lib/components/LineChart/LineChart.js.map +1 -1
  63. package/lib/components/LineChart/LineChart.types.js +1 -1
  64. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  65. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +3 -4
  66. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  67. package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
  68. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  69. package/lib/components/SankeyChart/SankeyChart.js +4 -10
  70. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  71. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  72. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +1 -2
  73. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  74. package/lib/components/ScatterChart/ScatterChart.js +41 -49
  75. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  76. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  77. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
  78. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  79. package/lib/components/Sparkline/Sparkline.js +11 -7
  80. package/lib/components/Sparkline/Sparkline.js.map +1 -1
  81. package/lib/components/VerticalBarChart/VerticalBarChart.js +15 -92
  82. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  83. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
  84. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  85. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +28 -49
  86. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  87. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
  88. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  89. package/lib/types/ChartAnnotation.js.map +1 -1
  90. package/lib/types/DataPoint.js.map +1 -1
  91. package/lib/utilities/Common.styles.js +0 -1
  92. package/lib/utilities/Common.styles.js.map +1 -1
  93. package/lib/utilities/Common.styles.raw.js +0 -1
  94. package/lib/utilities/Common.styles.raw.js.map +1 -1
  95. package/lib/utilities/FocusableTooltipText.js +1 -1
  96. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  97. package/lib/utilities/getWindow.js +0 -1
  98. package/lib/utilities/getWindow.js.map +1 -1
  99. package/lib/utilities/hooks.js +34 -0
  100. package/lib/utilities/hooks.js.map +1 -0
  101. package/lib/utilities/image-export-utils.js +118 -78
  102. package/lib/utilities/image-export-utils.js.map +1 -1
  103. package/lib/utilities/utilities.js +243 -102
  104. package/lib/utilities/utilities.js.map +1 -1
  105. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
  106. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  107. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
  108. package/lib-commonjs/components/AreaChart/AreaChart.js +2 -41
  109. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  110. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
  111. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  112. package/lib-commonjs/components/ChartTable/ChartTable.js +9 -11
  113. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  114. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  115. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
  116. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  117. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
  118. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  119. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
  120. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  121. package/lib-commonjs/components/CommonComponents/CartesianChart.js +51 -31
  122. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  123. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  124. package/lib-commonjs/components/CommonComponents/ChartPopover.js +1 -2
  125. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  126. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -6
  127. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  128. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +7 -4
  129. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  130. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  131. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
  132. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  133. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +48 -25
  134. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  135. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -208
  136. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  137. package/lib-commonjs/components/DonutChart/DonutChart.js +7 -13
  138. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  139. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  140. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
  141. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  142. package/lib-commonjs/components/FunnelChart/FunnelChart.js +7 -12
  143. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  144. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  145. package/lib-commonjs/components/GanttChart/GanttChart.js +3 -16
  146. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  147. package/lib-commonjs/components/GaugeChart/GaugeChart.js +7 -12
  148. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  149. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  150. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -34
  151. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  152. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
  153. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  154. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -15
  155. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  156. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +4 -23
  157. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  158. package/lib-commonjs/components/Legends/Legends.js +3 -4
  159. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  160. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
  161. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  162. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  163. package/lib-commonjs/components/LineChart/LineChart.js +67 -74
  164. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  165. package/lib-commonjs/components/LineChart/LineChart.types.js +1 -1
  166. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  167. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +2 -2
  168. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  169. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
  170. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  171. package/lib-commonjs/components/SankeyChart/SankeyChart.js +4 -10
  172. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  173. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  174. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +0 -2
  175. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  176. package/lib-commonjs/components/ScatterChart/ScatterChart.js +38 -46
  177. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  178. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  179. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
  180. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  181. package/lib-commonjs/components/Sparkline/Sparkline.js +11 -7
  182. package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
  183. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +14 -91
  184. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  185. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
  186. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  187. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +26 -47
  188. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  189. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
  190. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  191. package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
  192. package/lib-commonjs/types/DataPoint.js.map +1 -1
  193. package/lib-commonjs/utilities/Common.styles.js +0 -1
  194. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  195. package/lib-commonjs/utilities/Common.styles.raw.js +0 -1
  196. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  197. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  198. package/lib-commonjs/utilities/getWindow.js +0 -1
  199. package/lib-commonjs/utilities/getWindow.js.map +1 -1
  200. package/lib-commonjs/utilities/hooks.js +45 -0
  201. package/lib-commonjs/utilities/hooks.js.map +1 -0
  202. package/lib-commonjs/utilities/image-export-utils.js +119 -79
  203. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  204. package/lib-commonjs/utilities/utilities.js +253 -101
  205. package/lib-commonjs/utilities/utilities.js.map +1 -1
  206. package/package.json +9 -9
  207. package/lib/components/DeclarativeChart/imageExporter.js +0 -223
  208. package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
  209. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
  210. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
@@ -88,6 +88,18 @@ const getYMinMaxValues = (series, layout)=>{
88
88
  }
89
89
  return {};
90
90
  };
91
+ const getXMinMaxValues = (series, layout)=>{
92
+ var _getXAxisProperties;
93
+ const range = (_getXAxisProperties = getXAxisProperties(series, layout)) === null || _getXAxisProperties === void 0 ? void 0 : _getXAxisProperties.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
  const getYAxisProperties = (series, layout)=>{
92
104
  return layout === null || layout === void 0 ? void 0 : layout.yaxis;
93
105
  };
@@ -205,6 +217,62 @@ export const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNum
205
217
  }
206
218
  return x;
207
219
  };
220
+ /**
221
+ * Formats text values according to the texttemplate specification
222
+ * Supports D3 format specifiers within %{text:format} patterns
223
+ * @param textValue The raw text value to format
224
+ * @param textTemplate The template string (e.g., "%{text:.1f}%", "%{text:.2%}", "%{text:,.0f}")
225
+ * @param index Optional index for array-based templates
226
+ * @returns Formatted text string
227
+ *
228
+ * Examples:
229
+ * - "%{text:.1f}%" → Formats number with 1 decimal place and adds % suffix
230
+ * - "%{text:.2%}" → Formats as percentage with 2 decimal places
231
+ * - "%{text:,.0f}" → Formats with thousands separator and no decimals
232
+ * - "%{text:$,.2f}" → Formats as currency with thousands separator and 2 decimals
233
+ */ const formatTextWithTemplate = (textValue, textTemplate, index)=>{
234
+ if (!textTemplate) {
235
+ return String(textValue);
236
+ }
237
+ const numVal = typeof textValue === 'number' ? textValue : parseFloat(String(textValue));
238
+ if (isNaN(numVal)) {
239
+ return String(textValue);
240
+ }
241
+ const template = typeof textTemplate === 'string' ? textTemplate : textTemplate[index || 0] || '';
242
+ // Match Plotly's texttemplate pattern: %{text:format} or %{text}
243
+ // Can be followed by any literal text like %, $, etc.
244
+ const plotlyPattern = /%\{text(?::([^}]+))?\}(.*)$/;
245
+ const match = template.match(plotlyPattern);
246
+ if (match) {
247
+ const formatSpec = match[1]; // The format specifier (e.g., ".1f", ".2%", ",.0f") or undefined
248
+ const suffix = match[2]; // Any text after the closing brace (e.g., "%", " units")
249
+ // If no format specifier is provided (e.g., %{text}%), try to infer from suffix
250
+ if (!formatSpec) {
251
+ // Check if suffix starts with % - assume simple percentage with 1 decimal
252
+ if (suffix.startsWith('%')) {
253
+ return `${numVal.toFixed(1)}${suffix}`;
254
+ }
255
+ // No format specifier, just return the number with the suffix
256
+ return `${numVal}${suffix}`;
257
+ }
258
+ try {
259
+ // Use D3 format function to apply the format specifier
260
+ const formatter = d3Format(formatSpec);
261
+ const formattedValue = formatter(numVal);
262
+ return `${formattedValue}${suffix}`;
263
+ } catch (error) {
264
+ // Try to extract precision for basic fallback
265
+ const precisionMatch = formatSpec.match(/\.(\d+)[f%]/);
266
+ const precision = precisionMatch ? parseInt(precisionMatch[1], 10) : 2;
267
+ // Check if it's a percentage format
268
+ if (formatSpec.includes('%')) {
269
+ return `${(numVal * 100).toFixed(precision)}%${suffix}`;
270
+ }
271
+ return `${numVal.toFixed(precision)}${suffix}`;
272
+ }
273
+ }
274
+ return String(textValue);
275
+ };
208
276
  /**
209
277
  * Extracts unique X-axis categories from Plotly data traces
210
278
  * @param data Array of Plotly data traces
@@ -269,62 +337,6 @@ const toFiniteNumber = (value)=>{
269
337
  const numeric = typeof value === 'number' ? value : Number(value);
270
338
  return Number.isFinite(numeric) ? numeric : undefined;
271
339
  };
272
- /**
273
- * Normalizes Plotly axis reference strings so equivalent aliases (e.g. `xaxis1`, `x1`) collapse to the base axis id.
274
- */ const normalizeAxisRef = (ref, axis)=>{
275
- if (!ref) {
276
- return axis;
277
- }
278
- const normalized = ref.toLowerCase();
279
- if (normalized === axis || normalized === `${axis}axis` || normalized === `${axis}axis1` || normalized === `${axis}1`) {
280
- return axis;
281
- }
282
- const match = normalized.match(/^([xy])(axis)?(\d+)$/);
283
- if (match && match[1] === axis && match[3]) {
284
- return match[3] === '1' ? axis : `${axis}${match[3]}`;
285
- }
286
- return normalized;
287
- };
288
- /**
289
- * Scans the data traces bound to a given axis and returns the numeric min/max values plotted on that axis.
290
- */ const getAxisNumericRangeFromData = (axis, ref, layout, data)=>{
291
- if (!data || data.length === 0) {
292
- return undefined;
293
- }
294
- const axisLayout = getAxisLayoutByRef(layout, ref, axis);
295
- const targetRef = normalizeAxisRef(ref, axis);
296
- const traceAxisKey = axis === 'x' ? 'xaxis' : 'yaxis';
297
- let minValue;
298
- let maxValue;
299
- data.forEach((trace)=>{
300
- const plotTrace = trace;
301
- const traceAxisRef = normalizeAxisRef(plotTrace[traceAxisKey], axis);
302
- if (traceAxisRef !== targetRef) {
303
- return;
304
- }
305
- const values = axis === 'x' ? plotTrace.x : plotTrace.y;
306
- if (!isArrayOrTypedArray(values)) {
307
- return;
308
- }
309
- const arrayLike = values;
310
- for(let index = 0; index < arrayLike.length; index++){
311
- const value = arrayLike[index];
312
- const numeric = toNumericValue(convertDataValue(value, axisLayout));
313
- if (numeric === undefined || Number.isNaN(numeric)) {
314
- continue;
315
- }
316
- minValue = minValue === undefined ? numeric : Math.min(minValue, numeric);
317
- maxValue = maxValue === undefined ? numeric : Math.max(maxValue, numeric);
318
- }
319
- });
320
- if (minValue === undefined || maxValue === undefined || minValue === maxValue) {
321
- return undefined;
322
- }
323
- return [
324
- minValue,
325
- maxValue
326
- ];
327
- };
328
340
  /**
329
341
  * Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
330
342
  */ const transformRelativeYForChart = (value)=>{
@@ -425,49 +437,32 @@ const appendPx = (value)=>{
425
437
  if (value === undefined || value === null) {
426
438
  return undefined;
427
439
  }
428
- if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'date' || isDate(value)) {
440
+ const axisType = axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type;
441
+ if (axisType === 'date') {
429
442
  const dateValue = value instanceof Date ? value : new Date(value);
430
443
  return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
431
444
  }
432
- if (typeof value === 'number') {
433
- return value;
434
- }
435
- if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'linear' || (axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'log') {
436
- const numeric = Number(value);
437
- return Number.isFinite(numeric) ? numeric : undefined;
438
- }
439
445
  if (value instanceof Date) {
440
- return value;
441
- }
442
- return value;
443
- };
444
- const toNumericValue = (value)=>{
445
- if (value instanceof Date) {
446
- const timestamp = value.getTime();
447
- return Number.isFinite(timestamp) ? timestamp : undefined;
446
+ return Number.isNaN(value.getTime()) ? undefined : value;
448
447
  }
449
448
  if (typeof value === 'number') {
450
449
  return Number.isFinite(value) ? value : undefined;
451
450
  }
452
- if (typeof value === 'string') {
451
+ if (axisType === 'linear' || axisType === 'log') {
453
452
  const numeric = Number(value);
454
453
  return Number.isFinite(numeric) ? numeric : undefined;
455
454
  }
456
- return undefined;
457
- };
458
- const toRelativeCoordinate = (value, axisLayout, fallbackRange)=>{
459
- const range = Array.isArray(axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.range) ? axisLayout.range : undefined;
460
- let start = range && range.length >= 2 ? toNumericValue(convertDataValue(range[0], axisLayout)) : undefined;
461
- let end = range && range.length >= 2 ? toNumericValue(convertDataValue(range[1], axisLayout)) : undefined;
462
- if ((start === undefined || end === undefined || start === end) && fallbackRange) {
463
- [start, end] = fallbackRange;
464
- }
465
- const current = toNumericValue(convertDataValue(value, axisLayout));
466
- if (start === undefined || end === undefined || current === undefined || start === end) {
467
- return undefined;
455
+ if (typeof value === 'string') {
456
+ const shouldTryParseDate = axisType === undefined || axisType === '-' || axisType === null;
457
+ if (shouldTryParseDate && isDate(value)) {
458
+ const parsedDate = new Date(value);
459
+ if (!Number.isNaN(parsedDate.getTime()) && parsedDate.getFullYear() >= 1900) {
460
+ return parsedDate;
461
+ }
462
+ }
463
+ return value;
468
464
  }
469
- const relative = (current - start) / (end - start);
470
- return Number.isFinite(relative) ? relative : undefined;
465
+ return value;
471
466
  };
472
467
  const createAnnotationId = (text, index)=>{
473
468
  const normalized = text.replace(/\s+/g, ' ').trim();
@@ -532,10 +527,35 @@ const mapArrowDashToPattern = (value)=>{
532
527
  return value;
533
528
  }
534
529
  };
530
+ const mapRefTypeToCoordinateType = (refType)=>{
531
+ return refType === 'axis' ? 'data' : refType;
532
+ };
533
+ const normalizeCoordinateValueForType = (coordinateType, value)=>{
534
+ if (coordinateType === 'data') {
535
+ return value;
536
+ }
537
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
538
+ };
539
+ const getAnnotationCoordinateValue = (axis, refType, annotation, layout)=>{
540
+ if (refType === 'axis') {
541
+ const axisRef = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.xref : annotation === null || annotation === void 0 ? void 0 : annotation.yref;
542
+ const axisLayout = getAxisLayoutByRef(layout, axisRef, axis);
543
+ const rawValue = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y;
544
+ return convertDataValue(rawValue, axisLayout);
545
+ }
546
+ const numericValue = toFiniteNumber(axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y);
547
+ if (numericValue === undefined) {
548
+ return undefined;
549
+ }
550
+ if (refType === 'relative') {
551
+ return axis === 'y' ? transformRelativeYForChart(numericValue) : numericValue;
552
+ }
553
+ return numericValue;
554
+ };
535
555
  /**
536
556
  * Converts a Plotly annotation definition into the internal `ChartAnnotation` format, translating coordinates,
537
557
  * layout alignment, styling, and connector metadata while skipping unsupported configurations.
538
- */ const convertPlotlyAnnotation = (annotation, layout, data, index)=>{
558
+ */ const convertPlotlyAnnotation = (annotation, layout, index)=>{
539
559
  if (!annotation || annotation.visible === false) {
540
560
  return undefined;
541
561
  }
@@ -544,77 +564,51 @@ const mapArrowDashToPattern = (value)=>{
544
564
  if (!xRefType || !yRefType) {
545
565
  return undefined;
546
566
  }
567
+ const xValue = getAnnotationCoordinateValue('x', xRefType, annotation, layout);
568
+ const yValue = getAnnotationCoordinateValue('y', yRefType, annotation, layout);
569
+ if (xValue === undefined || yValue === undefined) {
570
+ return undefined;
571
+ }
572
+ const xCoordinateType = mapRefTypeToCoordinateType(xRefType);
573
+ const yCoordinateType = mapRefTypeToCoordinateType(yRefType);
574
+ const normalizedX = normalizeCoordinateValueForType(xCoordinateType, xValue);
575
+ const normalizedY = normalizeCoordinateValueForType(yCoordinateType, yValue);
576
+ if (normalizedX === undefined || normalizedY === undefined) {
577
+ return undefined;
578
+ }
579
+ const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
580
+ const yAxisProps = yCoordinateType === 'data' && yRefNormalized === 'y2' ? {
581
+ yAxis: 'secondary'
582
+ } : undefined;
547
583
  let coordinates;
548
- if (xRefType === 'axis' && yRefType === 'axis') {
549
- const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
550
- const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
551
- const xValue = convertDataValue(annotation.x, xAxisLayout);
552
- const yValue = convertDataValue(annotation.y, yAxisLayout);
553
- if (xValue === undefined || yValue === undefined) {
554
- return undefined;
555
- }
556
- const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
584
+ if (xCoordinateType === 'data' && yCoordinateType === 'data') {
557
585
  coordinates = {
558
586
  type: 'data',
559
- x: xValue,
560
- y: yValue,
561
- ...yRefNormalized === 'y2' ? {
562
- yAxis: 'secondary'
563
- } : {}
587
+ x: normalizedX,
588
+ y: normalizedY,
589
+ ...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
564
590
  };
565
- } else if (xRefType === 'relative' && yRefType === 'relative') {
566
- const xValue = toFiniteNumber(annotation.x);
567
- const yValue = toFiniteNumber(annotation.y);
568
- const chartRelativeY = transformRelativeYForChart(yValue);
569
- if (xValue === undefined || chartRelativeY === undefined) {
570
- return undefined;
571
- }
591
+ } else if (xCoordinateType === 'relative' && yCoordinateType === 'relative') {
572
592
  coordinates = {
573
593
  type: 'relative',
574
- x: xValue,
575
- y: chartRelativeY
594
+ x: normalizedX,
595
+ y: normalizedY
576
596
  };
577
- } else if (xRefType === 'relative' && yRefType === 'axis') {
578
- const xValue = toFiniteNumber(annotation.x);
579
- const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
580
- const yFallbackRange = getAxisNumericRangeFromData('y', annotation.yref, layout, data);
581
- const yRelative = toRelativeCoordinate(annotation.y, yAxisLayout, yFallbackRange);
582
- const 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
- } else if (xRefType === 'axis' && yRefType === 'relative') {
592
- const yValue = toFiniteNumber(annotation.y);
593
- const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
594
- const xFallbackRange = getAxisNumericRangeFromData('x', annotation.xref, layout, data);
595
- const xRelative = toRelativeCoordinate(annotation.x, xAxisLayout, xFallbackRange);
596
- const chartRelativeY = transformRelativeYForChart(yValue);
597
- if (xRelative === undefined || chartRelativeY === undefined) {
598
- return undefined;
599
- }
600
- coordinates = {
601
- type: 'relative',
602
- x: xRelative,
603
- y: chartRelativeY
604
- };
605
- } else if (xRefType === 'pixel' && yRefType === 'pixel') {
606
- const xValue = toFiniteNumber(annotation.x);
607
- const yValue = toFiniteNumber(annotation.y);
608
- if (xValue === undefined || yValue === undefined) {
609
- return undefined;
610
- }
597
+ } else if (xCoordinateType === 'pixel' && yCoordinateType === 'pixel') {
611
598
  coordinates = {
612
599
  type: 'pixel',
613
- x: xValue,
614
- y: yValue
600
+ x: normalizedX,
601
+ y: normalizedY
615
602
  };
616
603
  } else {
617
- return undefined;
604
+ coordinates = {
605
+ type: 'mixed',
606
+ xCoordinateType,
607
+ yCoordinateType,
608
+ x: normalizedX,
609
+ y: normalizedY,
610
+ ...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
611
+ };
618
612
  }
619
613
  const textValue = annotation.text;
620
614
  const rawText = textValue === undefined || textValue === null ? '' : String(textValue);
@@ -771,14 +765,14 @@ const mapArrowDashToPattern = (value)=>{
771
765
  }
772
766
  return chartAnnotation;
773
767
  };
774
- const getChartAnnotationsFromLayout = (layout, data, isMultiPlot)=>{
768
+ const getChartAnnotationsFromLayout = (layout, isMultiPlot)=>{
775
769
  if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
776
770
  return undefined;
777
771
  }
778
772
  const annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [
779
773
  layout.annotations
780
774
  ];
781
- const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, layout, data, index)).filter((annotation)=>annotation !== undefined);
775
+ const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, layout, index)).filter((annotation)=>annotation !== undefined);
782
776
  return converted.length > 0 ? converted : undefined;
783
777
  };
784
778
  /**
@@ -860,7 +854,7 @@ const getChartAnnotationsFromLayout = (layout, data, isMultiPlot)=>{
860
854
  export const transformPlotlyJsonToAnnotationChartProps = (input, isMultiPlot, _colorMap, _colorwayType, _isDarkTheme)=>{
861
855
  var _layoutWithMeta_meta, _input_layout, _input_layout1, _input_layout2, _input_layout3, _input_layout_font, _input_layout4, _input_layout_font1, _input_layout5, _input_layout6;
862
856
  var _getChartAnnotationsFromLayout;
863
- const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
857
+ const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.layout, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
864
858
  const titles = getTitles(input.layout);
865
859
  const layoutTitle = titles.chartTitle || undefined;
866
860
  const layoutWithMeta = input.layout;
@@ -935,7 +929,8 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
935
929
  const hideLabels = firstData.textinfo ? ![
936
930
  'value',
937
931
  'percent',
938
- 'label+percent'
932
+ 'label+percent',
933
+ 'percent+label'
939
934
  ].includes(firstData.textinfo) : false;
940
935
  const donutMarginHorizontal = hideLabels ? 0 : 80;
941
936
  const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
@@ -968,14 +963,15 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
968
963
  hideLabels,
969
964
  showLabelsInPercent: firstData.textinfo ? [
970
965
  'percent',
971
- 'label+percent'
966
+ 'label+percent',
967
+ 'percent+label'
972
968
  ].includes(firstData.textinfo) : true,
973
969
  roundCorners: true,
974
970
  order: 'sorted'
975
971
  };
976
972
  };
977
973
  export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
978
- var _input_layout, _input_layout1, _input_layout2, _vsbcData_;
974
+ var _input_layout, _input_layout1, _input_layout2;
979
975
  const mapXToDataPoints = {};
980
976
  let yMaxValue = 0;
981
977
  let yMinValue = 0;
@@ -995,6 +991,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
995
991
  validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
996
992
  const rangeXValues = series.x.slice(rangeStart, rangeEnd);
997
993
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
994
+ const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : typeof series.text === 'string' ? series.text : undefined;
998
995
  rangeXValues.forEach((x, index2)=>{
999
996
  var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
1000
997
  if (!mapXToDataPoints[x]) {
@@ -1010,6 +1007,11 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1010
1007
  const opacity = getOpacity(series, index2);
1011
1008
  const yVal = rangeYValues[index2];
1012
1009
  const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
1010
+ let barLabel = Array.isArray(textValues) ? textValues[index2] : textValues;
1011
+ // Apply texttemplate formatting if specified
1012
+ if (barLabel && series.texttemplate) {
1013
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index2);
1014
+ }
1013
1015
  if (series.type === 'bar') {
1014
1016
  var _rgb_copy_formatHex8;
1015
1017
  mapXToDataPoints[x].chartData.push({
@@ -1018,7 +1020,10 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1018
1020
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
1019
1021
  opacity
1020
1022
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1021
- yAxisCalloutData
1023
+ yAxisCalloutData,
1024
+ ...barLabel ? {
1025
+ barLabel: String(barLabel)
1026
+ } : {}
1022
1027
  });
1023
1028
  if (typeof yVal === 'number') {
1024
1029
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -1116,7 +1121,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1116
1121
  }
1117
1122
  });
1118
1123
  const vsbcData = Object.values(mapXToDataPoints);
1119
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1124
+ const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1120
1125
  var _input_layout_height;
1121
1126
  return {
1122
1127
  data: vsbcData,
@@ -1127,7 +1132,6 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1127
1132
  yMinValue,
1128
1133
  mode: 'plotly',
1129
1134
  ...secondaryYAxisValues,
1130
- wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
1131
1135
  hideTickOverlap: true,
1132
1136
  barGapMax: 2,
1133
1137
  hideLegend,
@@ -1135,6 +1139,8 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1135
1139
  showYAxisLables: true,
1136
1140
  noOfCharsToTruncate: 20,
1137
1141
  showYAxisLablesTooltip: true,
1142
+ roundedTicks: true,
1143
+ ...getXMinMaxValues(input.data[0], input.layout),
1138
1144
  ...getTitles(input.layout),
1139
1145
  ...getXAxisTickFormat(input.data[0], input.layout),
1140
1146
  ...yAxisTickFormat,
@@ -1203,6 +1209,12 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1203
1209
  const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[xIndex % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedBarColors, xIndex, legend, colorMap, (_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : (_processedInput_layout_template = _processedInput_layout.template) === null || _processedInput_layout_template === void 0 ? void 0 : (_processedInput_layout_template_layout = _processedInput_layout_template.layout) === null || _processedInput_layout_template_layout === void 0 ? void 0 : _processedInput_layout_template_layout.colorway, isDarkTheme);
1204
1210
  const opacity = getOpacity(series, xIndex);
1205
1211
  const yVal = series.y[xIndex];
1212
+ // Extract text value for barLabel
1213
+ let barLabel = Array.isArray(series.text) ? series.text[xIndex] : series.text;
1214
+ // Apply texttemplate formatting if specified
1215
+ if (barLabel && series.texttemplate) {
1216
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, xIndex);
1217
+ }
1206
1218
  var _rgb_copy_formatHex8;
1207
1219
  return {
1208
1220
  x: x.toString(),
@@ -1210,7 +1222,10 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1210
1222
  yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
1211
1223
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
1212
1224
  opacity
1213
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
1225
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1226
+ ...barLabel ? {
1227
+ barLabel: String(barLabel)
1228
+ } : {}
1214
1229
  };
1215
1230
  }).filter((item)=>typeof item !== 'undefined'),
1216
1231
  useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
@@ -1251,7 +1266,7 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1251
1266
  });
1252
1267
  }
1253
1268
  });
1254
- const annotations = getChartAnnotationsFromLayout(processedInput.layout, processedInput.data, isMultiPlot);
1269
+ const annotations = getChartAnnotationsFromLayout(processedInput.layout, isMultiPlot);
1255
1270
  var _processedInput_layout_height;
1256
1271
  return {
1257
1272
  dataV2: gvbcDataV2,
@@ -1261,10 +1276,11 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1261
1276
  mode: 'plotly',
1262
1277
  ...secondaryYAxisValues,
1263
1278
  hideTickOverlap: true,
1264
- wrapXAxisLables: true,
1265
1279
  hideLegend,
1266
1280
  roundCorners: true,
1267
1281
  showYAxisLables: true,
1282
+ roundedTicks: true,
1283
+ ...getXMinMaxValues(processedInput.data[0], processedInput.layout),
1268
1284
  ...getTitles(processedInput.layout),
1269
1285
  ...getAxisCategoryOrderProps(processedInput.data, processedInput.layout),
1270
1286
  ...getYMinMaxValues(processedInput.data[0], processedInput.layout),
@@ -1278,7 +1294,7 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1278
1294
  };
1279
1295
  };
1280
1296
  export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1281
- var _input_layout, _input_layout1, _vbcData_;
1297
+ var _input_layout, _input_layout1;
1282
1298
  const vbcData = [];
1283
1299
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1284
1300
  let colorScale = undefined;
@@ -1325,6 +1341,11 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
1325
1341
  const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, index, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
1326
1342
  const opacity = getOpacity(series, index);
1327
1343
  const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
1344
+ // Handle text values and texttemplate formatting for histogram bins
1345
+ let barLabel = Array.isArray(series.text) ? series.text[index] : series.text;
1346
+ if (barLabel && series.texttemplate) {
1347
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index);
1348
+ }
1328
1349
  var _rgb_copy_formatHex8;
1329
1350
  vbcData.push({
1330
1351
  x: isXString ? bin.join(', ') : getBinCenter(bin),
@@ -1335,11 +1356,14 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
1335
1356
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1336
1357
  ...isXString ? {} : {
1337
1358
  xAxisCalloutData: `[${bin.x0} - ${bin.x1})`
1338
- }
1359
+ },
1360
+ ...barLabel ? {
1361
+ barLabel: String(barLabel)
1362
+ } : {}
1339
1363
  });
1340
1364
  });
1341
1365
  });
1342
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1366
+ const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1343
1367
  var _input_layout_height;
1344
1368
  return {
1345
1369
  data: vbcData,
@@ -1347,11 +1371,12 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
1347
1371
  height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
1348
1372
  mode: 'histogram',
1349
1373
  hideTickOverlap: true,
1350
- wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
1351
1374
  maxBarWidth: 50,
1352
1375
  hideLegend,
1353
1376
  roundCorners: true,
1354
1377
  showYAxisLables: true,
1378
+ roundedTicks: true,
1379
+ ...getXMinMaxValues(input.data[0], input.layout),
1355
1380
  ...getTitles(input.layout),
1356
1381
  ...getYMinMaxValues(input.data[0], input.layout),
1357
1382
  ...getAxisCategoryOrderProps(input.data, input.layout),
@@ -1408,9 +1433,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1408
1433
  let mode = 'tonexty';
1409
1434
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1410
1435
  const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
1411
- const xAxisType = getAxisType(input.data, getAxisObjects(input.data, input.layout).x);
1412
- const resolveXValue = getAxisValueResolver(xAxisType);
1413
- const shouldWrapLabels = xAxisType === 'category';
1436
+ const resolveXValue = getAxisValueResolver(getAxisType(input.data, getAxisObjects(input.data, input.layout).x));
1414
1437
  const chartData = input.data.map((series, index)=>{
1415
1438
  var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_mode1;
1416
1439
  const colors = isScatterMarkers ? (series === null || series === void 0 ? void 0 : (_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('line')) ? (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color : (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color : (_series_line1 = series.line) === null || _series_line1 === void 0 ? void 0 : _series_line1.color;
@@ -1559,7 +1582,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1559
1582
  ...lineShape
1560
1583
  ]
1561
1584
  };
1562
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1585
+ const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1563
1586
  var _input_layout_height;
1564
1587
  const commonProps = {
1565
1588
  supportNegativeData: true,
@@ -1569,9 +1592,10 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1569
1592
  hideTickOverlap: true,
1570
1593
  hideLegend,
1571
1594
  useUTC: false,
1572
- wrapXAxisLabels: shouldWrapLabels,
1573
1595
  optimizeLargeData: numDataPoints > 1000,
1574
1596
  showYAxisLables: true,
1597
+ roundedTicks: true,
1598
+ ...getXMinMaxValues(input.data[0], input.layout),
1575
1599
  ...getTitles(input.layout),
1576
1600
  ...getXAxisTickFormat(input.data[0], input.layout),
1577
1601
  ...yAxisTickFormat,
@@ -1590,7 +1614,6 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1590
1614
  } else {
1591
1615
  return {
1592
1616
  data: isScatterChart ? scatterChartProps : chartProps,
1593
- roundedTicks: true,
1594
1617
  ...commonProps,
1595
1618
  ...yMinMax,
1596
1619
  ...isScatterChart ? {
@@ -1658,6 +1681,8 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
1658
1681
  showYAxisLablesTooltip: true,
1659
1682
  hideLegend,
1660
1683
  roundCorners: true,
1684
+ roundedTicks: true,
1685
+ ...getXMinMaxValues(input.data[0], input.layout),
1661
1686
  ...getTitles(input.layout),
1662
1687
  ...getAxisCategoryOrderProps(input.data, input.layout),
1663
1688
  ...getBarProps(input.data, input.layout, true),
@@ -1685,14 +1710,14 @@ export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMa
1685
1710
  // extract colors for each series only once
1686
1711
  const extractedColors = extractColor((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
1687
1712
  series.y.forEach((yVal, i)=>{
1688
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_base, _series_x;
1713
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
1689
1714
  if (isInvalidValue(yVal)) {
1690
1715
  return;
1691
1716
  }
1692
1717
  // resolve color for each legend's bars from the colorscale or extracted colors
1693
1718
  const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, i, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
1694
1719
  const opacity = getOpacity(series, i);
1695
- const base = +resolveGanttXValue((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
1720
+ const base = +resolveGanttXValue(isArrayOrTypedArray(series.base) ? series.base[i] : series.base);
1696
1721
  const xVal = +resolveGanttXValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
1697
1722
  var _rgb_copy_formatHex8;
1698
1723
  ganttData.push({
@@ -1747,11 +1772,53 @@ export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMa
1747
1772
  };
1748
1773
  };
1749
1774
  export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1750
- var _input_layout, _input_layout_coloraxis, _input_layout1, _input_layout_template_layout, _input_layout_template, _input_layout2, _input_layout_template_data_histogram2d_, _input_layout_template_data_histogram2d, _input_layout_template_data, _input_layout_template1, _input_layout3, _input_layout_template_data_heatmap_, _input_layout_template_data_heatmap, _input_layout_template_data1, _input_layout_template2, _input_layout4, _input_layout5, _input_layout6;
1775
+ var _input_layout, _input_layout1, _input_layout_coloraxis, _input_layout2, _input_layout_template_layout, _input_layout_template, _input_layout3, _input_layout_template_data_histogram2d_, _input_layout_template_data_histogram2d, _input_layout_template_data, _input_layout_template1, _input_layout4, _input_layout_template_data_heatmap_, _input_layout_template_data_heatmap, _input_layout_template_data1, _input_layout_template2, _input_layout5, _input_layout6, _input_layout7;
1751
1776
  const firstData = input.data[0];
1752
1777
  const heatmapDataPoints = [];
1753
1778
  let zMin = Number.POSITIVE_INFINITY;
1754
1779
  let zMax = Number.NEGATIVE_INFINITY;
1780
+ // Build a 2D array of annotations based on their grid position
1781
+ const annotationGrid = [];
1782
+ const rawAnnotations = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.annotations;
1783
+ if (rawAnnotations) {
1784
+ const annotationsArray = Array.isArray(rawAnnotations) ? rawAnnotations : [
1785
+ rawAnnotations
1786
+ ];
1787
+ // Collect all unique x and y values from valid annotations
1788
+ const xSet = new Set();
1789
+ const ySet = new Set();
1790
+ const validAnnotations = [];
1791
+ annotationsArray.forEach((a)=>{
1792
+ if (a && typeof a.x === 'number' && typeof a.y === 'number' && typeof a.text === 'string' && (a.xref === 'x' || a.xref === undefined) && (a.yref === 'y' || a.yref === undefined)) {
1793
+ xSet.add(a.x);
1794
+ ySet.add(a.y);
1795
+ validAnnotations.push({
1796
+ x: a.x,
1797
+ y: a.y,
1798
+ text: cleanText(a.text)
1799
+ });
1800
+ }
1801
+ });
1802
+ if (validAnnotations.length > 0) {
1803
+ // Get sorted unique x and y values
1804
+ const xValues = Array.from(xSet).sort((a, b)=>a - b);
1805
+ const yValues = Array.from(ySet).sort((a, b)=>a - b);
1806
+ // Initialize 2D grid and populate
1807
+ validAnnotations.forEach((annotation)=>{
1808
+ const xIdx = xValues.indexOf(annotation.x);
1809
+ const yIdx = yValues.indexOf(annotation.y);
1810
+ if (!annotationGrid[yIdx]) {
1811
+ annotationGrid[yIdx] = [];
1812
+ }
1813
+ annotationGrid[yIdx][xIdx] = annotation.text;
1814
+ });
1815
+ }
1816
+ }
1817
+ // Helper function to get annotation from 2D grid by index
1818
+ const getAnnotationByIndex = (xIdx, yIdx)=>{
1819
+ var _annotationGrid_yIdx;
1820
+ return (_annotationGrid_yIdx = annotationGrid[yIdx]) === null || _annotationGrid_yIdx === void 0 ? void 0 : _annotationGrid_yIdx[xIdx];
1821
+ };
1755
1822
  if (firstData.type === 'histogram2d') {
1756
1823
  var _firstData_x, _firstData_xbins, _firstData_xbins1, _firstData_xbins2, _firstData_ybins, _firstData_ybins1, _firstData_ybins2;
1757
1824
  const xValues = [];
@@ -1791,11 +1858,12 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1791
1858
  xBins.forEach((xBin, xIdx)=>{
1792
1859
  yBins.forEach((yBin, yIdx)=>{
1793
1860
  const zVal = calculateHistNorm(firstData.histnorm, z[yIdx][xIdx], total, isXString ? xBin.length : getBinSize(xBin), isYString ? yBin.length : getBinSize(yBin));
1861
+ const annotationText = getAnnotationByIndex(xIdx, yIdx);
1794
1862
  heatmapDataPoints.push({
1795
1863
  x: isXString ? xBin.join(', ') : getBinCenter(xBin),
1796
1864
  y: isYString ? yBin.join(', ') : getBinCenter(yBin),
1797
1865
  value: zVal,
1798
- rectText: zVal
1866
+ rectText: annotationText || zVal
1799
1867
  });
1800
1868
  if (typeof zVal === 'number') {
1801
1869
  zMin = Math.min(zMin, zVal);
@@ -1804,18 +1872,34 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1804
1872
  });
1805
1873
  });
1806
1874
  } else {
1807
- var _firstData_x1;
1808
- (_firstData_x1 = firstData.x) === null || _firstData_x1 === void 0 ? void 0 : _firstData_x1.forEach((xVal, xIdx)=>{
1809
- var // eslint-disable-next-line @typescript-eslint/no-explicit-any
1810
- _firstData_y;
1811
- (_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y.forEach((yVal, yIdx)=>{
1812
- var _firstData_z_yIdx, _firstData_z, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
1813
- const zVal = (_firstData_z = firstData.z) === null || _firstData_z === void 0 ? void 0 : (_firstData_z_yIdx = _firstData_z[yIdx]) === null || _firstData_z_yIdx === void 0 ? void 0 : _firstData_z_yIdx[xIdx];
1875
+ var _zArray_;
1876
+ // If x and y are not provided, generate indices based on z dimensions
1877
+ const zArray = firstData.z;
1878
+ const xValues = firstData.x;
1879
+ const yValues = firstData.y;
1880
+ var _zArray_length;
1881
+ // Determine the dimensions from z array
1882
+ const yLength = (_zArray_length = zArray === null || zArray === void 0 ? void 0 : zArray.length) !== null && _zArray_length !== void 0 ? _zArray_length : 0;
1883
+ var _zArray__length;
1884
+ const xLength = (_zArray__length = zArray === null || zArray === void 0 ? void 0 : (_zArray_ = zArray[0]) === null || _zArray_ === void 0 ? void 0 : _zArray_.length) !== null && _zArray__length !== void 0 ? _zArray__length : 0;
1885
+ // Use provided x/y values or generate indices
1886
+ const xData = xValues !== null && xValues !== void 0 ? xValues : Array.from({
1887
+ length: xLength
1888
+ }, (_, i)=>i);
1889
+ const yData = yValues !== null && yValues !== void 0 ? yValues : Array.from({
1890
+ length: yLength
1891
+ }, (_, i)=>yLength - 1 - i);
1892
+ xData.forEach((xVal, xIdx)=>{
1893
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1894
+ yData.forEach((yVal, yIdx)=>{
1895
+ var _zArray_yIdx, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
1896
+ const zVal = zArray === null || zArray === void 0 ? void 0 : (_zArray_yIdx = zArray[yIdx]) === null || _zArray_yIdx === void 0 ? void 0 : _zArray_yIdx[xIdx];
1897
+ const annotationText = getAnnotationByIndex(xIdx, yIdx);
1814
1898
  heatmapDataPoints.push({
1815
1899
  x: ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_xaxis = _input_layout.xaxis) === null || _input_layout_xaxis === void 0 ? void 0 : _input_layout_xaxis.type) === 'date' ? xVal : xVal !== null && xVal !== void 0 ? xVal : 0,
1816
1900
  y: ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_yaxis = _input_layout1.yaxis) === null || _input_layout_yaxis === void 0 ? void 0 : _input_layout_yaxis.type) === 'date' ? yVal : yVal,
1817
1901
  value: zVal,
1818
- rectText: zVal
1902
+ rectText: annotationText || zVal
1819
1903
  });
1820
1904
  if (typeof zVal === 'number') {
1821
1905
  zMin = Math.min(zMin, zVal);
@@ -1842,7 +1926,7 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1842
1926
  getColorFromToken(DataVizPalette.color3)
1843
1927
  ];
1844
1928
  var _firstData_colorscale, _ref, _ref1, _ref2, _ref3;
1845
- let colorscale = (_ref3 = (_ref2 = (_ref1 = (_ref = (_firstData_colorscale = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _firstData_colorscale !== void 0 ? _firstData_colorscale : (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.colorscale) !== null && _ref !== void 0 ? _ref : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout1.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : _input_layout_coloraxis.colorscale) !== null && _ref1 !== void 0 ? _ref1 : (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template = _input_layout2.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorscale) !== null && _ref2 !== void 0 ? _ref2 : firstData.type === 'histogram2d' && ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_template1 = _input_layout3.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template1.data) === null || _input_layout_template_data === void 0 ? void 0 : (_input_layout_template_data_histogram2d = _input_layout_template_data.histogram2d) === null || _input_layout_template_data_histogram2d === void 0 ? void 0 : (_input_layout_template_data_histogram2d_ = _input_layout_template_data_histogram2d[0]) === null || _input_layout_template_data_histogram2d_ === void 0 ? void 0 : _input_layout_template_data_histogram2d_.colorscale)) !== null && _ref3 !== void 0 ? _ref3 : (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_template2 = _input_layout4.template) === null || _input_layout_template2 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template2.data) === null || _input_layout_template_data1 === void 0 ? void 0 : (_input_layout_template_data_heatmap = _input_layout_template_data1.heatmap) === null || _input_layout_template_data_heatmap === void 0 ? void 0 : (_input_layout_template_data_heatmap_ = _input_layout_template_data_heatmap[0]) === null || _input_layout_template_data_heatmap_ === void 0 ? void 0 : _input_layout_template_data_heatmap_.colorscale;
1929
+ let colorscale = (_ref3 = (_ref2 = (_ref1 = (_ref = (_firstData_colorscale = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _firstData_colorscale !== void 0 ? _firstData_colorscale : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.colorscale) !== null && _ref !== void 0 ? _ref : (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout2.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : _input_layout_coloraxis.colorscale) !== null && _ref1 !== void 0 ? _ref1 : (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_template = _input_layout3.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorscale) !== null && _ref2 !== void 0 ? _ref2 : firstData.type === 'histogram2d' && ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_template1 = _input_layout4.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template1.data) === null || _input_layout_template_data === void 0 ? void 0 : (_input_layout_template_data_histogram2d = _input_layout_template_data.histogram2d) === null || _input_layout_template_data_histogram2d === void 0 ? void 0 : (_input_layout_template_data_histogram2d_ = _input_layout_template_data_histogram2d[0]) === null || _input_layout_template_data_histogram2d_ === void 0 ? void 0 : _input_layout_template_data_histogram2d_.colorscale)) !== null && _ref3 !== void 0 ? _ref3 : (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template2 = _input_layout5.template) === null || _input_layout_template2 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template2.data) === null || _input_layout_template_data1 === void 0 ? void 0 : (_input_layout_template_data_heatmap = _input_layout_template_data1.heatmap) === null || _input_layout_template_data_heatmap === void 0 ? void 0 : (_input_layout_template_data_heatmap_ = _input_layout_template_data_heatmap[0]) === null || _input_layout_template_data_heatmap_ === void 0 ? void 0 : _input_layout_template_data_heatmap_.colorscale;
1846
1930
  // determine if the types diverging, sequential or sequentialminus are present in colorscale
1847
1931
  if (colorscale && typeof colorscale === 'object' && ('diverging' in colorscale || 'sequential' in colorscale || 'sequentialminus' in colorscale)) {
1848
1932
  const isDivergent = zMin < 0 && zMax > 0; // Data spans both positive and negative values
@@ -1868,12 +1952,11 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1868
1952
  hideLegend: true,
1869
1953
  showYAxisLables: true,
1870
1954
  sortOrder: 'none',
1871
- width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
1872
- height: (_input_layout_height = (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
1955
+ width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
1956
+ height: (_input_layout_height = (_input_layout7 = input.layout) === null || _input_layout7 === void 0 ? void 0 : _input_layout7.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
1873
1957
  hideTickOverlap: true,
1874
1958
  noOfCharsToTruncate: 20,
1875
1959
  showYAxisLablesTooltip: true,
1876
- wrapXAxisLables: true,
1877
1960
  ...getTitles(input.layout),
1878
1961
  ...getAxisCategoryOrderProps([
1879
1962
  firstData
@@ -1882,7 +1965,7 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1882
1965
  };
1883
1966
  };
1884
1967
  export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1885
- var _input_layout_template_layout, _input_layout_template, _input_layout, _node_label, _input_layout1, _input_layout2;
1968
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _node_label, _input_layout2, _input_layout3;
1886
1969
  const { link, node } = input.data[0];
1887
1970
  var _link_value;
1888
1971
  const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>{
@@ -1898,6 +1981,7 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
1898
1981
  })// Filter out negative nodes, unequal nodes and self-references (circular links)
1899
1982
  .filter((x)=>x !== null && x.source >= 0 && x.target >= 0 && x.source !== x.target);
1900
1983
  const extractedNodeColors = extractColor((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, node === null || node === void 0 ? void 0 : node.color, colorMap, isDarkTheme);
1984
+ const extractedLinkColors = extractColor((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, link === null || link === void 0 ? void 0 : link.color, colorMap, isDarkTheme);
1901
1985
  const sankeyChartData = {
1902
1986
  nodes: (_node_label = node.label) === null || _node_label === void 0 ? void 0 : _node_label.map((label, index)=>{
1903
1987
  var _input_layout_template_layout, _input_layout_template, _input_layout;
@@ -1910,8 +1994,11 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
1910
1994
  }),
1911
1995
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1912
1996
  links: validLinks.map((validLink, index)=>{
1997
+ var _input_layout_template_layout, _input_layout_template, _input_layout;
1998
+ const color = resolveColor(extractedLinkColors, index, validLink.target, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
1913
1999
  return {
1914
- ...validLink
2000
+ ...validLink,
2001
+ color
1915
2002
  };
1916
2003
  })
1917
2004
  };
@@ -1927,8 +2014,8 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
1927
2014
  chartTitle,
1928
2015
  SankeyChartData: sankeyChartData
1929
2016
  },
1930
- width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
1931
- height: (_input_layout_height = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468
2017
+ width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
2018
+ height: (_input_layout_height = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468
1932
2019
  };
1933
2020
  };
1934
2021
  export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -2616,23 +2703,25 @@ export const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, i
2616
2703
  if (toShowLegend) {
2617
2704
  input.data.forEach((series, index)=>{
2618
2705
  if (traceInfo[index].type === 'donut') {
2619
- var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker, _pieSeries_labels;
2706
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker;
2620
2707
  const pieSeries = series;
2621
2708
  var _input_layout_piecolorway, _input_layout_piecolorway1;
2622
2709
  const colors = extractColor((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : pieSeries === null || pieSeries === void 0 ? void 0 : (_pieSeries_marker = pieSeries.marker) === null || _pieSeries_marker === void 0 ? void 0 : _pieSeries_marker.colors, colorMap, isDarkTheme, true);
2623
- (_pieSeries_labels = pieSeries.labels) === null || _pieSeries_labels === void 0 ? void 0 : _pieSeries_labels.forEach((label, labelIndex)=>{
2624
- var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1;
2625
- const legend = `${label}`;
2626
- var _input_layout_piecolorway;
2627
- // resolve color for each legend from the extracted colors
2628
- const color = resolveColor(colors, labelIndex, legend, colorMap, (_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme, true);
2629
- if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
2630
- allupLegends.push({
2631
- title: legend,
2632
- color
2633
- });
2634
- }
2635
- });
2710
+ if (isArrayOrTypedArray(pieSeries.labels)) {
2711
+ pieSeries.labels.forEach((label, labelIndex)=>{
2712
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1;
2713
+ const legend = `${label}`;
2714
+ var _input_layout_piecolorway;
2715
+ // resolve color for each legend from the extracted colors
2716
+ const color = resolveColor(colors, labelIndex, legend, colorMap, (_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme, true);
2717
+ if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
2718
+ allupLegends.push({
2719
+ title: legend,
2720
+ color
2721
+ });
2722
+ }
2723
+ });
2724
+ }
2636
2725
  } else if (isNonPlotType(traceInfo[index].type) === false) {
2637
2726
  var _plotSeries_line, _plotSeries_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout3;
2638
2727
  const plotSeries = series;
@@ -2717,7 +2806,10 @@ export const isNonPlotType = (chartType)=>{
2717
2806
  'donut',
2718
2807
  'sankey',
2719
2808
  'pie',
2720
- 'annotation'
2809
+ 'annotation',
2810
+ 'table',
2811
+ 'gauge',
2812
+ 'funnel'
2721
2813
  ].includes(chartType);
2722
2814
  };
2723
2815
  export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
@@ -2903,7 +2995,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2903
2995
  }
2904
2996
  const isValidArray = isArrayOrTypedArray(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
2905
2997
  if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
2906
- result[propName] = ax.categoryarray;
2998
+ result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? ax.categoryarray.slice().reverse() : ax.categoryarray;
2907
2999
  return;
2908
3000
  }
2909
3001
  if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
@@ -2980,16 +3072,23 @@ const getAxisScaleTypeProps = (data, layout)=>{
2980
3072
  return;
2981
3073
  }
2982
3074
  const axType = getAxisType(data, ax);
3075
+ if (axId === 'x' && axType === 'category') {
3076
+ props.xAxis = {
3077
+ tickLayout: 'auto'
3078
+ };
3079
+ }
2983
3080
  if ((!ax.tickmode || ax.tickmode === 'array') && isArrayOrTypedArray(ax.tickvals)) {
2984
3081
  const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
2985
3082
  if (axId === 'x') {
2986
3083
  props.tickValues = tickValues;
2987
3084
  props.xAxis = {
3085
+ ...props.xAxis,
2988
3086
  tickText: ax.ticktext
2989
3087
  };
2990
3088
  } else if (axId === 'y') {
2991
3089
  props.yAxisTickValues = tickValues;
2992
3090
  props.yAxis = {
3091
+ ...props.yAxis,
2993
3092
  tickText: ax.ticktext
2994
3093
  };
2995
3094
  }
@@ -3000,11 +3099,13 @@ const getAxisScaleTypeProps = (data, layout)=>{
3000
3099
  const tick0 = plotlyTick0(ax.tick0, axType, dtick);
3001
3100
  if (axId === 'x') {
3002
3101
  props.xAxis = {
3102
+ ...props.xAxis,
3003
3103
  tickStep: dtick,
3004
3104
  tick0
3005
3105
  };
3006
3106
  } else if (axId === 'y') {
3007
3107
  props.yAxis = {
3108
+ ...props.yAxis,
3008
3109
  tickStep: dtick,
3009
3110
  tick0
3010
3111
  };
@@ -3117,9 +3218,8 @@ const getAxisType = (data, ax)=>{
3117
3218
  const values = [];
3118
3219
  data.forEach((series)=>{
3119
3220
  const axId = series[`${axLetter}axis`];
3120
- if (axId === ax._id || !axId && ax._id === axLetter) {
3121
- var _series_axLetter;
3122
- (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
3221
+ if ((axId === ax._id || !axId && ax._id === axLetter) && isArrayOrTypedArray(series[axLetter])) {
3222
+ series[axLetter].forEach((val)=>{
3123
3223
  if (!isInvalidValue(val)) {
3124
3224
  values.push(val);
3125
3225
  }