@fluentui/react-charts 9.2.1 → 9.2.3

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 (201) hide show
  1. package/CHANGELOG.md +57 -2
  2. package/dist/index.d.ts +168 -15
  3. package/lib/ChartTable.js +1 -0
  4. package/lib/ChartTable.js.map +1 -0
  5. package/lib/components/AreaChart/AreaChart.js +4 -1
  6. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  7. package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -1
  8. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  9. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
  10. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  11. package/lib/components/ChartTable/ChartTable.js +58 -0
  12. package/lib/components/ChartTable/ChartTable.js.map +1 -0
  13. package/lib/components/ChartTable/ChartTable.types.js +1 -0
  14. package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
  15. package/lib/components/ChartTable/index.js +3 -0
  16. package/lib/components/ChartTable/index.js.map +1 -0
  17. package/lib/components/ChartTable/useChartTableStyles.styles.js +93 -0
  18. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
  19. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +55 -0
  20. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
  21. package/lib/components/CommonComponents/CartesianChart.js +170 -100
  22. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  23. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  24. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
  25. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
  26. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  27. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
  28. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  29. package/lib/components/DeclarativeChart/DeclarativeChart.js +180 -102
  30. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  31. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +100 -0
  32. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +890 -211
  34. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  35. package/lib/components/DonutChart/DonutChart.js +2 -2
  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.map +1 -1
  39. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  40. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  41. package/lib/components/GanttChart/useGanttChartStyles.styles.js +2 -1
  42. package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  43. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
  44. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  45. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +185 -144
  46. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  47. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
  48. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  49. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
  50. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  51. package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
  52. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  53. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
  54. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  55. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
  56. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  57. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  58. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
  59. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
  60. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  61. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
  62. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  63. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
  64. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  65. package/lib/components/Legends/Legends.js.map +1 -1
  66. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  67. package/lib/components/LineChart/LineChart.js +251 -78
  68. package/lib/components/LineChart/LineChart.js.map +1 -1
  69. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  70. package/lib/components/LineChart/useLineChartStyles.styles.js +10 -3
  71. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  72. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
  73. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  74. package/lib/components/ScatterChart/ScatterChart.js +56 -37
  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 +21 -4
  78. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  79. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +16 -3
  80. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  81. package/lib/components/VerticalBarChart/VerticalBarChart.js +38 -14
  82. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  83. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
  84. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  85. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
  86. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  87. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +214 -96
  88. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  89. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  90. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
  91. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  92. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
  93. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  94. package/lib/index.js +1 -0
  95. package/lib/index.js.map +1 -1
  96. package/lib/types/DataPoint.js.map +1 -1
  97. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  98. package/lib/utilities/utilities.js +41 -42
  99. package/lib/utilities/utilities.js.map +1 -1
  100. package/lib/utilities/vbc-utils.js +24 -0
  101. package/lib/utilities/vbc-utils.js.map +1 -1
  102. package/lib-commonjs/ChartTable.js +6 -0
  103. package/lib-commonjs/ChartTable.js.map +1 -0
  104. package/lib-commonjs/components/AreaChart/AreaChart.js +4 -1
  105. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  106. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
  107. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  108. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
  109. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  110. package/lib-commonjs/components/ChartTable/ChartTable.js +69 -0
  111. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
  112. package/lib-commonjs/components/ChartTable/ChartTable.types.js +6 -0
  113. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
  114. package/lib-commonjs/components/ChartTable/index.js +8 -0
  115. package/lib-commonjs/components/ChartTable/index.js.map +1 -0
  116. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +196 -0
  117. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
  118. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +69 -0
  119. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
  120. package/lib-commonjs/components/CommonComponents/CartesianChart.js +169 -98
  121. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  122. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  123. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
  124. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
  125. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  126. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
  127. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  128. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +176 -100
  129. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  130. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +128 -0
  131. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  132. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +909 -209
  133. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  134. package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
  135. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  136. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  137. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  138. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  139. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  140. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +2 -1
  141. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  142. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
  143. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  144. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +183 -142
  145. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  146. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
  147. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  148. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
  149. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  150. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
  151. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  152. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
  153. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  154. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
  155. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  156. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  157. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
  158. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
  159. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  160. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
  161. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  162. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
  163. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  164. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  165. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  166. package/lib-commonjs/components/LineChart/LineChart.js +250 -78
  167. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  168. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  169. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +12 -3
  170. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  171. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
  172. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  173. package/lib-commonjs/components/ScatterChart/ScatterChart.js +56 -37
  174. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  175. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  176. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +30 -3
  177. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  178. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +15 -2
  179. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  180. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +37 -13
  181. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  182. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
  183. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  184. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
  185. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  186. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +213 -95
  187. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  188. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  189. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
  190. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  191. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
  192. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  193. package/lib-commonjs/index.js +1 -0
  194. package/lib-commonjs/index.js.map +1 -1
  195. package/lib-commonjs/types/DataPoint.js.map +1 -1
  196. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  197. package/lib-commonjs/utilities/utilities.js +44 -41
  198. package/lib-commonjs/utilities/utilities.js.map +1 -1
  199. package/lib-commonjs/utilities/vbc-utils.js +27 -0
  200. package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
  201. package/package.json +10 -10
@@ -1,4 +1,4 @@
1
- /* eslint-disable one-var */ /* eslint-disable vars-on-top */ /* eslint-disable no-var */ /* eslint-disable @typescript-eslint/no-explicit-any */ "use strict";
1
+ /* eslint-disable one-var */ /* eslint-disable vars-on-top */ /* eslint-disable no-var */ "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
@@ -9,18 +9,39 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ _getGaugeAxisColor: function() {
13
+ return _getGaugeAxisColor;
14
+ },
12
15
  correctYearMonth: function() {
13
16
  return correctYearMonth;
14
17
  },
15
18
  findArrayAttributes: function() {
16
19
  return findArrayAttributes;
17
20
  },
18
- getColor: function() {
19
- return getColor;
21
+ getAllupLegendsProps: function() {
22
+ return getAllupLegendsProps;
23
+ },
24
+ getGridProperties: function() {
25
+ return getGridProperties;
26
+ },
27
+ getNumberAtIndexOrDefault: function() {
28
+ return getNumberAtIndexOrDefault;
29
+ },
30
+ getValidXYRanges: function() {
31
+ return getValidXYRanges;
20
32
  },
21
33
  projectPolarToCartesian: function() {
22
34
  return projectPolarToCartesian;
23
35
  },
36
+ resolveXAxisPoint: function() {
37
+ return resolveXAxisPoint;
38
+ },
39
+ transformPlotlyJsonToAreaChartProps: function() {
40
+ return transformPlotlyJsonToAreaChartProps;
41
+ },
42
+ transformPlotlyJsonToChartTableProps: function() {
43
+ return transformPlotlyJsonToChartTableProps;
44
+ },
24
45
  transformPlotlyJsonToDonutProps: function() {
25
46
  return transformPlotlyJsonToDonutProps;
26
47
  },
@@ -36,6 +57,9 @@ _export(exports, {
36
57
  transformPlotlyJsonToHorizontalBarWithAxisProps: function() {
37
58
  return transformPlotlyJsonToHorizontalBarWithAxisProps;
38
59
  },
60
+ transformPlotlyJsonToLineChartProps: function() {
61
+ return transformPlotlyJsonToLineChartProps;
62
+ },
39
63
  transformPlotlyJsonToSankeyProps: function() {
40
64
  return transformPlotlyJsonToSankeyProps;
41
65
  },
@@ -53,10 +77,13 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
53
77
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
54
78
  const _d3array = require("d3-array");
55
79
  const _d3scale = require("d3-scale");
80
+ const _d3format = require("d3-format");
56
81
  const _colors = require("../../utilities/colors");
57
82
  const _utilities = require("../../utilities/utilities");
58
83
  const _chartutilities = require("@fluentui/chart-utilities");
59
84
  const _d3shape = require("d3-shape");
85
+ const _PlotlyColorAdapter = require("./PlotlyColorAdapter");
86
+ const _d3color = require("d3-color");
60
87
  const dashOptions = {
61
88
  dot: {
62
89
  strokeDasharray: '1, 5',
@@ -114,32 +141,35 @@ const correctYearMonth = (xValues)=>{
114
141
  const parsedDate = `${possiblyMonthValue} 01, ${presentYear}`;
115
142
  return (0, _chartutilities.isDate)(parsedDate) ? new Date(parsedDate) : null;
116
143
  });
117
- for(let i = dates.length - 1; i > 0; i--){
118
- const currentMonth = dates[i].getMonth();
119
- const previousMonth = dates[i - 1].getMonth();
120
- const currentYear = dates[i].getFullYear();
121
- const previousYear = dates[i - 1].getFullYear();
144
+ const filteredDateIndexPairs = dates.map((date, index)=>[
145
+ date,
146
+ index
147
+ ]).filter(([date])=>date !== null);
148
+ for(let i = filteredDateIndexPairs.length - 1; i > 0; i--){
149
+ const currentDate = filteredDateIndexPairs[i][0];
150
+ const previousDate = filteredDateIndexPairs[i - 1][0];
151
+ const currentMonth = currentDate.getMonth();
152
+ const previousMonth = previousDate.getMonth();
153
+ const currentYear = currentDate.getFullYear();
154
+ const previousYear = previousDate.getFullYear();
122
155
  if (previousMonth >= currentMonth) {
123
- dates[i - 1].setFullYear(dates[i].getFullYear() - 1);
156
+ filteredDateIndexPairs[i - 1][0].setFullYear(currentYear - 1);
124
157
  } else if (previousYear > currentYear) {
125
- dates[i - 1].setFullYear(currentYear);
158
+ filteredDateIndexPairs[i - 1][0].setFullYear(currentYear);
126
159
  }
160
+ dates[filteredDateIndexPairs[i - 1][1]] = filteredDateIndexPairs[i - 1][0];
127
161
  }
128
162
  xValues = xValues.map((month, index)=>{
163
+ if (dates[index] === null) {
164
+ return null;
165
+ }
129
166
  return `${month} 01, ${dates[index].getFullYear()}`;
130
167
  });
131
168
  return xValues;
132
169
  };
133
- const getColor = (legendLabel, colorMap, isDarkTheme)=>{
134
- if (!colorMap.current.has(legendLabel)) {
135
- const nextColor = (0, _colors.getNextColor)(colorMap.current.size + 1, 0, isDarkTheme);
136
- colorMap.current.set(legendLabel, nextColor);
137
- return nextColor;
138
- }
139
- return colorMap.current.get(legendLabel);
140
- };
141
- const usesSecondaryYScale = (series)=>{
142
- 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');
143
173
  };
144
174
  const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>{
145
175
  var _layout_yaxis2, _layout_yaxis21, _layout_yaxis2_title, _layout_yaxis22;
@@ -147,7 +177,7 @@ const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>
147
177
  let yMinValue;
148
178
  let yMaxValue;
149
179
  data.forEach((series)=>{
150
- if (usesSecondaryYScale(series)) {
180
+ if (usesSecondaryYScale(series, layout)) {
151
181
  containsSecondaryYAxis = true;
152
182
  const yValues = series.y;
153
183
  if (yValues) {
@@ -177,29 +207,60 @@ const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>
177
207
  }
178
208
  };
179
209
  };
180
- const transformPlotlyJsonToDonutProps = (input, colorMap, isDarkTheme)=>{
181
- var _firstData_labels, _input_layout, _input_layout1, _input_layout2, _input_layout3;
210
+ const _getGaugeAxisColor = (colorway, colorwayType, color, colorMap, isDarkTheme)=>{
211
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)(colorway, colorwayType, color, colorMap, isDarkTheme);
212
+ return (0, _PlotlyColorAdapter.resolveColor)(extractedColors, 0, '', colorMap, isDarkTheme);
213
+ };
214
+ const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
215
+ if (x === null || x === undefined) {
216
+ return '';
217
+ }
218
+ if (isXYearCategory) {
219
+ return x.toString();
220
+ }
221
+ if (isXString) {
222
+ if (isXDate) {
223
+ const date = new Date(x);
224
+ return date;
225
+ }
226
+ if (isXNumber) {
227
+ return parseFloat(x);
228
+ }
229
+ return x;
230
+ }
231
+ return x;
232
+ };
233
+ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
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;
182
235
  const firstData = input.data[0];
236
+ var _input_layout_piecolorway, _input_layout_piecolorway1;
237
+ // extract colors for each series only once
238
+ // use piecolorway if available
239
+ // otherwise, default to colorway from template
240
+ const colors = (0, _PlotlyColorAdapter.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 : firstData === null || firstData === void 0 ? void 0 : (_firstData_marker = firstData.marker) === null || _firstData_marker === void 0 ? void 0 : _firstData_marker.colors, colorMap, isDarkTheme);
183
241
  const mapLegendToDataPoint = {};
184
242
  (_firstData_labels = firstData.labels) === null || _firstData_labels === void 0 ? void 0 : _firstData_labels.forEach((label, index)=>{
185
- var _firstData_values;
186
- const color = getColor(label, colorMap, isDarkTheme);
187
- //ToDo how to handle string data?
188
- const value = typeof ((_firstData_values = firstData.values) === null || _firstData_values === void 0 ? void 0 : _firstData_values[index]) === 'number' ? firstData.values[index] : 1;
189
- if (!mapLegendToDataPoint[label]) {
190
- mapLegendToDataPoint[label] = {
191
- legend: label,
243
+ const value = getNumberAtIndexOrDefault(firstData.values, index);
244
+ if ((0, _chartutilities.isInvalidValue)(value) || value < 0) {
245
+ return;
246
+ }
247
+ const legend = `${label}`;
248
+ // resolve color for each legend from the extracted colors
249
+ const color = (0, _PlotlyColorAdapter.resolveColor)(colors, index, legend, colorMap, isDarkTheme);
250
+ if (!mapLegendToDataPoint[legend]) {
251
+ mapLegendToDataPoint[legend] = {
252
+ legend,
192
253
  data: value,
193
254
  color
194
255
  };
195
256
  } else {
196
- mapLegendToDataPoint[label].data += value;
257
+ mapLegendToDataPoint[legend].data += value;
197
258
  }
198
259
  });
199
260
  var _input_layout_width;
200
- const width = (_input_layout_width = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width) !== null && _input_layout_width !== void 0 ? _input_layout_width : 440;
261
+ const width = (_input_layout_width = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width) !== null && _input_layout_width !== void 0 ? _input_layout_width : 440;
201
262
  var _input_layout_height;
202
- const 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 : 220;
263
+ const height = (_input_layout_height = (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 220;
203
264
  const hideLabels = firstData.textinfo ? ![
204
265
  'value',
205
266
  'percent',
@@ -207,82 +268,110 @@ const transformPlotlyJsonToDonutProps = (input, colorMap, isDarkTheme)=>{
207
268
  ].includes(firstData.textinfo) : false;
208
269
  const donutMarginHorizontal = hideLabels ? 0 : 80;
209
270
  const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
210
- const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : 0;
271
+ const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : _utilities.MIN_DONUT_RADIUS;
211
272
  const { chartTitle } = getTitles(input.layout);
212
273
  return {
213
274
  data: {
214
275
  chartTitle,
215
276
  chartData: Object.values(mapLegendToDataPoint)
216
277
  },
217
- hideLegend: ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false ? true : false,
218
- width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
278
+ hideLegend: ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false ? true : false,
279
+ width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
219
280
  height,
220
281
  innerRadius,
221
282
  hideLabels,
222
283
  showLabelsInPercent: firstData.textinfo ? [
223
284
  'percent',
224
285
  'label+percent'
225
- ].includes(firstData.textinfo) : true
286
+ ].includes(firstData.textinfo) : true,
287
+ roundCorners: true
226
288
  };
227
289
  };
228
- const transformPlotlyJsonToVSBCProps = (input, colorMap, isDarkTheme, fallbackVSBC)=>{
229
- var _input_layout, _input_layout1;
290
+ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
291
+ var _input_layout, _input_layout1, _vsbcData_;
230
292
  const mapXToDataPoints = {};
231
293
  let yMaxValue = 0;
232
294
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
233
- const { legends, hideLegend } = getLegendProps(input.data, input.layout);
295
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
296
+ let colorScale = undefined;
234
297
  let yMinValue = 0;
235
298
  input.data.forEach((series, index1)=>{
236
- var _series_x;
299
+ 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, _input_layout_template_layout1, _input_layout_template1, _input_layout2, _series_line;
300
+ if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_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[0]) === 'number') {
301
+ colorScale = createColorScale(input.layout, series);
302
+ }
237
303
  const isXYearCategory = (0, _chartutilities.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
238
- (_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x.forEach((x, index2)=>{
239
- var _series_y;
240
- if (!mapXToDataPoints[x]) {
241
- mapXToDataPoints[x] = {
242
- xAxisPoint: isXYearCategory ? x.toString() : x,
243
- chartData: [],
244
- lineData: []
245
- };
246
- }
247
- const legend = legends[index1];
248
- var _series_y_index2;
249
- const yVal = (_series_y_index2 = (_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index2]) !== null && _series_y_index2 !== void 0 ? _series_y_index2 : 0;
250
- if (series.type === 'bar') {
251
- const color = getColor(legend, colorMap, isDarkTheme);
252
- mapXToDataPoints[x].chartData.push({
253
- legend,
254
- data: yVal,
255
- color
256
- });
257
- yMaxValue = Math.max(yMaxValue, yVal);
258
- } else if (series.type === 'scatter' || !!fallbackVSBC) {
259
- var _series_line;
260
- const color = getColor(legend, colorMap, isDarkTheme);
261
- const lineOptions = getLineOptions(series.line);
262
- const dashType = ((_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.dash) || 'solid';
263
- const legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
264
- mapXToDataPoints[x].lineData.push({
265
- legend,
266
- legendShape,
267
- y: yVal,
268
- color,
269
- ...lineOptions ? {
270
- lineOptions
271
- } : {},
272
- useSecondaryYScale: usesSecondaryYScale(series)
273
- });
274
- if (!usesSecondaryYScale(series)) {
275
- yMaxValue = Math.max(yMaxValue, yVal);
304
+ // extract bar colors for each series only once
305
+ const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_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, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
306
+ // extract line colors for each series only once
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);
308
+ const xValues = series.x;
309
+ const isXDate = (0, _chartutilities.isDateArray)(xValues);
310
+ const isXString = (0, _chartutilities.isStringArray)(xValues);
311
+ const isXNumber = (0, _chartutilities.isNumberArray)(xValues);
312
+ const validXYRanges = getValidXYRanges(series);
313
+ validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
314
+ const rangeXValues = series.x.slice(rangeStart, rangeEnd);
315
+ const rangeYValues = series.y.slice(rangeStart, rangeEnd);
316
+ rangeXValues.forEach((x, index2)=>{
317
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
318
+ if (!mapXToDataPoints[x]) {
319
+ mapXToDataPoints[x] = {
320
+ xAxisPoint: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
321
+ chartData: [],
322
+ lineData: []
323
+ };
276
324
  }
277
- }
278
- yMaxValue = Math.max(yMaxValue, yVal);
279
- yMinValue = Math.min(yMinValue, yVal);
325
+ const legend = legends[index1];
326
+ // resolve color for each legend's bars from the colorscale or extracted colors
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);
329
+ const yVal = rangeYValues[index2];
330
+ if (series.type === 'bar') {
331
+ var _rgb_copy_formatHex8;
332
+ mapXToDataPoints[x].chartData.push({
333
+ legend,
334
+ data: yVal,
335
+ color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
336
+ opacity
337
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
338
+ });
339
+ if (typeof yVal === 'number') {
340
+ yMaxValue = Math.max(yMaxValue, yVal);
341
+ }
342
+ } else if (series.type === 'scatter' || !!fallbackVSBC) {
343
+ var _series_mode;
344
+ const lineColor = (0, _PlotlyColorAdapter.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
345
+ const lineOptions = !((_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('text')) ? getLineOptions(series.line) : undefined;
346
+ const legendShape = getLegendShape(series);
347
+ var _rgb_copy_formatHex81;
348
+ mapXToDataPoints[x].lineData.push({
349
+ legend: legend + (validXYRanges.length > 1 ? `.${rangeIdx + 1}` : ''),
350
+ legendShape,
351
+ y: yVal,
352
+ color: (_rgb_copy_formatHex81 = (0, _d3color.rgb)(lineColor).copy({
353
+ opacity
354
+ }).formatHex8()) !== null && _rgb_copy_formatHex81 !== void 0 ? _rgb_copy_formatHex81 : color,
355
+ lineOptions: {
356
+ ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
357
+ mode: series.mode
358
+ },
359
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout)
360
+ });
361
+ if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
362
+ yMaxValue = Math.max(yMaxValue, yVal);
363
+ yMinValue = Math.min(yMinValue, yVal);
364
+ }
365
+ }
366
+ yMaxValue = Math.max(yMaxValue, yVal);
367
+ });
280
368
  });
281
369
  });
282
370
  const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
371
+ const vsbcData = Object.values(mapXToDataPoints);
283
372
  var _input_layout_height;
284
373
  return {
285
- data: Object.values(mapXToDataPoints),
374
+ data: vsbcData,
286
375
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
287
376
  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,
288
377
  barWidth: 'auto',
@@ -293,19 +382,49 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, isDarkTheme, fallbackVS
293
382
  yAxisTitle,
294
383
  mode: 'plotly',
295
384
  ...secondaryYAxisValues,
385
+ wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
296
386
  hideTickOverlap: true,
297
387
  barGapMax: 2,
298
- hideLegend
388
+ hideLegend,
389
+ roundCorners: true,
390
+ showYAxisLables: true,
391
+ noOfCharsToTruncate: 20,
392
+ showYAxisLablesTooltip: true,
393
+ ...getAxisCategoryOrderProps(input.data, input.layout)
299
394
  };
300
395
  };
301
- const transformPlotlyJsonToGVBCProps = (input, colorMap, isDarkTheme)=>{
302
- var _input_layout, _input_layout1;
396
+ const createColorScale = (layout, series)=>{
397
+ var _layout_coloraxis, _series_marker, _layout_coloraxis1, _layout_coloraxis2;
398
+ const scale = layout === null || layout === void 0 ? void 0 : (_layout_coloraxis = layout.coloraxis) === null || _layout_coloraxis === void 0 ? void 0 : _layout_coloraxis.colorscale;
399
+ const colorValues = (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color;
400
+ var _layout_coloraxis_cmin, _layout_coloraxis_cmax;
401
+ const [dMin, dMax] = [
402
+ (_layout_coloraxis_cmin = layout === null || layout === void 0 ? void 0 : (_layout_coloraxis1 = layout.coloraxis) === null || _layout_coloraxis1 === void 0 ? void 0 : _layout_coloraxis1.cmin) !== null && _layout_coloraxis_cmin !== void 0 ? _layout_coloraxis_cmin : Math.min(...colorValues),
403
+ (_layout_coloraxis_cmax = layout === null || layout === void 0 ? void 0 : (_layout_coloraxis2 = layout.coloraxis) === null || _layout_coloraxis2 === void 0 ? void 0 : _layout_coloraxis2.cmax) !== null && _layout_coloraxis_cmax !== void 0 ? _layout_coloraxis_cmax : Math.max(...colorValues)
404
+ ];
405
+ // Normalize colorscale domain to actual data domain
406
+ const scaleDomain = scale.map(([pos])=>dMin + pos * (dMax - dMin));
407
+ const scaleColors = scale.map((item)=>item[1]);
408
+ return (0, _d3scale.scaleLinear)().domain(scaleDomain).range(scaleColors);
409
+ };
410
+ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
411
+ var _input_layout, _input_layout1, _gvbcData_;
303
412
  const mapXToDataPoints = {};
304
413
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
305
- const { legends, hideLegend } = getLegendProps(input.data, input.layout);
414
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
415
+ let colorScale = undefined;
306
416
  input.data.forEach((series, index1)=>{
307
- var _series_x;
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;
418
+ if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_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[0]) === 'number') {
419
+ colorScale = createColorScale(input.layout, series);
420
+ }
421
+ // extract colors for each series only once
422
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_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, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
308
423
  (_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x.forEach((x, index2)=>{
424
+ var _series_y;
425
+ if ((0, _chartutilities.isInvalidValue)(x) || (0, _chartutilities.isInvalidValue)((_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index2])) {
426
+ return;
427
+ }
309
428
  if (!mapXToDataPoints[x]) {
310
429
  mapXToDataPoints[x] = {
311
430
  name: x.toString(),
@@ -313,25 +432,30 @@ const transformPlotlyJsonToGVBCProps = (input, colorMap, isDarkTheme)=>{
313
432
  };
314
433
  }
315
434
  if (series.type === 'bar') {
316
- var _series_y;
435
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
317
436
  const legend = legends[index1];
318
- const color = getColor(legend, colorMap, isDarkTheme);
319
- var _series_y_index2;
437
+ // resolve color for each legend's bars from the colorscale or extracted colors
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;
320
441
  mapXToDataPoints[x].series.push({
321
442
  key: legend,
322
- data: (_series_y_index2 = (_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index2]) !== null && _series_y_index2 !== void 0 ? _series_y_index2 : 0,
443
+ data: series.y[index2],
323
444
  xAxisCalloutData: x,
324
- 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,
325
448
  legend,
326
- useSecondaryYScale: usesSecondaryYScale(series)
449
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout)
327
450
  });
328
451
  }
329
452
  });
330
453
  });
331
454
  const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
455
+ const gvbcData = Object.values(mapXToDataPoints);
332
456
  var _input_layout_height;
333
457
  return {
334
- data: Object.values(mapXToDataPoints),
458
+ data: gvbcData,
335
459
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
336
460
  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,
337
461
  barWidth: 'auto',
@@ -341,30 +465,47 @@ const transformPlotlyJsonToGVBCProps = (input, colorMap, isDarkTheme)=>{
341
465
  mode: 'plotly',
342
466
  ...secondaryYAxisValues,
343
467
  hideTickOverlap: true,
344
- hideLegend
468
+ wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
469
+ hideLegend,
470
+ roundCorners: true,
471
+ ...getAxisCategoryOrderProps(input.data, input.layout)
345
472
  };
346
473
  };
347
- const transformPlotlyJsonToVBCProps = (input, colorMap, isDarkTheme)=>{
348
- var _input_layout, _input_layout1;
474
+ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
475
+ var _input_layout, _input_layout1, _vbcData_;
349
476
  const vbcData = [];
350
- const { legends, hideLegend } = getLegendProps(input.data, input.layout);
477
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
478
+ let colorScale = undefined;
351
479
  input.data.forEach((series, seriesIdx)=>{
352
- var _series_xbins, _series_xbins1, _series_xbins2;
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;
353
481
  if (!series.x) {
354
482
  return;
355
483
  }
356
- const isXString = isStringArray(series.x);
484
+ if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_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[0]) === 'number') {
485
+ colorScale = createColorScale(input.layout, series);
486
+ }
487
+ // extract colors for each series only once
488
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_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, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
489
+ const xValues = [];
490
+ const yValues = [];
491
+ series.x.forEach((xVal, index)=>{
492
+ const yVal = getNumberAtIndexOrDefault(series.y, index);
493
+ if ((0, _chartutilities.isInvalidValue)(xVal) || (0, _chartutilities.isInvalidValue)(yVal)) {
494
+ return;
495
+ }
496
+ xValues.push(xVal);
497
+ yValues.push(yVal);
498
+ });
499
+ const isXString = (0, _chartutilities.isStringArray)(xValues);
357
500
  // TODO: In case of a single bin, add an empty bin of the same size to prevent the
358
501
  // default bar width from being used and ensure the bar spans the full intended range.
359
- const xBins = createBins(series.x, (_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);
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);
360
503
  const yBins = xBins.map(()=>[]);
361
504
  let total = 0;
362
- series.x.forEach((xVal, index)=>{
505
+ xValues.forEach((xVal, index)=>{
363
506
  const binIdx = findBinIndex(xBins, xVal, isXString);
364
507
  if (binIdx !== -1) {
365
- var _series_y;
366
- var _series_y_index;
367
- yBins[binIdx].push((_series_y_index = (_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index]) !== null && _series_y_index !== void 0 ? _series_y_index : 1);
508
+ yBins[binIdx].push(yValues[index]);
368
509
  }
369
510
  });
370
511
  const y = yBins.map((bin)=>{
@@ -373,14 +514,20 @@ const transformPlotlyJsonToVBCProps = (input, colorMap, isDarkTheme)=>{
373
514
  return yVal;
374
515
  });
375
516
  xBins.forEach((bin, index)=>{
517
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
376
518
  const legend = legends[seriesIdx];
377
- const color = getColor(legend, colorMap, isDarkTheme);
519
+ // resolve color for each legend's bars from the colorscale or extracted colors
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);
378
522
  const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
523
+ var _rgb_copy_formatHex8;
379
524
  vbcData.push({
380
525
  x: isXString ? bin.join(', ') : getBinCenter(bin),
381
526
  y: yVal,
382
527
  legend,
383
- 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,
384
531
  ...isXString ? {} : {
385
532
  xAxisCalloutData: `[${bin.x0} - ${bin.x1})`
386
533
  }
@@ -398,54 +545,102 @@ const transformPlotlyJsonToVBCProps = (input, colorMap, isDarkTheme)=>{
398
545
  yAxisTitle,
399
546
  mode: 'histogram',
400
547
  hideTickOverlap: true,
548
+ wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
401
549
  maxBarWidth: 50,
402
- hideLegend
550
+ hideLegend,
551
+ roundCorners: true,
552
+ ...getAxisCategoryOrderProps(input.data, input.layout)
403
553
  };
404
554
  };
405
- const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, colorMap, 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);
574
+ const isAreaChart = chartType === 'area';
575
+ const isScatterChart = chartType === 'scatter';
406
576
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
407
577
  let mode = 'tonexty';
408
- const { legends, hideLegend } = getLegendProps(input.data, input.layout);
578
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
409
579
  const chartData = input.data.map((series, index)=>{
410
- var _series_line;
580
+ var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
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;
582
+ // extract colors for each series only once
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);
411
584
  const xValues = series.x;
412
- const isString = typeof xValues[0] === 'string';
585
+ const isXString = (0, _chartutilities.isStringArray)(xValues);
413
586
  const isXDate = (0, _chartutilities.isDateArray)(xValues);
414
587
  const isXNumber = (0, _chartutilities.isNumberArray)(xValues);
588
+ const isXYearCategory = (0, _chartutilities.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
415
589
  const legend = legends[index];
416
- const lineColor = getColor(legend, colorMap, isDarkTheme);
590
+ // resolve color for each legend's lines from the extracted colors
591
+ const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
592
+ const seriesOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
417
593
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
418
- const lineOptions = getLineOptions(series.line);
419
- const dashType = ((_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.dash) || 'solid';
420
- const legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
421
- return {
422
- legend,
423
- legendShape,
424
- data: xValues.map((x, i)=>{
425
- var _series_marker, _series_marker1;
426
- return {
427
- x: isString ? isXDate ? new Date(x) : isXNumber ? parseFloat(x) : x : x,
428
- y: series.y[i],
429
- ...Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? {
430
- markerSize: series.marker.size[i]
431
- } : typeof ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.size) === 'number' ? {
432
- markerSize: series.marker.size
433
- } : {}
434
- };
435
- }),
436
- color: lineColor,
437
- ...lineOptions ? {
438
- lineOptions
439
- } : {},
440
- useSecondaryYScale: usesSecondaryYScale(series)
441
- };
442
- });
594
+ const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) ? getLineOptions(series.line) : undefined;
595
+ const legendShape = getLegendShape(series);
596
+ const validXYRanges = getValidXYRanges(series);
597
+ return validXYRanges.map(([rangeStart, rangeEnd], rangeIdx)=>{
598
+ var _series_marker;
599
+ const rangeXValues = xValues.slice(rangeStart, rangeEnd);
600
+ const rangeYValues = series.y.slice(rangeStart, rangeEnd);
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) : [];
602
+ const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : undefined;
603
+ var _rgb_copy_formatHex8;
604
+ return {
605
+ legend,
606
+ legendShape,
607
+ data: rangeXValues.map((x, i)=>{
608
+ var _series_marker, _series_marker1;
609
+ return {
610
+ x: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
611
+ y: rangeYValues[i],
612
+ ...Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? {
613
+ markerSize: markerSizes[i]
614
+ } : typeof ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.size) === 'number' ? {
615
+ markerSize: series.marker.size
616
+ } : {},
617
+ ...textValues ? {
618
+ text: textValues[i]
619
+ } : {}
620
+ };
621
+ }),
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,
625
+ lineOptions: {
626
+ ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
627
+ mode: series.mode
628
+ },
629
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout)
630
+ };
631
+ });
632
+ }).flat();
443
633
  const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
444
634
  const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
635
+ const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
445
636
  const chartProps = {
446
637
  chartTitle,
447
638
  lineChartData: chartData
448
639
  };
640
+ const scatterChartProps = {
641
+ chartTitle,
642
+ scatterChartData: chartData
643
+ };
449
644
  if (isAreaChart) {
450
645
  var _input_layout, _input_layout1;
451
646
  var _input_layout_height;
@@ -460,13 +655,14 @@ const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, colorMap, is
460
655
  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,
461
656
  hideTickOverlap: true,
462
657
  useUTC: false,
463
- hideLegend
658
+ hideLegend,
659
+ optimizeLargeData: numDataPoints > 1000
464
660
  };
465
661
  } else {
466
662
  var _input_layout2, _input_layout3;
467
663
  var _input_layout_height1;
468
664
  return {
469
- data: chartProps,
665
+ data: isScatterChart ? scatterChartProps : chartProps,
470
666
  supportNegativeData: true,
471
667
  xAxisTitle,
472
668
  yAxisTitle,
@@ -478,26 +674,42 @@ const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, colorMap, is
478
674
  height: (_input_layout_height1 = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height1 !== void 0 ? _input_layout_height1 : 350,
479
675
  hideTickOverlap: true,
480
676
  useUTC: false,
481
- hideLegend
677
+ hideLegend,
678
+ optimizeLargeData: numDataPoints > 1000
482
679
  };
483
680
  }
484
681
  };
485
- const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, isDarkTheme)=>{
682
+ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
486
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;
487
- const { legends, hideLegend } = getLegendProps(input.data, input.layout);
684
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
685
+ let colorScale = undefined;
488
686
  const chartData = input.data.map((series, index)=>{
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;
688
+ if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_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[0]) === 'number') {
689
+ colorScale = createColorScale(input.layout, series);
690
+ }
691
+ // extract colors for each series only once
692
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_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, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
489
693
  const legend = legends[index];
490
- const color = getColor(legend, colorMap, isDarkTheme);
491
694
  return series.y.map((yValue, i)=>{
695
+ var _series_x, _series_marker, _series_marker1, _series_marker_color, _series_marker2;
696
+ if ((0, _chartutilities.isInvalidValue)((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]) || (0, _chartutilities.isInvalidValue)(yValue)) {
697
+ return null;
698
+ }
699
+ // resolve color for each legend's bars from the colorscale or extracted colors
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;
492
703
  return {
493
704
  x: series.x[i],
494
705
  y: yValue,
495
706
  legend,
496
- 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
497
710
  };
498
- });
499
- }).reverse().flat() //reversing the order to invert the Y bars order as required by plotly.
500
- .reverse();
711
+ }).filter((point)=>point !== null);
712
+ }).flat();
501
713
  var _input_layout_height;
502
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;
503
715
  var _input_layout_margin_l;
@@ -523,31 +735,43 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, isDark
523
735
  hideTickOverlap: true,
524
736
  noOfCharsToTruncate: 20,
525
737
  showYAxisLablesTooltip: true,
526
- hideLegend
738
+ hideLegend,
739
+ roundCorners: true,
740
+ ...getAxisCategoryOrderProps(input.data, input.layout)
527
741
  };
528
742
  };
529
- const transformPlotlyJsonToHeatmapProps = (input)=>{
530
- var _input_layout, _input_layout1;
743
+ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
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;
531
745
  const firstData = input.data[0];
532
746
  const heatmapDataPoints = [];
533
747
  let zMin = Number.POSITIVE_INFINITY;
534
748
  let zMax = Number.NEGATIVE_INFINITY;
535
749
  if (firstData.type === 'histogram2d') {
536
- var _firstData_xbins, _firstData_xbins1, _firstData_xbins2, _firstData_ybins, _firstData_ybins1, _firstData_ybins2, _firstData_x;
537
- const isXString = isStringArray(firstData.x);
538
- const isYString = isStringArray(firstData.y);
539
- const xBins = createBins(firstData.x, (_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);
540
- const yBins = createBins(firstData.y, (_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);
541
- const zBins = yBins.map(()=>xBins.map(()=>[]));
542
- let total = 0;
750
+ var _firstData_x, _firstData_xbins, _firstData_xbins1, _firstData_xbins2, _firstData_ybins, _firstData_ybins1, _firstData_ybins2;
751
+ const xValues = [];
752
+ const yValues = [];
753
+ const zValues = [];
543
754
  (_firstData_x = firstData.x) === null || _firstData_x === void 0 ? void 0 : _firstData_x.forEach((xVal, index)=>{
544
755
  var _firstData_y;
756
+ const zVal = getNumberAtIndexOrDefault(firstData.z, index);
757
+ if ((0, _chartutilities.isInvalidValue)(xVal) || (0, _chartutilities.isInvalidValue)((_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y[index]) || (0, _chartutilities.isInvalidValue)(zVal)) {
758
+ return;
759
+ }
760
+ xValues.push(xVal);
761
+ yValues.push(firstData.y[index]);
762
+ zValues.push(zVal);
763
+ });
764
+ const isXString = (0, _chartutilities.isStringArray)(xValues);
765
+ const isYString = (0, _chartutilities.isStringArray)(yValues);
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);
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);
768
+ const zBins = yBins.map(()=>xBins.map(()=>[]));
769
+ let total = 0;
770
+ xValues.forEach((xVal, index)=>{
545
771
  const xBinIdx = findBinIndex(xBins, xVal, isXString);
546
- const yBinIdx = findBinIndex(yBins, (_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y[index], isYString);
772
+ const yBinIdx = findBinIndex(yBins, yValues[index], isYString);
547
773
  if (xBinIdx !== -1 && yBinIdx !== -1) {
548
- var _firstData_z;
549
- var _firstData_z_index;
550
- zBins[yBinIdx][xBinIdx].push((_firstData_z_index = (_firstData_z = firstData.z) === null || _firstData_z === void 0 ? void 0 : _firstData_z[index]) !== null && _firstData_z_index !== void 0 ? _firstData_z_index : 1);
774
+ zBins[yBinIdx][xBinIdx].push(zValues[index]);
551
775
  }
552
776
  });
553
777
  const z = zBins.map((row)=>{
@@ -609,8 +833,23 @@ const transformPlotlyJsonToHeatmapProps = (input)=>{
609
833
  (0, _colors.getColorFromToken)(_colors.DataVizPalette.color2),
610
834
  (0, _colors.getColorFromToken)(_colors.DataVizPalette.color3)
611
835
  ];
612
- const domainValuesForColorScale = Array.isArray(firstData.colorscale) ? firstData.colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
613
- const rangeValuesForColorScale = Array.isArray(firstData.colorscale) ? firstData.colorscale.map((arr)=>arr[1]) : defaultRange;
836
+ var _firstData_colorscale, _ref, _ref1, _ref2, _ref3;
837
+ 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;
838
+ // determine if the types diverging, sequential or sequentialminus are present in colorscale
839
+ if (colorscale && typeof colorscale === 'object' && ('diverging' in colorscale || 'sequential' in colorscale || 'sequentialminus' in colorscale)) {
840
+ const isDivergent = zMin < 0 && zMax > 0; // Data spans both positive and negative values
841
+ const isSequential = zMin >= 0; // Data is entirely positive
842
+ const isSequentialMinus = zMax <= 0; // Data is entirely negative
843
+ if (isDivergent) {
844
+ colorscale = colorscale === null || colorscale === void 0 ? void 0 : colorscale.diverging;
845
+ } else if (isSequential) {
846
+ colorscale = colorscale === null || colorscale === void 0 ? void 0 : colorscale.sequential;
847
+ } else if (isSequentialMinus) {
848
+ colorscale = colorscale === null || colorscale === void 0 ? void 0 : colorscale.sequentialminus;
849
+ }
850
+ }
851
+ const domainValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
852
+ const rangeValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[1]) : defaultRange;
614
853
  const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
615
854
  var _input_layout_height;
616
855
  return {
@@ -625,33 +864,44 @@ const transformPlotlyJsonToHeatmapProps = (input)=>{
625
864
  xAxisTitle,
626
865
  yAxisTitle,
627
866
  sortOrder: 'none',
628
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
629
- 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,
867
+ width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
868
+ 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,
630
869
  hideTickOverlap: true,
631
870
  noOfCharsToTruncate: 20,
632
- showYAxisLablesTooltip: true
871
+ showYAxisLablesTooltip: true,
872
+ wrapXAxisLables: true,
873
+ ...getAxisCategoryOrderProps([
874
+ firstData
875
+ ], input.layout)
633
876
  };
634
877
  };
635
- const transformPlotlyJsonToSankeyProps = (input, colorMap, isDarkTheme)=>{
636
- var _node_label, _input_layout, _input_layout1;
878
+ const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
879
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _node_label, _input_layout1, _input_layout2;
637
880
  const { link, node } = input.data[0];
638
881
  var _link_value;
639
- const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>({
882
+ const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>{
883
+ var _link_source, _link_target;
884
+ if ((0, _chartutilities.isInvalidValue)(val) || (0, _chartutilities.isInvalidValue)(link === null || link === void 0 ? void 0 : (_link_source = link.source) === null || _link_source === void 0 ? void 0 : _link_source[index]) || (0, _chartutilities.isInvalidValue)(link === null || link === void 0 ? void 0 : (_link_target = link.target) === null || _link_target === void 0 ? void 0 : _link_target[index])) {
885
+ return null;
886
+ }
887
+ return {
640
888
  value: val,
641
889
  source: link === null || link === void 0 ? void 0 : link.source[index],
642
890
  target: link === null || link === void 0 ? void 0 : link.target[index]
643
- })) // eslint-disable-next-line @typescript-eslint/no-shadow
644
- // Filter out negative nodes, unequal nodes and self-references (circular links)
645
- .filter((x)=>x.source >= 0 && x.target >= 0 && x.source !== x.target);
891
+ };
892
+ }) // Filter out negative nodes, unequal nodes and self-references (circular links)
893
+ .filter((x)=>x !== null && x.source >= 0 && x.target >= 0 && x.source !== x.target);
894
+ const extractedNodeColors = (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, node === null || node === void 0 ? void 0 : node.color, colorMap, isDarkTheme);
646
895
  const sankeyChartData = {
647
896
  nodes: (_node_label = node.label) === null || _node_label === void 0 ? void 0 : _node_label.map((label, index)=>{
648
- const color = getColor(label, colorMap, isDarkTheme);
897
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedNodeColors, index, label, colorMap, isDarkTheme);
649
898
  return {
650
899
  nodeId: index,
651
900
  name: label,
652
901
  color
653
902
  };
654
903
  }),
904
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
655
905
  links: validLinks.map((validLink, index)=>{
656
906
  return {
657
907
  ...validLink
@@ -670,18 +920,20 @@ const transformPlotlyJsonToSankeyProps = (input, colorMap, isDarkTheme)=>{
670
920
  chartTitle,
671
921
  SankeyChartData: sankeyChartData
672
922
  },
673
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
674
- 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 : 468
923
+ width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
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
675
925
  };
676
926
  };
677
- const transformPlotlyJsonToGaugeProps = (input, colorMap, isDarkTheme)=>{
678
- var _firstData_gauge_steps, _firstData_gauge, _firstData_gauge_axis_range, _firstData_gauge_axis, _firstData_gauge1, _firstData_gauge_axis_range1, _firstData_gauge_axis1, _firstData_gauge2, _firstData_delta, _firstData_gauge_axis_range2, _firstData_gauge_axis2, _firstData_gauge3, _firstData_gauge_axis_range3, _firstData_gauge_axis3, _firstData_gauge4, _firstData_gauge_axis_range4, _firstData_gauge_axis4, _firstData_gauge5, _firstData_gauge_axis_range5, _firstData_gauge_axis5, _firstData_gauge6, _input_layout, _input_layout1, _firstData_gauge_steps1, _firstData_gauge7;
927
+ const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
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;
679
929
  const firstData = input.data[0];
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;
931
+ 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, stepsColors, colorMap, isDarkTheme);
680
932
  var _firstData_gauge_axis_range_, _firstData_value, _firstData_gauge_axis_range_1, _firstData_value1;
681
- const segments = ((_firstData_gauge = firstData.gauge) === null || _firstData_gauge === void 0 ? void 0 : (_firstData_gauge_steps = _firstData_gauge.steps) === null || _firstData_gauge_steps === void 0 ? void 0 : _firstData_gauge_steps.length) ? firstData.gauge.steps.map((step, index)=>{
933
+ const segments = ((_firstData_gauge1 = firstData.gauge) === null || _firstData_gauge1 === void 0 ? void 0 : (_firstData_gauge_steps = _firstData_gauge1.steps) === null || _firstData_gauge_steps === void 0 ? void 0 : _firstData_gauge_steps.length) ? firstData.gauge.steps.map((step, index)=>{
682
934
  var _step_range, _step_range1;
683
935
  const legend = step.name || `Segment ${index + 1}`;
684
- const color = getColor(legend, colorMap, isDarkTheme);
936
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
685
937
  return {
686
938
  legend,
687
939
  size: ((_step_range = step.range) === null || _step_range === void 0 ? void 0 : _step_range[1]) - ((_step_range1 = step.range) === null || _step_range1 === void 0 ? void 0 : _step_range1[0]),
@@ -690,34 +942,36 @@ const transformPlotlyJsonToGaugeProps = (input, colorMap, isDarkTheme)=>{
690
942
  }) : [
691
943
  {
692
944
  legend: 'Current',
693
- size: (_firstData_value = firstData.value) !== null && _firstData_value !== void 0 ? _firstData_value : 0 - ((_firstData_gauge_axis_range_ = (_firstData_gauge1 = firstData.gauge) === null || _firstData_gauge1 === void 0 ? void 0 : (_firstData_gauge_axis = _firstData_gauge1.axis) === null || _firstData_gauge_axis === void 0 ? void 0 : (_firstData_gauge_axis_range = _firstData_gauge_axis.range) === null || _firstData_gauge_axis_range === void 0 ? void 0 : _firstData_gauge_axis_range[0]) !== null && _firstData_gauge_axis_range_ !== void 0 ? _firstData_gauge_axis_range_ : 0),
694
- color: getColor('Current', colorMap, isDarkTheme)
945
+ size: (_firstData_value = firstData.value) !== null && _firstData_value !== void 0 ? _firstData_value : 0 - ((_firstData_gauge_axis_range_ = (_firstData_gauge2 = firstData.gauge) === null || _firstData_gauge2 === void 0 ? void 0 : (_firstData_gauge_axis = _firstData_gauge2.axis) === null || _firstData_gauge_axis === void 0 ? void 0 : (_firstData_gauge_axis_range = _firstData_gauge_axis.range) === null || _firstData_gauge_axis_range === void 0 ? void 0 : _firstData_gauge_axis_range[0]) !== null && _firstData_gauge_axis_range_ !== void 0 ? _firstData_gauge_axis_range_ : 0),
946
+ color: _getGaugeAxisColor((_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, (_firstData_gauge3 = firstData.gauge) === null || _firstData_gauge3 === void 0 ? void 0 : (_firstData_gauge_axis1 = _firstData_gauge3.axis) === null || _firstData_gauge_axis1 === void 0 ? void 0 : _firstData_gauge_axis1.color, colorMap, isDarkTheme)
695
947
  },
696
948
  {
697
949
  legend: 'Target',
698
- size: ((_firstData_gauge_axis_range_1 = (_firstData_gauge2 = firstData.gauge) === null || _firstData_gauge2 === void 0 ? void 0 : (_firstData_gauge_axis1 = _firstData_gauge2.axis) === null || _firstData_gauge_axis1 === void 0 ? void 0 : (_firstData_gauge_axis_range1 = _firstData_gauge_axis1.range) === null || _firstData_gauge_axis_range1 === void 0 ? void 0 : _firstData_gauge_axis_range1[1]) !== null && _firstData_gauge_axis_range_1 !== void 0 ? _firstData_gauge_axis_range_1 : 100) - ((_firstData_value1 = firstData.value) !== null && _firstData_value1 !== void 0 ? _firstData_value1 : 0),
950
+ size: ((_firstData_gauge_axis_range_1 = (_firstData_gauge4 = firstData.gauge) === null || _firstData_gauge4 === void 0 ? void 0 : (_firstData_gauge_axis2 = _firstData_gauge4.axis) === null || _firstData_gauge_axis2 === void 0 ? void 0 : (_firstData_gauge_axis_range1 = _firstData_gauge_axis2.range) === null || _firstData_gauge_axis_range1 === void 0 ? void 0 : _firstData_gauge_axis_range1[1]) !== null && _firstData_gauge_axis_range_1 !== void 0 ? _firstData_gauge_axis_range_1 : 100) - ((_firstData_value1 = firstData.value) !== null && _firstData_value1 !== void 0 ? _firstData_value1 : 0),
699
951
  color: _colors.DataVizPalette.disabled
700
952
  }
701
953
  ];
702
954
  let sublabel;
703
- // let sublabelColor: string | undefined;
955
+ let sublabelColor;
704
956
  if ((_firstData_delta = firstData.delta) === null || _firstData_delta === void 0 ? void 0 : _firstData_delta.reference) {
705
957
  const diff = firstData.value - firstData.delta.reference;
706
958
  if (diff >= 0) {
959
+ var _input_layout_template_layout2, _input_layout_template2, _input_layout4, _firstData_delta_increasing, _firstData_delta1;
707
960
  sublabel = `\u25B2 ${diff}`;
708
- // const color = getColorFromToken(DataVizPalette.success, isDarkTheme);
709
- // sublabelColor = color;
961
+ const extractedIncreasingDeltaColors = (0, _PlotlyColorAdapter.extractColor)((_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_layout2 = _input_layout_template2.layout) === null || _input_layout_template_layout2 === void 0 ? void 0 : _input_layout_template_layout2.colorway, colorwayType, (_firstData_delta1 = firstData.delta) === null || _firstData_delta1 === void 0 ? void 0 : (_firstData_delta_increasing = _firstData_delta1.increasing) === null || _firstData_delta_increasing === void 0 ? void 0 : _firstData_delta_increasing.color, colorMap, isDarkTheme);
962
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
963
+ sublabelColor = color;
710
964
  } else {
965
+ var _input_layout_template_layout3, _input_layout_template3, _input_layout5, _firstData_delta_decreasing, _firstData_delta2;
711
966
  sublabel = `\u25BC ${Math.abs(diff)}`;
712
- // const color = getColorFromToken(DataVizPalette.error, isDarkTheme);
713
- // sublabelColor = color;
967
+ const extractedDecreasingDeltaColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template3 = _input_layout5.template) === null || _input_layout_template3 === void 0 ? void 0 : (_input_layout_template_layout3 = _input_layout_template3.layout) === null || _input_layout_template_layout3 === void 0 ? void 0 : _input_layout_template_layout3.colorway, colorwayType, (_firstData_delta2 = firstData.delta) === null || _firstData_delta2 === void 0 ? void 0 : (_firstData_delta_decreasing = _firstData_delta2.decreasing) === null || _firstData_delta_decreasing === void 0 ? void 0 : _firstData_delta_decreasing.color, colorMap, isDarkTheme);
968
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
969
+ sublabelColor = color;
714
970
  }
715
971
  }
716
- // const styles: GaugeChartProps['styles'] = {
717
- // sublabel: {
718
- // fill: sublabelColor,
719
- // },
720
- // };
972
+ const styles = {
973
+ sublabel: sublabelColor
974
+ };
721
975
  const { chartTitle } = getTitles(input.layout);
722
976
  var _firstData_value2, _input_layout_height;
723
977
  return {
@@ -726,18 +980,168 @@ const transformPlotlyJsonToGaugeProps = (input, colorMap, isDarkTheme)=>{
726
980
  chartTitle,
727
981
  sublabel,
728
982
  // range values can be null
729
- minValue: typeof ((_firstData_gauge3 = firstData.gauge) === null || _firstData_gauge3 === void 0 ? void 0 : (_firstData_gauge_axis2 = _firstData_gauge3.axis) === null || _firstData_gauge_axis2 === void 0 ? void 0 : (_firstData_gauge_axis_range2 = _firstData_gauge_axis2.range) === null || _firstData_gauge_axis_range2 === void 0 ? void 0 : _firstData_gauge_axis_range2[0]) === 'number' ? (_firstData_gauge4 = firstData.gauge) === null || _firstData_gauge4 === void 0 ? void 0 : (_firstData_gauge_axis3 = _firstData_gauge4.axis) === null || _firstData_gauge_axis3 === void 0 ? void 0 : (_firstData_gauge_axis_range3 = _firstData_gauge_axis3.range) === null || _firstData_gauge_axis_range3 === void 0 ? void 0 : _firstData_gauge_axis_range3[0] : undefined,
730
- maxValue: typeof ((_firstData_gauge5 = firstData.gauge) === null || _firstData_gauge5 === void 0 ? void 0 : (_firstData_gauge_axis4 = _firstData_gauge5.axis) === null || _firstData_gauge_axis4 === void 0 ? void 0 : (_firstData_gauge_axis_range4 = _firstData_gauge_axis4.range) === null || _firstData_gauge_axis_range4 === void 0 ? void 0 : _firstData_gauge_axis_range4[1]) === 'number' ? (_firstData_gauge6 = firstData.gauge) === null || _firstData_gauge6 === void 0 ? void 0 : (_firstData_gauge_axis5 = _firstData_gauge6.axis) === null || _firstData_gauge_axis5 === void 0 ? void 0 : (_firstData_gauge_axis_range5 = _firstData_gauge_axis5.range) === null || _firstData_gauge_axis_range5 === void 0 ? void 0 : _firstData_gauge_axis_range5[1] : undefined,
983
+ minValue: typeof ((_firstData_gauge5 = firstData.gauge) === null || _firstData_gauge5 === void 0 ? void 0 : (_firstData_gauge_axis3 = _firstData_gauge5.axis) === null || _firstData_gauge_axis3 === void 0 ? void 0 : (_firstData_gauge_axis_range2 = _firstData_gauge_axis3.range) === null || _firstData_gauge_axis_range2 === void 0 ? void 0 : _firstData_gauge_axis_range2[0]) === 'number' ? (_firstData_gauge6 = firstData.gauge) === null || _firstData_gauge6 === void 0 ? void 0 : (_firstData_gauge_axis4 = _firstData_gauge6.axis) === null || _firstData_gauge_axis4 === void 0 ? void 0 : (_firstData_gauge_axis_range3 = _firstData_gauge_axis4.range) === null || _firstData_gauge_axis_range3 === void 0 ? void 0 : _firstData_gauge_axis_range3[0] : undefined,
984
+ maxValue: typeof ((_firstData_gauge7 = firstData.gauge) === null || _firstData_gauge7 === void 0 ? void 0 : (_firstData_gauge_axis5 = _firstData_gauge7.axis) === null || _firstData_gauge_axis5 === void 0 ? void 0 : (_firstData_gauge_axis_range4 = _firstData_gauge_axis5.range) === null || _firstData_gauge_axis_range4 === void 0 ? void 0 : _firstData_gauge_axis_range4[1]) === 'number' ? (_firstData_gauge8 = firstData.gauge) === null || _firstData_gauge8 === void 0 ? void 0 : (_firstData_gauge_axis6 = _firstData_gauge8.axis) === null || _firstData_gauge_axis6 === void 0 ? void 0 : (_firstData_gauge_axis_range5 = _firstData_gauge_axis6.range) === null || _firstData_gauge_axis_range5 === void 0 ? void 0 : _firstData_gauge_axis_range5[1] : undefined,
731
985
  chartValueFormat: ()=>{
732
986
  var _firstData_value;
733
987
  var _firstData_value_toString;
734
988
  return (_firstData_value_toString = (_firstData_value = firstData.value) === null || _firstData_value === void 0 ? void 0 : _firstData_value.toString()) !== null && _firstData_value_toString !== void 0 ? _firstData_value_toString : '';
735
989
  },
736
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
737
- 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 : 220,
990
+ width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
991
+ 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 : 220,
738
992
  // TODO
739
993
  // styles,
740
- variant: ((_firstData_gauge7 = firstData.gauge) === null || _firstData_gauge7 === void 0 ? void 0 : (_firstData_gauge_steps1 = _firstData_gauge7.steps) === null || _firstData_gauge_steps1 === void 0 ? void 0 : _firstData_gauge_steps1.length) ? 'multiple-segments' : 'single-segment'
994
+ variant: ((_firstData_gauge9 = firstData.gauge) === null || _firstData_gauge9 === void 0 ? void 0 : (_firstData_gauge_steps1 = _firstData_gauge9.steps) === null || _firstData_gauge_steps1 === void 0 ? void 0 : _firstData_gauge_steps1.length) ? 'multiple-segments' : 'single-segment',
995
+ styles,
996
+ roundCorners: true
997
+ };
998
+ };
999
+ const cleanText = (text)=>{
1000
+ return text.replace(/&lt;[^&]*?&gt;/g, '').replace(/<[^>]*>/g, '').replace(/&lt;br&gt;|\\u003cbr\\u003e|<br>/gi, '').replace(/\$[^$]*\$/g, '$').trim();
1001
+ };
1002
+ const formatValue = (value, colIndex, cells)=>{
1003
+ if (value === null || typeof value === 'boolean') {
1004
+ return value;
1005
+ }
1006
+ const formatStr = Array.isArray(cells.format) ? cells.format[colIndex] : cells.format;
1007
+ const prefix = Array.isArray(cells.prefix) ? cells.prefix[colIndex] : cells.prefix;
1008
+ const suffix = Array.isArray(cells.suffix) ? cells.suffix[colIndex] : cells.suffix;
1009
+ let formatted = value;
1010
+ if (typeof value === 'number') {
1011
+ if (typeof formatStr === 'string') {
1012
+ try {
1013
+ formatted = (0, _d3format.format)(formatStr)(value);
1014
+ } catch {
1015
+ formatted = (0, _utilities.formatScientificLimitWidth)(value);
1016
+ }
1017
+ } else {
1018
+ formatted = (0, _utilities.formatScientificLimitWidth)(value);
1019
+ }
1020
+ }
1021
+ return `${prefix !== null && prefix !== void 0 ? prefix : ''}${formatted}${suffix !== null && suffix !== void 0 ? suffix : ''}`;
1022
+ };
1023
+ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
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;
1025
+ const tableData = input.data[0];
1026
+ const normalizeHeaders = (values, header)=>{
1027
+ const cleanedValues = Array.isArray(values[0]) ? values.map((row)=>row.map((cell)=>cleanText(cell)).filter(Boolean).join(' ')) : values.map((cell)=>cleanText(cell));
1028
+ return cleanedValues.map((value, colIndex)=>{
1029
+ var _header_font, _header_font1, _header_fill;
1030
+ const fontColorRaw = header === null || header === void 0 ? void 0 : (_header_font = header.font) === null || _header_font === void 0 ? void 0 : _header_font.color;
1031
+ let fontColor;
1032
+ if (Array.isArray(fontColorRaw)) {
1033
+ const colorEntry = fontColorRaw[colIndex];
1034
+ if (Array.isArray(colorEntry)) {
1035
+ fontColor = typeof colorEntry[0] === 'string' ? colorEntry[0] : undefined;
1036
+ } else if (typeof colorEntry === 'string') {
1037
+ fontColor = colorEntry;
1038
+ }
1039
+ } else if (typeof fontColorRaw === 'string') {
1040
+ fontColor = fontColorRaw;
1041
+ }
1042
+ const fontSizeRaw = header === null || header === void 0 ? void 0 : (_header_font1 = header.font) === null || _header_font1 === void 0 ? void 0 : _header_font1.size;
1043
+ let fontSize;
1044
+ if (Array.isArray(fontSizeRaw)) {
1045
+ fontSize = Array.isArray(fontSizeRaw[0]) ? fontSizeRaw[0][colIndex] : fontSizeRaw[colIndex];
1046
+ } else if (typeof fontSizeRaw === 'number') {
1047
+ fontSize = fontSizeRaw;
1048
+ }
1049
+ const updatedColIndex = colIndex >= 1 ? 1 : 0;
1050
+ const fillColorRaw = header === null || header === void 0 ? void 0 : (_header_fill = header.fill) === null || _header_fill === void 0 ? void 0 : _header_fill.color;
1051
+ const backgroundColor = Array.isArray(fillColorRaw) ? fillColorRaw[updatedColIndex] : fillColorRaw;
1052
+ const textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
1053
+ const textAlign = Array.isArray(textAlignRaw) ? textAlignRaw[colIndex] : textAlignRaw;
1054
+ const style = {
1055
+ ...typeof fontColor === 'string' ? {
1056
+ color: fontColor
1057
+ } : {},
1058
+ ...typeof fontSize === 'number' ? {
1059
+ fontSize
1060
+ } : {},
1061
+ ...typeof backgroundColor === 'string' ? {
1062
+ backgroundColor
1063
+ } : {},
1064
+ ...textAlign ? {
1065
+ textAlign
1066
+ } : {}
1067
+ };
1068
+ return {
1069
+ value,
1070
+ style
1071
+ };
1072
+ });
1073
+ };
1074
+ var _tableData_cells_values;
1075
+ const columns = (_tableData_cells_values = (_tableData_cells = tableData.cells) === null || _tableData_cells === void 0 ? void 0 : _tableData_cells.values) !== null && _tableData_cells_values !== void 0 ? _tableData_cells_values : [];
1076
+ const cells = tableData.cells.font ? tableData.cells : (_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_data = _input_layout_template.data) === null || _input_layout_template_data === void 0 ? void 0 : _input_layout_template_data.table[0].cells;
1077
+ const rows = columns[0].map((_, rowIndex)=>columns.map((col, colIndex)=>{
1078
+ var _cells_font, _cells_font1, _cells_fill;
1079
+ const cellValue = col[rowIndex];
1080
+ const cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
1081
+ const formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number' ? formatValue(cleanValue, colIndex, cells) : cleanValue;
1082
+ const rawFontColor = cells === null || cells === void 0 ? void 0 : (_cells_font = cells.font) === null || _cells_font === void 0 ? void 0 : _cells_font.color;
1083
+ let fontColor;
1084
+ if (Array.isArray(rawFontColor)) {
1085
+ const entry = rawFontColor[colIndex];
1086
+ const colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1087
+ fontColor = typeof colorValue === 'string' ? colorValue : undefined;
1088
+ } else if (typeof rawFontColor === 'string') {
1089
+ fontColor = rawFontColor;
1090
+ }
1091
+ const rawFontSize = cells === null || cells === void 0 ? void 0 : (_cells_font1 = cells.font) === null || _cells_font1 === void 0 ? void 0 : _cells_font1.size;
1092
+ let fontSize;
1093
+ if (Array.isArray(rawFontSize)) {
1094
+ const entry = rawFontSize[colIndex];
1095
+ const fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1096
+ fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
1097
+ } else if (typeof rawFontSize === 'number') {
1098
+ fontSize = rawFontSize;
1099
+ }
1100
+ const updatedColIndex = colIndex >= 1 ? 1 : 0;
1101
+ const rawBackgroundColor = cells === null || cells === void 0 ? void 0 : (_cells_fill = cells.fill) === null || _cells_fill === void 0 ? void 0 : _cells_fill.color;
1102
+ let backgroundColor;
1103
+ if (Array.isArray(rawBackgroundColor)) {
1104
+ const entry = rawBackgroundColor[updatedColIndex];
1105
+ const colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1106
+ backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
1107
+ } else if (typeof rawBackgroundColor === 'string') {
1108
+ backgroundColor = rawBackgroundColor;
1109
+ }
1110
+ const rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? cells.align[colIndex] : cells === null || cells === void 0 ? void 0 : cells.align;
1111
+ const textAlign = rawTextAlign;
1112
+ const style = {
1113
+ ...fontColor ? {
1114
+ color: fontColor
1115
+ } : {},
1116
+ ...typeof fontSize === 'number' ? {
1117
+ fontSize
1118
+ } : {},
1119
+ ...backgroundColor ? {
1120
+ backgroundColor
1121
+ } : {},
1122
+ ...textAlign ? {
1123
+ textAlign
1124
+ } : {}
1125
+ };
1126
+ return {
1127
+ value: formattedValue,
1128
+ style
1129
+ };
1130
+ }));
1131
+ const styles = {
1132
+ root: {
1133
+ ...((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_font = _input_layout1.font) === null || _input_layout_font === void 0 ? void 0 : _input_layout_font.size) ? {
1134
+ fontSize: input.layout.font.size
1135
+ } : {}
1136
+ }
1137
+ };
1138
+ var _tableData_header_values;
1139
+ return {
1140
+ headers: normalizeHeaders((_tableData_header_values = (_tableData_header = tableData.header) === null || _tableData_header === void 0 ? void 0 : _tableData_header.values) !== null && _tableData_header_values !== void 0 ? _tableData_header_values : [], ((_tableData_header1 = tableData.header) === null || _tableData_header1 === void 0 ? void 0 : _tableData_header1.font) ? tableData.header : (_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_data1 = _input_layout_template1.data) === null || _input_layout_template_data1 === void 0 ? void 0 : _input_layout_template_data1.table[0].header),
1141
+ rows,
1142
+ width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
1143
+ height: (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height,
1144
+ styles
741
1145
  };
742
1146
  };
743
1147
  const projectPolarToCartesian = (input)=>{
@@ -745,30 +1149,42 @@ const projectPolarToCartesian = (input)=>{
745
1149
  ...input
746
1150
  };
747
1151
  for(let sindex = 0; sindex < input.data.length; sindex++){
1152
+ var _series_r;
748
1153
  const series = input.data[sindex];
749
1154
  series.x = [];
750
1155
  series.y = [];
751
- for(let ptindex = 0; ptindex < series.r.length; ptindex++){
1156
+ var _series_r_length;
1157
+ for(let ptindex = 0; ptindex < ((_series_r_length = (_series_r = series.r) === null || _series_r === void 0 ? void 0 : _series_r.length) !== null && _series_r_length !== void 0 ? _series_r_length : 0); ptindex++){
1158
+ var _series_theta, _series_r1;
1159
+ if ((0, _chartutilities.isInvalidValue)((_series_theta = series.theta) === null || _series_theta === void 0 ? void 0 : _series_theta[ptindex]) || (0, _chartutilities.isInvalidValue)((_series_r1 = series.r) === null || _series_r1 === void 0 ? void 0 : _series_r1[ptindex])) {
1160
+ continue;
1161
+ }
752
1162
  const thetaRad = series.theta[ptindex] * Math.PI / 180;
753
1163
  const radius = series.r[ptindex];
754
- series.x[ptindex] = radius * Math.cos(thetaRad);
755
- series.y[ptindex] = radius * Math.sin(thetaRad);
1164
+ series.x.push(radius * Math.cos(thetaRad));
1165
+ series.y.push(radius * Math.sin(thetaRad));
756
1166
  }
757
1167
  projection.data[sindex] = series;
758
1168
  }
759
1169
  return projection;
760
1170
  };
1171
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
761
1172
  function isPlainObject(obj) {
762
1173
  return Object.prototype.toString.call(obj) === '[object Object]' && Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty');
763
1174
  }
1175
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
764
1176
  var arrayAttributes = [];
1177
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
765
1178
  var stack = [];
1179
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
766
1180
  var isArrayStack = [];
1181
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
767
1182
  var baseContainer, baseAttrName;
768
1183
  function findArrayAttributes(trace) {
769
1184
  // Init basecontainer and baseAttrName
770
1185
  crawlIntoTrace(baseContainer, 0, '');
771
1186
  }
1187
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
772
1188
  function crawlIntoTrace(container, i, astrPartial) {
773
1189
  var item = container[stack[i]];
774
1190
  var newAstrPartial = astrPartial + stack[i];
@@ -820,9 +1236,6 @@ function getLineOptions(line) {
820
1236
  }
821
1237
  return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
822
1238
  }
823
- const isStringArray = (arr)=>{
824
- return (0, _chartutilities.isArrayOfType)(arr, (value)=>typeof value === 'string');
825
- };
826
1239
  // TODO: Use binary search to find the appropriate bin for numeric value.
827
1240
  const findBinIndex = (bins, value, isString)=>{
828
1241
  if (typeof value === 'undefined' || value === null) {
@@ -841,7 +1254,7 @@ const createBins = (data, binStart, binEnd, binSize)=>{
841
1254
  if (!data || data.length === 0) {
842
1255
  return [];
843
1256
  }
844
- if (isStringArray(data)) {
1257
+ if ((0, _chartutilities.isStringArray)(data)) {
845
1258
  const categories = Array.from(new Set(data));
846
1259
  const start = typeof binStart === 'number' ? Math.ceil(binStart) : 0;
847
1260
  const stop = typeof binEnd === 'number' ? Math.floor(binEnd) + 1 : categories.length;
@@ -917,7 +1330,46 @@ const precisionRound = (value, precision)=>{
917
1330
  const factor = Math.pow(10, precision);
918
1331
  return Math.round(value * factor) / factor;
919
1332
  };
920
- 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)=>{
921
1373
  const legends = [];
922
1374
  if (data.length === 1) {
923
1375
  legends.push(data[0].name || '');
@@ -926,9 +1378,257 @@ const getLegendProps = (data, layout)=>{
926
1378
  legends.push(series.name || `Series ${index + 1}`);
927
1379
  });
928
1380
  }
929
- 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;
930
1383
  return {
931
1384
  legends,
932
- hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false ? true : hideLegends
1385
+ hideLegend: isMultiPlot || hideLegendsInferred || hideLegendsData
933
1386
  };
934
1387
  };
1388
+ const getNumberAtIndexOrDefault = (data, index)=>{
1389
+ if ((0, _chartutilities.isArrayOrTypedArray)(data)) {
1390
+ if (typeof data[index] !== 'number' || !isFinite(data[index])) {
1391
+ return;
1392
+ }
1393
+ return data[index];
1394
+ }
1395
+ return 1;
1396
+ };
1397
+ const getValidXYRanges = (series)=>{
1398
+ if (!(0, _chartutilities.isArrayOrTypedArray)(series.x) || !(0, _chartutilities.isArrayOrTypedArray)(series.y)) {
1399
+ return [];
1400
+ }
1401
+ const ranges = [];
1402
+ let start = 0;
1403
+ let end = 0;
1404
+ for(; end < series.x.length; end++){
1405
+ if ((0, _chartutilities.isInvalidValue)(series.x[end]) || (0, _chartutilities.isInvalidValue)(series.y[end])) {
1406
+ if (end - start > 0) {
1407
+ ranges.push([
1408
+ start,
1409
+ end
1410
+ ]);
1411
+ }
1412
+ start = end + 1;
1413
+ }
1414
+ }
1415
+ if (end - start > 0) {
1416
+ ranges.push([
1417
+ start,
1418
+ end
1419
+ ]);
1420
+ }
1421
+ return ranges;
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
+ };