@fluentui/react-charts 0.0.0-nightly-20250819-0407.1 → 0.0.0-nightly-20250821-0406.1

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 (135) hide show
  1. package/CHANGELOG.md +15 -15
  2. package/dist/index.d.ts +9 -1
  3. package/lib/components/AreaChart/AreaChart.js +4 -1
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -1
  6. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  7. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
  8. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  9. package/lib/components/CommonComponents/CartesianChart.js +48 -3
  10. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  11. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  12. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
  13. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  14. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
  15. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  16. package/lib/components/DeclarativeChart/DeclarativeChart.js +175 -120
  17. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  18. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +6 -1
  19. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  20. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +346 -52
  21. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  22. package/lib/components/GanttChart/useGanttChartStyles.styles.js +2 -1
  23. package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  24. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
  25. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  26. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +23 -4
  27. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  28. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
  29. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  30. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
  31. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  32. package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
  33. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  34. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
  35. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  36. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
  37. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  38. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
  39. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  40. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
  41. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  42. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
  43. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  44. package/lib/components/LineChart/useLineChartStyles.styles.js +2 -1
  45. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  46. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +2 -1
  47. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  48. package/lib/components/ScatterChart/ScatterChart.js +49 -30
  49. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  50. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  51. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +21 -4
  52. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  53. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +16 -3
  54. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  55. package/lib/components/VerticalBarChart/VerticalBarChart.js +27 -4
  56. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  57. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
  58. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  59. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
  60. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  61. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +61 -44
  62. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  63. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
  64. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  65. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
  66. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  67. package/lib/utilities/utilities.js +0 -29
  68. package/lib/utilities/utilities.js.map +1 -1
  69. package/lib-commonjs/components/AreaChart/AreaChart.js +4 -1
  70. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  71. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
  72. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  73. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
  74. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  75. package/lib-commonjs/components/CommonComponents/CartesianChart.js +48 -3
  76. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  77. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  78. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
  79. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  80. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
  81. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  82. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +171 -118
  83. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  84. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +9 -1
  85. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  86. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +362 -58
  87. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  88. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +2 -1
  89. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  90. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
  91. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  92. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -3
  93. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  94. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
  95. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  96. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
  97. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  98. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
  99. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  100. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
  101. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  102. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
  103. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  104. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
  105. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  106. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
  107. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  108. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
  109. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  110. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +2 -1
  111. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  112. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +2 -1
  113. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  114. package/lib-commonjs/components/ScatterChart/ScatterChart.js +49 -30
  115. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  116. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  117. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +30 -3
  118. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  119. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +15 -2
  120. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  121. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +26 -3
  122. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  123. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
  124. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  125. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
  126. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  127. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +60 -43
  128. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  129. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
  130. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  131. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
  132. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  133. package/lib-commonjs/utilities/utilities.js +0 -32
  134. package/lib-commonjs/utilities/utilities.js.map +1 -1
  135. package/package.json +12 -12
@@ -18,21 +18,27 @@ _export(exports, {
18
18
  findArrayAttributes: function() {
19
19
  return findArrayAttributes;
20
20
  },
21
+ getAllupLegendsProps: function() {
22
+ return getAllupLegendsProps;
23
+ },
24
+ getGridProperties: function() {
25
+ return getGridProperties;
26
+ },
21
27
  getNumberAtIndexOrDefault: function() {
22
28
  return getNumberAtIndexOrDefault;
23
29
  },
24
30
  getValidXYRanges: function() {
25
31
  return getValidXYRanges;
26
32
  },
27
- isStringArray: function() {
28
- return isStringArray;
29
- },
30
33
  projectPolarToCartesian: function() {
31
34
  return projectPolarToCartesian;
32
35
  },
33
36
  resolveXAxisPoint: function() {
34
37
  return resolveXAxisPoint;
35
38
  },
39
+ transformPlotlyJsonToAreaChartProps: function() {
40
+ return transformPlotlyJsonToAreaChartProps;
41
+ },
36
42
  transformPlotlyJsonToChartTableProps: function() {
37
43
  return transformPlotlyJsonToChartTableProps;
38
44
  },
@@ -51,6 +57,9 @@ _export(exports, {
51
57
  transformPlotlyJsonToHorizontalBarWithAxisProps: function() {
52
58
  return transformPlotlyJsonToHorizontalBarWithAxisProps;
53
59
  },
60
+ transformPlotlyJsonToLineChartProps: function() {
61
+ return transformPlotlyJsonToLineChartProps;
62
+ },
54
63
  transformPlotlyJsonToSankeyProps: function() {
55
64
  return transformPlotlyJsonToSankeyProps;
56
65
  },
@@ -74,6 +83,7 @@ const _utilities = require("../../utilities/utilities");
74
83
  const _chartutilities = require("@fluentui/chart-utilities");
75
84
  const _d3shape = require("d3-shape");
76
85
  const _PlotlyColorAdapter = require("./PlotlyColorAdapter");
86
+ const _d3color = require("d3-color");
77
87
  const dashOptions = {
78
88
  dot: {
79
89
  strokeDasharray: '1, 5',
@@ -157,8 +167,9 @@ const correctYearMonth = (xValues)=>{
157
167
  });
158
168
  return xValues;
159
169
  };
160
- const usesSecondaryYScale = (series)=>{
161
- return series.yaxis === 'y2';
170
+ const usesSecondaryYScale = (series, layout)=>{
171
+ var _layout_yaxis2, _layout_yaxis21;
172
+ return series.yaxis === 'y2' && ((layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.anchor) === 'x' || (layout === null || layout === void 0 ? void 0 : (_layout_yaxis21 = layout.yaxis2) === null || _layout_yaxis21 === void 0 ? void 0 : _layout_yaxis21.side) === 'right');
162
173
  };
163
174
  const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>{
164
175
  var _layout_yaxis2, _layout_yaxis21, _layout_yaxis2_title, _layout_yaxis22;
@@ -166,7 +177,7 @@ const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>
166
177
  let yMinValue;
167
178
  let yMaxValue;
168
179
  data.forEach((series)=>{
169
- if (usesSecondaryYScale(series)) {
180
+ if (usesSecondaryYScale(series, layout)) {
170
181
  containsSecondaryYAxis = true;
171
182
  const yValues = series.y;
172
183
  if (yValues) {
@@ -219,7 +230,7 @@ const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
219
230
  }
220
231
  return x;
221
232
  };
222
- const transformPlotlyJsonToDonutProps = (input, colorMap, colorwayType, isDarkTheme)=>{
233
+ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
223
234
  var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _firstData_marker, _firstData_labels, _input_layout3, _input_layout4, _input_layout5, _input_layout6;
224
235
  const firstData = input.data[0];
225
236
  var _input_layout_piecolorway, _input_layout_piecolorway1;
@@ -276,12 +287,12 @@ const transformPlotlyJsonToDonutProps = (input, colorMap, colorwayType, isDarkTh
276
287
  roundCorners: true
277
288
  };
278
289
  };
279
- const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
290
+ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
280
291
  var _input_layout, _input_layout1, _vsbcData_;
281
292
  const mapXToDataPoints = {};
282
293
  let yMaxValue = 0;
283
294
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
284
- const { legends, hideLegend } = getLegendProps(input.data, input.layout);
295
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
285
296
  let colorScale = undefined;
286
297
  let yMinValue = 0;
287
298
  input.data.forEach((series, index1)=>{
@@ -296,7 +307,7 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkThe
296
307
  const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template1 = _input_layout2.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, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
297
308
  const xValues = series.x;
298
309
  const isXDate = (0, _chartutilities.isDateArray)(xValues);
299
- const isXString = isStringArray(xValues);
310
+ const isXString = (0, _chartutilities.isStringArray)(xValues);
300
311
  const isXNumber = (0, _chartutilities.isNumberArray)(xValues);
301
312
  const validXYRanges = getValidXYRanges(series);
302
313
  validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
@@ -314,34 +325,40 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkThe
314
325
  const legend = legends[index1];
315
326
  // resolve color for each legend's bars from the colorscale or extracted colors
316
327
  const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
328
+ const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
317
329
  const yVal = rangeYValues[index2];
318
330
  if (series.type === 'bar') {
331
+ var _rgb_copy_formatHex8;
319
332
  mapXToDataPoints[x].chartData.push({
320
333
  legend,
321
334
  data: yVal,
322
- color
335
+ color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
336
+ opacity
337
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
323
338
  });
324
339
  if (typeof yVal === 'number') {
325
340
  yMaxValue = Math.max(yMaxValue, yVal);
326
341
  }
327
342
  } else if (series.type === 'scatter' || !!fallbackVSBC) {
328
- var _series_mode, _series_line, _series_mode1;
343
+ var _series_mode;
329
344
  const lineColor = (0, _PlotlyColorAdapter.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
330
345
  const lineOptions = !((_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('text')) ? getLineOptions(series.line) : undefined;
331
- const dashType = ((_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.dash) || 'solid';
332
- const legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : ((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('markers')) ? 'circle' : 'default';
346
+ const legendShape = getLegendShape(series);
347
+ var _rgb_copy_formatHex81;
333
348
  mapXToDataPoints[x].lineData.push({
334
349
  legend: legend + (validXYRanges.length > 1 ? `.${rangeIdx + 1}` : ''),
335
350
  legendShape,
336
351
  y: yVal,
337
- color: lineColor,
352
+ color: (_rgb_copy_formatHex81 = (0, _d3color.rgb)(lineColor).copy({
353
+ opacity
354
+ }).formatHex8()) !== null && _rgb_copy_formatHex81 !== void 0 ? _rgb_copy_formatHex81 : color,
338
355
  lineOptions: {
339
356
  ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
340
357
  mode: series.mode
341
358
  },
342
- useSecondaryYScale: usesSecondaryYScale(series)
359
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout)
343
360
  });
344
- if (!usesSecondaryYScale(series) && typeof yVal === 'number') {
361
+ if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
345
362
  yMaxValue = Math.max(yMaxValue, yVal);
346
363
  yMinValue = Math.min(yMinValue, yVal);
347
364
  }
@@ -372,7 +389,8 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkThe
372
389
  roundCorners: true,
373
390
  showYAxisLables: true,
374
391
  noOfCharsToTruncate: 20,
375
- showYAxisLablesTooltip: true
392
+ showYAxisLablesTooltip: true,
393
+ ...getAxisCategoryOrderProps(input.data, input.layout)
376
394
  };
377
395
  };
378
396
  const createColorScale = (layout, series)=>{
@@ -389,11 +407,11 @@ const createColorScale = (layout, series)=>{
389
407
  const scaleColors = scale.map((item)=>item[1]);
390
408
  return (0, _d3scale.scaleLinear)().domain(scaleDomain).range(scaleColors);
391
409
  };
392
- const transformPlotlyJsonToGVBCProps = (input, colorMap, colorwayType, isDarkTheme)=>{
410
+ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
393
411
  var _input_layout, _input_layout1, _gvbcData_;
394
412
  const mapXToDataPoints = {};
395
413
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
396
- const { legends, hideLegend } = getLegendProps(input.data, input.layout);
414
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
397
415
  let colorScale = undefined;
398
416
  input.data.forEach((series, index1)=>{
399
417
  var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _series_x;
@@ -417,14 +435,18 @@ const transformPlotlyJsonToGVBCProps = (input, colorMap, colorwayType, isDarkThe
417
435
  var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
418
436
  const legend = legends[index1];
419
437
  // resolve color for each legend's bars from the colorscale or extracted colors
420
- const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
438
+ const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index2, legend, colorMap, isDarkTheme);
439
+ const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
440
+ var _rgb_copy_formatHex8;
421
441
  mapXToDataPoints[x].series.push({
422
442
  key: legend,
423
443
  data: series.y[index2],
424
444
  xAxisCalloutData: x,
425
- color,
445
+ color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
446
+ opacity
447
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
426
448
  legend,
427
- useSecondaryYScale: usesSecondaryYScale(series)
449
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout)
428
450
  });
429
451
  }
430
452
  });
@@ -445,13 +467,14 @@ const transformPlotlyJsonToGVBCProps = (input, colorMap, colorwayType, isDarkThe
445
467
  hideTickOverlap: true,
446
468
  wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
447
469
  hideLegend,
448
- roundCorners: true
470
+ roundCorners: true,
471
+ ...getAxisCategoryOrderProps(input.data, input.layout)
449
472
  };
450
473
  };
451
- const transformPlotlyJsonToVBCProps = (input, colorMap, colorwayType, isDarkTheme)=>{
474
+ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
452
475
  var _input_layout, _input_layout1, _vbcData_;
453
476
  const vbcData = [];
454
- const { legends, hideLegend } = getLegendProps(input.data, input.layout);
477
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
455
478
  let colorScale = undefined;
456
479
  input.data.forEach((series, seriesIdx)=>{
457
480
  var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _series_xbins, _series_xbins1, _series_xbins2;
@@ -473,7 +496,7 @@ const transformPlotlyJsonToVBCProps = (input, colorMap, colorwayType, isDarkThem
473
496
  xValues.push(xVal);
474
497
  yValues.push(yVal);
475
498
  });
476
- const isXString = isStringArray(xValues);
499
+ const isXString = (0, _chartutilities.isStringArray)(xValues);
477
500
  // TODO: In case of a single bin, add an empty bin of the same size to prevent the
478
501
  // default bar width from being used and ensure the bar spans the full intended range.
479
502
  const xBins = createBins(xValues, (_series_xbins = series.xbins) === null || _series_xbins === void 0 ? void 0 : _series_xbins.start, (_series_xbins1 = series.xbins) === null || _series_xbins1 === void 0 ? void 0 : _series_xbins1.end, (_series_xbins2 = series.xbins) === null || _series_xbins2 === void 0 ? void 0 : _series_xbins2.size);
@@ -495,12 +518,16 @@ const transformPlotlyJsonToVBCProps = (input, colorMap, colorwayType, isDarkThem
495
518
  const legend = legends[seriesIdx];
496
519
  // resolve color for each legend's bars from the colorscale or extracted colors
497
520
  const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
521
+ const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
498
522
  const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
523
+ var _rgb_copy_formatHex8;
499
524
  vbcData.push({
500
525
  x: isXString ? bin.join(', ') : getBinCenter(bin),
501
526
  y: yVal,
502
527
  legend,
503
- color,
528
+ color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
529
+ opacity
530
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
504
531
  ...isXString ? {} : {
505
532
  xAxisCalloutData: `[${bin.x0} - ${bin.x1})`
506
533
  }
@@ -521,32 +548,51 @@ const transformPlotlyJsonToVBCProps = (input, colorMap, colorwayType, isDarkThem
521
548
  wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
522
549
  maxBarWidth: 50,
523
550
  hideLegend,
524
- roundCorners: true
551
+ roundCorners: true,
552
+ ...getAxisCategoryOrderProps(input.data, input.layout)
525
553
  };
526
554
  };
527
- const transformPlotlyJsonToScatterChartProps = (input, chartType, isScatterMarkers, colorMap, colorwayType, isDarkTheme)=>{
555
+ const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
556
+ return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'area', colorMap, colorwayType, isDarkTheme);
557
+ };
558
+ const transformPlotlyJsonToLineChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
559
+ return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'line', colorMap, colorwayType, isDarkTheme);
560
+ };
561
+ const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
562
+ return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
563
+ };
564
+ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
565
+ var _input_data_;
566
+ const isScatterMarkers = [
567
+ 'markers',
568
+ 'text+markers',
569
+ 'markers+text',
570
+ 'lines+markers',
571
+ 'markers+line',
572
+ 'text+lines+markers'
573
+ ].includes((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.mode);
528
574
  const isAreaChart = chartType === 'area';
529
575
  const isScatterChart = chartType === 'scatter';
530
576
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
531
577
  let mode = 'tonexty';
532
- const { legends, hideLegend } = getLegendProps(input.data, input.layout);
578
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
533
579
  const chartData = input.data.map((series, index)=>{
534
- var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1, _series_line2, _series_mode2;
580
+ var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
535
581
  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;
536
582
  // extract colors for each series only once
537
583
  const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, colors, colorMap, isDarkTheme);
538
584
  const xValues = series.x;
539
- const isXString = isStringArray(xValues);
585
+ const isXString = (0, _chartutilities.isStringArray)(xValues);
540
586
  const isXDate = (0, _chartutilities.isDateArray)(xValues);
541
587
  const isXNumber = (0, _chartutilities.isNumberArray)(xValues);
542
588
  const isXYearCategory = (0, _chartutilities.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
543
589
  const legend = legends[index];
544
590
  // resolve color for each legend's lines from the extracted colors
545
591
  const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
592
+ const seriesOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
546
593
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
547
594
  const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) ? getLineOptions(series.line) : undefined;
548
- const dashType = ((_series_line2 = series.line) === null || _series_line2 === void 0 ? void 0 : _series_line2.dash) || 'solid';
549
- const legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : ((_series_mode2 = series.mode) === null || _series_mode2 === void 0 ? void 0 : _series_mode2.includes('markers')) ? 'circle' : 'default';
595
+ const legendShape = getLegendShape(series);
550
596
  const validXYRanges = getValidXYRanges(series);
551
597
  return validXYRanges.map(([rangeStart, rangeEnd], rangeIdx)=>{
552
598
  var _series_marker;
@@ -554,6 +600,7 @@ const transformPlotlyJsonToScatterChartProps = (input, chartType, isScatterMarke
554
600
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
555
601
  const markerSizes = (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? series.marker.size.slice(rangeStart, rangeEnd) : [];
556
602
  const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : undefined;
603
+ var _rgb_copy_formatHex8;
557
604
  return {
558
605
  legend,
559
606
  legendShape,
@@ -572,12 +619,14 @@ const transformPlotlyJsonToScatterChartProps = (input, chartType, isScatterMarke
572
619
  } : {}
573
620
  };
574
621
  }),
575
- color: seriesColor,
622
+ color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(seriesColor).copy({
623
+ opacity: seriesOpacity
624
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : seriesColor,
576
625
  lineOptions: {
577
626
  ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
578
627
  mode: series.mode
579
628
  },
580
- useSecondaryYScale: usesSecondaryYScale(series)
629
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout)
581
630
  };
582
631
  });
583
632
  }).flat();
@@ -630,9 +679,9 @@ const transformPlotlyJsonToScatterChartProps = (input, chartType, isScatterMarke
630
679
  };
631
680
  }
632
681
  };
633
- const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, colorwayType, isDarkTheme)=>{
682
+ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
634
683
  var _input_layout, _input_layout_margin, _input_layout1, _input_layout_margin1, _input_layout2, _input_layout_yaxis2, _input_layout3, _input_layout_yaxis21, _input_layout4, _input_layout_yaxis2_title, _input_layout_yaxis22, _input_layout5, _input_layout6;
635
- const { legends, hideLegend } = getLegendProps(input.data, input.layout);
684
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
636
685
  let colorScale = undefined;
637
686
  const chartData = input.data.map((series, index)=>{
638
687
  var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3;
@@ -649,15 +698,18 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, colorw
649
698
  }
650
699
  // resolve color for each legend's bars from the colorscale or extracted colors
651
700
  const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
701
+ const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, i);
702
+ var _rgb_copy_formatHex8;
652
703
  return {
653
704
  x: series.x[i],
654
705
  y: yValue,
655
706
  legend,
656
- color
707
+ color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
708
+ opacity
709
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
657
710
  };
658
711
  }).filter((point)=>point !== null);
659
- }).reverse().flat() //reversing the order to invert the Y bars order as required by plotly.
660
- .reverse();
712
+ }).flat();
661
713
  var _input_layout_height;
662
714
  const chartHeight = (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 450;
663
715
  var _input_layout_margin_l;
@@ -684,10 +736,11 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, colorw
684
736
  noOfCharsToTruncate: 20,
685
737
  showYAxisLablesTooltip: true,
686
738
  hideLegend,
687
- roundCorners: true
739
+ roundCorners: true,
740
+ ...getAxisCategoryOrderProps(input.data, input.layout)
688
741
  };
689
742
  };
690
- const transformPlotlyJsonToHeatmapProps = (input)=>{
743
+ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
691
744
  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;
692
745
  const firstData = input.data[0];
693
746
  const heatmapDataPoints = [];
@@ -708,8 +761,8 @@ const transformPlotlyJsonToHeatmapProps = (input)=>{
708
761
  yValues.push(firstData.y[index]);
709
762
  zValues.push(zVal);
710
763
  });
711
- const isXString = isStringArray(xValues);
712
- const isYString = isStringArray(yValues);
764
+ const isXString = (0, _chartutilities.isStringArray)(xValues);
765
+ const isYString = (0, _chartutilities.isStringArray)(yValues);
713
766
  const xBins = createBins(xValues, (_firstData_xbins = firstData.xbins) === null || _firstData_xbins === void 0 ? void 0 : _firstData_xbins.start, (_firstData_xbins1 = firstData.xbins) === null || _firstData_xbins1 === void 0 ? void 0 : _firstData_xbins1.end, (_firstData_xbins2 = firstData.xbins) === null || _firstData_xbins2 === void 0 ? void 0 : _firstData_xbins2.size);
714
767
  const yBins = createBins(yValues, (_firstData_ybins = firstData.ybins) === null || _firstData_ybins === void 0 ? void 0 : _firstData_ybins.start, (_firstData_ybins1 = firstData.ybins) === null || _firstData_ybins1 === void 0 ? void 0 : _firstData_ybins1.end, (_firstData_ybins2 = firstData.ybins) === null || _firstData_ybins2 === void 0 ? void 0 : _firstData_ybins2.size);
715
768
  const zBins = yBins.map(()=>xBins.map(()=>[]));
@@ -816,10 +869,13 @@ const transformPlotlyJsonToHeatmapProps = (input)=>{
816
869
  hideTickOverlap: true,
817
870
  noOfCharsToTruncate: 20,
818
871
  showYAxisLablesTooltip: true,
819
- wrapXAxisLables: true
872
+ wrapXAxisLables: true,
873
+ ...getAxisCategoryOrderProps([
874
+ firstData
875
+ ], input.layout)
820
876
  };
821
877
  };
822
- const transformPlotlyJsonToSankeyProps = (input, colorMap, colorwayType, isDarkTheme)=>{
878
+ const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
823
879
  var _input_layout_template_layout, _input_layout_template, _input_layout, _node_label, _input_layout1, _input_layout2;
824
880
  const { link, node } = input.data[0];
825
881
  var _link_value;
@@ -868,7 +924,7 @@ const transformPlotlyJsonToSankeyProps = (input, colorMap, colorwayType, isDarkT
868
924
  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
869
925
  };
870
926
  };
871
- const transformPlotlyJsonToGaugeProps = (input, colorMap, colorwayType, isDarkTheme)=>{
927
+ const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
872
928
  var _firstData_gauge, _input_layout_template_layout, _input_layout_template, _input_layout, _firstData_gauge_steps, _firstData_gauge1, _firstData_gauge_axis_range, _firstData_gauge_axis, _firstData_gauge2, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _firstData_gauge_axis1, _firstData_gauge3, _firstData_gauge_axis_range1, _firstData_gauge_axis2, _firstData_gauge4, _firstData_delta, _firstData_gauge_axis_range2, _firstData_gauge_axis3, _firstData_gauge5, _firstData_gauge_axis_range3, _firstData_gauge_axis4, _firstData_gauge6, _firstData_gauge_axis_range4, _firstData_gauge_axis5, _firstData_gauge7, _firstData_gauge_axis_range5, _firstData_gauge_axis6, _firstData_gauge8, _input_layout2, _input_layout3, _firstData_gauge_steps1, _firstData_gauge9;
873
929
  const firstData = input.data[0];
874
930
  const stepsColors = ((_firstData_gauge = firstData.gauge) === null || _firstData_gauge === void 0 ? void 0 : _firstData_gauge.steps) ? firstData.gauge.steps.map((step)=>step.color) : undefined;
@@ -964,7 +1020,7 @@ const formatValue = (value, colIndex, cells)=>{
964
1020
  }
965
1021
  return `${prefix !== null && prefix !== void 0 ? prefix : ''}${formatted}${suffix !== null && suffix !== void 0 ? suffix : ''}`;
966
1022
  };
967
- const transformPlotlyJsonToChartTableProps = (input, colorMap, isDarkTheme)=>{
1023
+ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
968
1024
  var _tableData_cells, _input_layout_template_data, _input_layout_template, _input_layout, _input_layout_font, _input_layout1, _tableData_header, _tableData_header1, _input_layout_template_data1, _input_layout_template1, _input_layout2, _input_layout3, _input_layout4;
969
1025
  const tableData = input.data[0];
970
1026
  const normalizeHeaders = (values, header)=>{
@@ -1180,10 +1236,6 @@ function getLineOptions(line) {
1180
1236
  }
1181
1237
  return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
1182
1238
  }
1183
- const isStringArray = (arr)=>{
1184
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1185
- return (0, _chartutilities.isArrayOfType)(arr, (value)=>typeof value === 'string' || value === null);
1186
- };
1187
1239
  // TODO: Use binary search to find the appropriate bin for numeric value.
1188
1240
  const findBinIndex = (bins, value, isString)=>{
1189
1241
  if (typeof value === 'undefined' || value === null) {
@@ -1202,7 +1254,7 @@ const createBins = (data, binStart, binEnd, binSize)=>{
1202
1254
  if (!data || data.length === 0) {
1203
1255
  return [];
1204
1256
  }
1205
- if (isStringArray(data)) {
1257
+ if ((0, _chartutilities.isStringArray)(data)) {
1206
1258
  const categories = Array.from(new Set(data));
1207
1259
  const start = typeof binStart === 'number' ? Math.ceil(binStart) : 0;
1208
1260
  const stop = typeof binEnd === 'number' ? Math.floor(binEnd) + 1 : categories.length;
@@ -1278,7 +1330,46 @@ const precisionRound = (value, precision)=>{
1278
1330
  const factor = Math.pow(10, precision);
1279
1331
  return Math.round(value * factor) / factor;
1280
1332
  };
1281
- const getLegendProps = (data, layout)=>{
1333
+ const getLegendShape = (series)=>{
1334
+ var _series_line, _series_mode;
1335
+ const dashType = ((_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.dash) || 'solid';
1336
+ if (dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot') {
1337
+ return 'dottedLine';
1338
+ } else if ((_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('markers')) {
1339
+ return 'circle';
1340
+ }
1341
+ return 'default';
1342
+ };
1343
+ const getAllupLegendsProps = (input, colorMap, colorwayType, isDarkTheme)=>{
1344
+ const allupLegends = [];
1345
+ // reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
1346
+ const toShowLegend = input.data.reduce((acc, series)=>{
1347
+ return acc || series.showlegend === true;
1348
+ }, false);
1349
+ if (toShowLegend) {
1350
+ input.data.forEach((series, index)=>{
1351
+ var _series_line, _series_marker, _input_layout_template_layout, _input_layout_template, _input_layout;
1352
+ const name = series.legendgroup;
1353
+ const color = ((_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);
1354
+ const legendShape = getLegendShape(series);
1355
+ const resolvedColor = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, color, colorMap, isDarkTheme);
1356
+ if (name !== undefined && allupLegends.some((group)=>group.title === name) === false) {
1357
+ allupLegends.push({
1358
+ title: name,
1359
+ color: resolvedColor,
1360
+ shape: legendShape
1361
+ });
1362
+ }
1363
+ });
1364
+ }
1365
+ return {
1366
+ legends: allupLegends,
1367
+ centerLegends: true,
1368
+ enabledWrapLines: true,
1369
+ canSelectMultipleLegends: true
1370
+ };
1371
+ };
1372
+ const getLegendProps = (data, layout, isMultiPlot)=>{
1282
1373
  const legends = [];
1283
1374
  if (data.length === 1) {
1284
1375
  legends.push(data[0].name || '');
@@ -1287,10 +1378,11 @@ const getLegendProps = (data, layout)=>{
1287
1378
  legends.push(series.name || `Series ${index + 1}`);
1288
1379
  });
1289
1380
  }
1290
- const hideLegends = data.every((series)=>series.showlegend === false);
1381
+ const hideLegendsData = data.every((series)=>series.showlegend === false);
1382
+ const hideLegendsInferred = (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false || (layout === null || layout === void 0 ? void 0 : layout.showlegend) !== true && legends.length < 2;
1291
1383
  return {
1292
1384
  legends,
1293
- hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false ? true : hideLegends
1385
+ hideLegend: isMultiPlot || hideLegendsInferred || hideLegendsData
1294
1386
  };
1295
1387
  };
1296
1388
  const getNumberAtIndexOrDefault = (data, index)=>{
@@ -1328,3 +1420,215 @@ const getValidXYRanges = (series)=>{
1328
1420
  }
1329
1421
  return ranges;
1330
1422
  };
1423
+ const getIndexFromKey = (key, pattern)=>{
1424
+ const normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
1425
+ return parseInt(normalizedKey, 10) - 1;
1426
+ };
1427
+ const getGridProperties = (layout, isMultiPlot)=>{
1428
+ var _layout_annotations;
1429
+ const gridX = [];
1430
+ const gridY = [];
1431
+ const annotations = {};
1432
+ let templateRows = '1fr';
1433
+ let templateColumns = '1fr';
1434
+ const gridLayout = {};
1435
+ if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
1436
+ return {
1437
+ templateRows,
1438
+ templateColumns,
1439
+ layout: gridLayout
1440
+ };
1441
+ }
1442
+ if (!layout.xaxis || !layout.yaxis) {
1443
+ return {
1444
+ templateRows,
1445
+ templateColumns,
1446
+ layout: gridLayout
1447
+ };
1448
+ }
1449
+ if (!isMultiPlot) {
1450
+ return {
1451
+ templateRows,
1452
+ templateColumns,
1453
+ layout: gridLayout
1454
+ };
1455
+ }
1456
+ Object.keys(layout).forEach((key)=>{
1457
+ if (key.startsWith('xaxis')) {
1458
+ var _layout_key, _layout_key1;
1459
+ const index = getIndexFromKey(key, 'xaxis');
1460
+ var _layout_key_anchor;
1461
+ const anchor = (_layout_key_anchor = (_layout_key = layout[key]) === null || _layout_key === void 0 ? void 0 : _layout_key.anchor) !== null && _layout_key_anchor !== void 0 ? _layout_key_anchor : 'y';
1462
+ const anchorIndex = getIndexFromKey(anchor, 'y');
1463
+ if (index !== anchorIndex) {
1464
+ throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
1465
+ }
1466
+ var _layout_key_domain;
1467
+ gridX[index] = (_layout_key_domain = (_layout_key1 = layout[key]) === null || _layout_key1 === void 0 ? void 0 : _layout_key1.domain) !== null && _layout_key_domain !== void 0 ? _layout_key_domain : [];
1468
+ } else if (key.startsWith('yaxis')) {
1469
+ var _layout_key2, _layout_key3;
1470
+ const index = getIndexFromKey(key, 'yaxis');
1471
+ var _layout_key_anchor1;
1472
+ const anchor = (_layout_key_anchor1 = (_layout_key2 = layout[key]) === null || _layout_key2 === void 0 ? void 0 : _layout_key2.anchor) !== null && _layout_key_anchor1 !== void 0 ? _layout_key_anchor1 : 'x';
1473
+ const anchorIndex = getIndexFromKey(anchor, 'x');
1474
+ if (index !== anchorIndex) {
1475
+ var _layout_yaxis2;
1476
+ if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
1477
+ // Special case for secondary y axis where yaxis2 can anchor to x1
1478
+ return {
1479
+ templateRows,
1480
+ templateColumns
1481
+ };
1482
+ }
1483
+ throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
1484
+ }
1485
+ var _layout_key_domain1;
1486
+ gridY[index] = (_layout_key_domain1 = (_layout_key3 = layout[key]) === null || _layout_key3 === void 0 ? void 0 : _layout_key3.domain) !== null && _layout_key_domain1 !== void 0 ? _layout_key_domain1 : [];
1487
+ }
1488
+ });
1489
+ (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
1490
+ const xMatches = gridX.flatMap((interval, idx)=>(annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval[1] ? [
1491
+ idx
1492
+ ] : []);
1493
+ const yMatch = gridY.findIndex((interval, yIndex)=>xMatches.includes(yIndex) && (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval[1]);
1494
+ if (yMatch !== -1) {
1495
+ if (annotations[yMatch] === undefined) {
1496
+ annotations[yMatch] = {};
1497
+ }
1498
+ if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1499
+ annotations[yMatch].yAnnotation = annotation.text;
1500
+ } else {
1501
+ annotations[yMatch].xAnnotation = annotation.text;
1502
+ }
1503
+ }
1504
+ });
1505
+ if (gridX.length > 0) {
1506
+ const uniqueXIntervals = new Map();
1507
+ gridX.forEach((interval)=>{
1508
+ const key = `${interval[0]}-${interval[1]}`;
1509
+ if (!uniqueXIntervals.has(key)) {
1510
+ uniqueXIntervals.set(key, interval);
1511
+ }
1512
+ });
1513
+ const minXInterval = Math.min(...Array.from(uniqueXIntervals.values()).map((interval)=>interval[1] - interval[0]));
1514
+ templateColumns = Array.from(uniqueXIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minXInterval}fr`).join(' ');
1515
+ let columnNumber = 1;
1516
+ let lastIntervalEnd = 0;
1517
+ gridX.forEach((interval, index)=>{
1518
+ if (interval.length === 0) {
1519
+ return;
1520
+ }
1521
+ const cellName = `x${index === 0 ? '' : index + 1}`;
1522
+ const annotationProps = annotations[index];
1523
+ const xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
1524
+ if (interval[0] < lastIntervalEnd) {
1525
+ columnNumber = 1;
1526
+ }
1527
+ lastIntervalEnd = interval[1];
1528
+ const row = {
1529
+ row: -1,
1530
+ column: columnNumber,
1531
+ xAnnotation
1532
+ };
1533
+ gridLayout[cellName] = row;
1534
+ columnNumber += 1;
1535
+ });
1536
+ }
1537
+ const numColumns = Math.max(...Object.values(gridLayout).map((cell)=>{
1538
+ var _cell_column;
1539
+ return (_cell_column = cell.column) !== null && _cell_column !== void 0 ? _cell_column : 0;
1540
+ }));
1541
+ const columnFill = {};
1542
+ for(let i = 1; i <= numColumns; i++){
1543
+ columnFill[i] = {
1544
+ row: 1,
1545
+ fillDomain: 0
1546
+ };
1547
+ }
1548
+ if (gridY.length > 0) {
1549
+ const uniqueYIntervals = new Map();
1550
+ gridY.forEach((interval)=>{
1551
+ const key = `${interval[0]}-${interval[1]}`;
1552
+ if (!uniqueYIntervals.has(key)) {
1553
+ uniqueYIntervals.set(key, interval);
1554
+ }
1555
+ });
1556
+ const minYInterval = Math.min(...Array.from(uniqueYIntervals.values()).map((interval)=>interval[1] - interval[0]));
1557
+ templateRows = Array.from(uniqueYIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minYInterval}fr`).join(' ');
1558
+ gridY.forEach((interval, index)=>{
1559
+ if (interval.length === 0) {
1560
+ return;
1561
+ }
1562
+ const cellName = `x${index === 0 ? '' : index + 1}`;
1563
+ const annotationProps = annotations[index];
1564
+ const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
1565
+ const cell = gridLayout[cellName];
1566
+ if (cell !== undefined) {
1567
+ cell.row = columnFill[cell.column].row;
1568
+ cell.yAnnotation = yAnnotation;
1569
+ }
1570
+ columnFill[cell.column].fillDomain = interval[1];
1571
+ columnFill[cell.column].row += 1;
1572
+ });
1573
+ }
1574
+ // reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
1575
+ const reversedGridLayout = {};
1576
+ // find the maximum row number
1577
+ const maxRowNumber = Math.max(...Object.values(gridLayout).map((cell)=>{
1578
+ var _cell_row;
1579
+ return (_cell_row = cell.row) !== null && _cell_row !== void 0 ? _cell_row : 0;
1580
+ }));
1581
+ // iterate over the gridLayout and reverse the row numbers
1582
+ Object.keys(gridLayout).forEach((key)=>{
1583
+ const cell = gridLayout[key];
1584
+ if (cell.row !== undefined) {
1585
+ // reverse the row number
1586
+ cell.row = maxRowNumber - cell.row + 1;
1587
+ }
1588
+ reversedGridLayout[key] = cell;
1589
+ });
1590
+ return {
1591
+ templateRows,
1592
+ templateColumns,
1593
+ layout: reversedGridLayout
1594
+ };
1595
+ };
1596
+ /**
1597
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
1598
+ */ const getAxisCategoryOrderProps = (data, layout)=>{
1599
+ const result = {};
1600
+ const axesById = {
1601
+ x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
1602
+ y: layout === null || layout === void 0 ? void 0 : layout.yaxis
1603
+ };
1604
+ Object.keys(axesById).forEach((axId)=>{
1605
+ const ax = axesById[axId];
1606
+ const axLetter = axId[0];
1607
+ const propName = `${axLetter}AxisCategoryOrder`;
1608
+ const values = [];
1609
+ data.forEach((series)=>{
1610
+ var _series_axLetter;
1611
+ (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
1612
+ if (!(0, _chartutilities.isInvalidValue)(val)) {
1613
+ values.push(val);
1614
+ }
1615
+ });
1616
+ });
1617
+ const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || (0, _chartutilities.isStringArray)(values) && !(0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isDateArray)(values);
1618
+ if (!isAxisTypeCategory) {
1619
+ return;
1620
+ }
1621
+ const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
1622
+ if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
1623
+ result[propName] = ax.categoryarray;
1624
+ return;
1625
+ }
1626
+ if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1627
+ const categoriesInTraceOrder = Array.from(new Set(values));
1628
+ result[propName] = categoriesInTraceOrder;
1629
+ return;
1630
+ }
1631
+ result[propName] = ax.categoryorder;
1632
+ });
1633
+ return result;
1634
+ };