@fluentui/react-charting 5.23.88 → 5.23.90

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 (110) hide show
  1. package/CHANGELOG.json +67 -1
  2. package/CHANGELOG.md +26 -2
  3. package/dist/react-charting.d.ts +72 -6
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +37 -1
  7. package/lib/ChartTable.d.ts +1 -0
  8. package/lib/ChartTable.js +2 -0
  9. package/lib/ChartTable.js.map +1 -0
  10. package/lib/components/ChartTable/ChartTable.base.d.ts +10 -0
  11. package/lib/components/ChartTable/ChartTable.base.js +44 -0
  12. package/lib/components/ChartTable/ChartTable.base.js.map +1 -0
  13. package/lib/components/ChartTable/ChartTable.d.ts +7 -0
  14. package/lib/components/ChartTable/ChartTable.js +9 -0
  15. package/lib/components/ChartTable/ChartTable.js.map +1 -0
  16. package/lib/components/ChartTable/ChartTable.styles.d.ts +2 -0
  17. package/lib/components/ChartTable/ChartTable.styles.js +28 -0
  18. package/lib/components/ChartTable/ChartTable.styles.js.map +1 -0
  19. package/lib/components/ChartTable/ChartTable.types.d.ts +58 -0
  20. package/lib/components/ChartTable/ChartTable.types.js +2 -0
  21. package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
  22. package/lib/components/ChartTable/index.d.ts +2 -0
  23. package/lib/components/ChartTable/index.js +3 -0
  24. package/lib/components/ChartTable/index.js.map +1 -0
  25. package/lib/components/DeclarativeChart/DeclarativeChart.d.ts +7 -6
  26. package/lib/components/DeclarativeChart/DeclarativeChart.js +15 -12
  27. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  28. package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +7 -0
  29. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +103 -0
  30. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  31. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -13
  32. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +141 -120
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  34. package/lib/components/LineChart/LineChart.base.js +19 -9
  35. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  36. package/lib/index.d.ts +2 -0
  37. package/lib/index.js +1 -0
  38. package/lib/index.js.map +1 -1
  39. package/lib/utilities/image-export-utils.js +25 -3
  40. package/lib/utilities/image-export-utils.js.map +1 -1
  41. package/lib-amd/ChartTable.d.ts +1 -0
  42. package/lib-amd/ChartTable.js +6 -0
  43. package/lib-amd/ChartTable.js.map +1 -0
  44. package/lib-amd/components/ChartTable/ChartTable.base.d.ts +10 -0
  45. package/lib-amd/components/ChartTable/ChartTable.base.js +45 -0
  46. package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -0
  47. package/lib-amd/components/ChartTable/ChartTable.d.ts +7 -0
  48. package/lib-amd/components/ChartTable/ChartTable.js +11 -0
  49. package/lib-amd/components/ChartTable/ChartTable.js.map +1 -0
  50. package/lib-amd/components/ChartTable/ChartTable.styles.d.ts +2 -0
  51. package/lib-amd/components/ChartTable/ChartTable.styles.js +32 -0
  52. package/lib-amd/components/ChartTable/ChartTable.styles.js.map +1 -0
  53. package/lib-amd/components/ChartTable/ChartTable.types.d.ts +58 -0
  54. package/lib-amd/components/ChartTable/ChartTable.types.js +5 -0
  55. package/lib-amd/components/ChartTable/ChartTable.types.js.map +1 -0
  56. package/lib-amd/components/ChartTable/index.d.ts +2 -0
  57. package/lib-amd/components/ChartTable/index.js +7 -0
  58. package/lib-amd/components/ChartTable/index.js.map +1 -0
  59. package/lib-amd/components/DeclarativeChart/DeclarativeChart.d.ts +7 -6
  60. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +14 -12
  61. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  62. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +7 -0
  63. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +108 -0
  64. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  65. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -13
  66. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +143 -124
  67. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  68. package/lib-amd/components/LineChart/LineChart.base.js +19 -9
  69. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  70. package/lib-amd/index.d.ts +2 -0
  71. package/lib-amd/index.js +3 -2
  72. package/lib-amd/index.js.map +1 -1
  73. package/lib-amd/utilities/image-export-utils.js +25 -3
  74. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  75. package/lib-commonjs/ChartTable.d.ts +1 -0
  76. package/lib-commonjs/ChartTable.js +5 -0
  77. package/lib-commonjs/ChartTable.js.map +1 -0
  78. package/lib-commonjs/components/ChartTable/ChartTable.base.d.ts +10 -0
  79. package/lib-commonjs/components/ChartTable/ChartTable.base.js +47 -0
  80. package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -0
  81. package/lib-commonjs/components/ChartTable/ChartTable.d.ts +7 -0
  82. package/lib-commonjs/components/ChartTable/ChartTable.js +12 -0
  83. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
  84. package/lib-commonjs/components/ChartTable/ChartTable.styles.d.ts +2 -0
  85. package/lib-commonjs/components/ChartTable/ChartTable.styles.js +32 -0
  86. package/lib-commonjs/components/ChartTable/ChartTable.styles.js.map +1 -0
  87. package/lib-commonjs/components/ChartTable/ChartTable.types.d.ts +58 -0
  88. package/lib-commonjs/components/ChartTable/ChartTable.types.js +3 -0
  89. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
  90. package/lib-commonjs/components/ChartTable/index.d.ts +2 -0
  91. package/lib-commonjs/components/ChartTable/index.js +6 -0
  92. package/lib-commonjs/components/ChartTable/index.js.map +1 -0
  93. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.d.ts +7 -6
  94. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +14 -11
  95. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  96. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +7 -0
  97. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +110 -0
  98. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  99. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -13
  100. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +143 -124
  101. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  102. package/lib-commonjs/components/LineChart/LineChart.base.js +19 -9
  103. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  104. package/lib-commonjs/index.d.ts +2 -0
  105. package/lib-commonjs/index.js +3 -1
  106. package/lib-commonjs/index.js.map +1 -1
  107. package/lib-commonjs/utilities/image-export-utils.js +25 -3
  108. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  109. package/package.json +4 -4
  110. package/src/components/ChartTable/ChartTable.types.ts +68 -0
@@ -1,13 +1,13 @@
1
1
  import { __assign } from "tslib";
2
2
  import { bin as d3Bin, extent as d3Extent, sum as d3Sum, min as d3Min, max as d3Max, range as d3Range, } from 'd3-array';
3
3
  import { scaleLinear as d3ScaleLinear } from 'd3-scale';
4
- import { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';
4
+ import { DataVizPalette, getColorFromToken } from '../../utilities/colors';
5
5
  import { GaugeChartVariant } from '../GaugeChart/index';
6
6
  import { findNumericMinMaxOfY } from '../../utilities/utilities';
7
7
  import { isArrayOfType, isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isYearArray, } from '@fluentui/chart-utilities';
8
8
  import { timeParse } from 'd3-time-format';
9
9
  import { curveCardinal as d3CurveCardinal } from 'd3-shape';
10
- import { color as d3Color } from 'd3-color';
10
+ import { extractColor, resolveColor } from './PlotlyColorAdapter';
11
11
  var dashOptions = {
12
12
  dot: {
13
13
  strokeDasharray: '1, 5',
@@ -46,6 +46,7 @@ var dashOptions = {
46
46
  lineBorderWidth: '4',
47
47
  },
48
48
  };
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
50
  var isMonth = function (possiblyMonthValue) {
50
51
  var parseFullMonth = timeParse('%B');
51
52
  var parseShortMonth = timeParse('%b');
@@ -63,6 +64,7 @@ function getTitles(layout) {
63
64
  };
64
65
  return titles;
65
66
  }
67
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
68
  export var correctYearMonth = function (xValues) {
67
69
  var presentYear = new Date().getFullYear();
68
70
  if (xValues.length > 0 && Array.isArray(xValues[0])) {
@@ -89,14 +91,6 @@ export var correctYearMonth = function (xValues) {
89
91
  });
90
92
  return xValues;
91
93
  };
92
- export var getColor = function (legendLabel, colorMap, isDarkTheme) {
93
- if (!colorMap.current.has(legendLabel)) {
94
- var nextColor = getNextColor(colorMap.current.size + 1, 0, isDarkTheme);
95
- colorMap.current.set(legendLabel, nextColor);
96
- return nextColor;
97
- }
98
- return colorMap.current.get(legendLabel);
99
- };
100
94
  var usesSecondaryYScale = function (series) {
101
95
  return series.yaxis === 'y2';
102
96
  };
@@ -140,56 +134,20 @@ var getSecondaryYAxisValues = function (data, layout, maxAllowedMinY, minAllowed
140
134
  },
141
135
  };
142
136
  };
143
- export var getSchemaColors = function (colors, colorMap, isDarkTheme) {
144
- var hexColors = [];
145
- if (!colors) {
146
- return undefined;
147
- }
148
- if (isArrayOrTypedArray(colors)) {
149
- colors.forEach(function (element, index) {
150
- var colorString = element === null || element === void 0 ? void 0 : element.toString().trim();
151
- var nextFluentColor = getColor("Label_".concat(index), colorMap, isDarkTheme);
152
- if (colorString) {
153
- var parsedColor = d3Color(colorString);
154
- hexColors.push(parsedColor ? parsedColor.formatHex() : nextFluentColor);
155
- }
156
- else {
157
- hexColors.push(nextFluentColor);
158
- }
159
- });
160
- }
161
- else if (typeof colors === 'string') {
162
- var parsedColor = d3Color(colors);
163
- return parsedColor ? parsedColor.formatHex() : getColor('Label_0', colorMap, isDarkTheme);
164
- }
165
- return hexColors;
166
- };
167
- export var _extractColor = function (useFluentVizColorPalette, colors, colorMap, isDarkTheme) {
168
- return !useFluentVizColorPalette && colors ? getSchemaColors(colors, colorMap, isDarkTheme) : undefined;
169
- };
170
- export var _resolveColor = function (extractedColors, index, legend, colorMap, isDarkTheme) {
171
- var color = '';
172
- if (extractedColors && isArrayOrTypedArray(extractedColors) && extractedColors[index]) {
173
- color = extractedColors[index % extractedColors.length];
174
- }
175
- else if (typeof extractedColors === 'string') {
176
- color = extractedColors;
177
- }
178
- else {
179
- color = getColor(legend, colorMap, isDarkTheme);
180
- }
181
- return color;
137
+ export var _getGaugeAxisColor = function (colorway, colorwayType, color, colorMap, isDarkTheme) {
138
+ var extractedColors = extractColor(colorway, colorwayType, color, colorMap, isDarkTheme);
139
+ return resolveColor(extractedColors, 0, '', colorMap, isDarkTheme);
182
140
  };
183
- export var transformPlotlyJsonToDonutProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
184
- var _a, _b, _c, _d, _e, _f, _g, _h;
141
+ export var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, isDarkTheme) {
142
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
185
143
  var firstData = input.data[0];
186
144
  // extract colors for each series only once
187
- var colors = _extractColor(useFluentVizColorPalette, (_a = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _a === void 0 ? void 0 : _a.colors, colorMap, isDarkTheme);
145
+ var colors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _d === void 0 ? void 0 : _d.colors, colorMap, isDarkTheme);
188
146
  var mapLegendToDataPoint = {};
189
- (_b = firstData.labels) === null || _b === void 0 ? void 0 : _b.forEach(function (label, index) {
147
+ (_e = firstData.labels) === null || _e === void 0 ? void 0 : _e.forEach(function (label, index) {
190
148
  var _a;
191
149
  // resolve color for each legend from the extracted colors
192
- var color = _resolveColor(colors, index, label, colorMap, isDarkTheme);
150
+ var color = resolveColor(colors, index, label, colorMap, isDarkTheme);
193
151
  //ToDo how to handle string data?
194
152
  var value = typeof ((_a = firstData.values) === null || _a === void 0 ? void 0 : _a[index]) === 'number' ? firstData.values[index] : 1;
195
153
  if (!mapLegendToDataPoint[label]) {
@@ -203,8 +161,8 @@ export var transformPlotlyJsonToDonutProps = function (input, colorMap, useFluen
203
161
  mapLegendToDataPoint[label].data += value;
204
162
  }
205
163
  });
206
- var width = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 440;
207
- var height = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : 220;
164
+ var width = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.width) !== null && _g !== void 0 ? _g : 440;
165
+ var height = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.height) !== null && _j !== void 0 ? _j : 220;
208
166
  var hideLabels = firstData.textinfo
209
167
  ? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)
210
168
  : false;
@@ -219,35 +177,36 @@ export var transformPlotlyJsonToDonutProps = function (input, colorMap, useFluen
219
177
  chartTitle: chartTitle,
220
178
  chartData: Object.values(mapLegendToDataPoint),
221
179
  },
222
- hideLegend: ((_g = input.layout) === null || _g === void 0 ? void 0 : _g.showlegend) === false ? true : false,
223
- width: (_h = input.layout) === null || _h === void 0 ? void 0 : _h.width,
180
+ hideLegend: ((_k = input.layout) === null || _k === void 0 ? void 0 : _k.showlegend) === false ? true : false,
181
+ width: (_l = input.layout) === null || _l === void 0 ? void 0 : _l.width,
224
182
  height: height,
225
183
  innerRadius: innerRadius,
226
184
  hideLabels: hideLabels,
227
185
  showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
186
+ roundCorners: true,
228
187
  };
229
188
  };
230
- export var transformPlotlyJsonToVSBCProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme, fallbackVSBC) {
189
+ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
231
190
  var _a, _b, _c;
232
191
  var mapXToDataPoints = {};
233
192
  var yMaxValue = 0;
234
193
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
235
194
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
236
195
  input.data.forEach(function (series, index1) {
237
- var _a, _b, _c;
196
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
238
197
  var isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
239
198
  // extract bar colors for each series only once
240
- var extractedBarColors = _extractColor(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
199
+ var extractedBarColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
241
200
  // extract line colors for each series only once
242
- var extractedLineColors = _extractColor(useFluentVizColorPalette, (_b = series.line) === null || _b === void 0 ? void 0 : _b.color, colorMap, isDarkTheme);
243
- (_c = series.x) === null || _c === void 0 ? void 0 : _c.forEach(function (x, index2) {
201
+ var extractedLineColors = extractColor((_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, colorwayType, (_h = series.line) === null || _h === void 0 ? void 0 : _h.color, colorMap, isDarkTheme);
202
+ (_j = series.x) === null || _j === void 0 ? void 0 : _j.forEach(function (x, index2) {
244
203
  var _a, _b, _c;
245
204
  if (!mapXToDataPoints[x]) {
246
205
  mapXToDataPoints[x] = { xAxisPoint: isXYearCategory ? x.toString() : x, chartData: [], lineData: [] };
247
206
  }
248
207
  var legend = legends[index1];
249
208
  // resolve color for each legend's bars from the extracted colors
250
- var color = _resolveColor(extractedBarColors, index1, legend, colorMap, isDarkTheme);
209
+ var color = resolveColor(extractedBarColors, index1, legend, colorMap, isDarkTheme);
251
210
  var yVal = (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2]) !== null && _b !== void 0 ? _b : 0;
252
211
  if (series.type === 'bar') {
253
212
  mapXToDataPoints[x].chartData.push({
@@ -258,7 +217,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, useFluent
258
217
  yMaxValue = Math.max(yMaxValue, yVal);
259
218
  }
260
219
  else if (series.type === 'scatter' || !!fallbackVSBC) {
261
- var lineColor = _resolveColor(extractedLineColors, index1, legend, colorMap, isDarkTheme);
220
+ var lineColor = resolveColor(extractedLineColors, index1, legend, colorMap, isDarkTheme);
262
221
  var lineOptions = getLineOptions(series.line);
263
222
  var dashType = ((_c = series.line) === null || _c === void 0 ? void 0 : _c.dash) || 'solid';
264
223
  var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
@@ -270,18 +229,18 @@ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, useFluent
270
229
  });
271
230
  });
272
231
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
273
- return __assign(__assign({ data: Object.values(mapXToDataPoints), width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barWidth: 'auto', yMaxValue: yMaxValue, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend });
232
+ return __assign(__assign({ data: Object.values(mapXToDataPoints), width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barWidth: 'auto', yMaxValue: yMaxValue, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true });
274
233
  };
275
- export var transformPlotlyJsonToGVBCProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
234
+ export var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
276
235
  var _a, _b, _c;
277
236
  var mapXToDataPoints = {};
278
237
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
279
238
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
280
239
  input.data.forEach(function (series, index1) {
281
- var _a, _b;
240
+ var _a, _b, _c, _d, _e;
282
241
  // extract colors for each series only once
283
- var extractedColors = _extractColor(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
284
- (_b = series.x) === null || _b === void 0 ? void 0 : _b.forEach(function (x, xIndex) {
242
+ var extractedColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
243
+ (_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
285
244
  var _a, _b;
286
245
  if (!mapXToDataPoints[x]) {
287
246
  mapXToDataPoints[x] = { name: x.toString(), series: [] };
@@ -289,7 +248,7 @@ export var transformPlotlyJsonToGVBCProps = function (input, colorMap, useFluent
289
248
  if (series.type === 'bar') {
290
249
  var legend = legends[index1];
291
250
  // resolve color for each legend's bars from the extracted colors
292
- var color = _resolveColor(extractedColors, index1, legend, colorMap, isDarkTheme);
251
+ var color = resolveColor(extractedColors, index1, legend, colorMap, isDarkTheme);
293
252
  mapXToDataPoints[x].series.push({
294
253
  key: legend,
295
254
  data: (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex]) !== null && _b !== void 0 ? _b : 0,
@@ -302,23 +261,23 @@ export var transformPlotlyJsonToGVBCProps = function (input, colorMap, useFluent
302
261
  });
303
262
  });
304
263
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
305
- return __assign(__assign({ data: Object.values(mapXToDataPoints), width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barwidth: 'auto', chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend });
264
+ return __assign(__assign({ data: Object.values(mapXToDataPoints), width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barwidth: 'auto', chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true });
306
265
  };
307
- export var transformPlotlyJsonToVBCProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
266
+ export var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
308
267
  var _a, _b, _c;
309
268
  var vbcData = [];
310
269
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
311
270
  input.data.forEach(function (series, seriesIdx) {
312
- var _a, _b, _c, _d;
271
+ var _a, _b, _c, _d, _e, _f, _g;
313
272
  if (!series.x) {
314
273
  return;
315
274
  }
316
275
  // extract colors for each series only once
317
- var extractedColors = _extractColor(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
276
+ var extractedColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
318
277
  var isXString = isStringArray(series.x);
319
278
  // TODO: In case of a single bin, add an empty bin of the same size to prevent the
320
279
  // default bar width from being used and ensure the bar spans the full intended range.
321
- var xBins = createBins(series.x, (_b = series.xbins) === null || _b === void 0 ? void 0 : _b.start, (_c = series.xbins) === null || _c === void 0 ? void 0 : _c.end, (_d = series.xbins) === null || _d === void 0 ? void 0 : _d.size);
280
+ var xBins = createBins(series.x, (_e = series.xbins) === null || _e === void 0 ? void 0 : _e.start, (_f = series.xbins) === null || _f === void 0 ? void 0 : _f.end, (_g = series.xbins) === null || _g === void 0 ? void 0 : _g.size);
322
281
  var yBins = xBins.map(function () { return []; });
323
282
  var total = 0;
324
283
  series.x.forEach(function (xVal, index) {
@@ -336,7 +295,7 @@ export var transformPlotlyJsonToVBCProps = function (input, colorMap, useFluentV
336
295
  xBins.forEach(function (bin, index) {
337
296
  var legend = legends[seriesIdx];
338
297
  // resolve color for each legend's bars from the extracted colors
339
- var color = _resolveColor(extractedColors, seriesIdx, legend, colorMap, isDarkTheme);
298
+ var color = resolveColor(extractedColors, seriesIdx, legend, colorMap, isDarkTheme);
340
299
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
341
300
  vbcData.push(__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
342
301
  ? {}
@@ -356,27 +315,28 @@ export var transformPlotlyJsonToVBCProps = function (input, colorMap, useFluentV
356
315
  hideTickOverlap: true,
357
316
  maxBarWidth: 50,
358
317
  hideLegend: hideLegend,
318
+ roundCorners: true,
359
319
  };
360
320
  };
361
- export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, colorMap, useFluentVizColorPalette, isDarkTheme) {
321
+ export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, isScatterMarkers, colorMap, colorwayType, isDarkTheme) {
362
322
  var _a, _b, _c, _d, _e, _f;
363
323
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
364
324
  var mode = 'tonexty';
365
325
  var _g = getLegendProps(input.data, input.layout), legends = _g.legends, hideLegend = _g.hideLegend;
366
326
  var chartData = input.data.map(function (series, index) {
367
- var _a, _b;
327
+ var _a, _b, _c, _d, _e, _f;
368
328
  // extract colors for each series only once
369
- var extractedColors = _extractColor(useFluentVizColorPalette, (_a = series.line) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
329
+ var extractedColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, isScatterMarkers ? (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color : (_e = series.line) === null || _e === void 0 ? void 0 : _e.color, colorMap, isDarkTheme);
370
330
  var xValues = series.x;
371
331
  var isString = typeof xValues[0] === 'string';
372
332
  var isXDate = isDateArray(xValues);
373
333
  var isXNumber = isNumberArray(xValues);
374
334
  var legend = legends[index];
375
335
  // resolve color for each legend's lines from the extracted colors
376
- var lineColor = _resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
336
+ var seriesColor = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
377
337
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
378
338
  var lineOptions = getLineOptions(series.line);
379
- var dashType = ((_b = series.line) === null || _b === void 0 ? void 0 : _b.dash) || 'solid';
339
+ var dashType = ((_f = series.line) === null || _f === void 0 ? void 0 : _f.dash) || 'solid';
380
340
  var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
381
341
  return __assign(__assign({ legend: legend, legendShape: legendShape, data: xValues.map(function (x, i) {
382
342
  var _a, _b;
@@ -385,7 +345,7 @@ export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart
385
345
  : typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
386
346
  ? { markerSize: series.marker.size }
387
347
  : {})));
388
- }), color: lineColor }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) });
348
+ }), color: seriesColor }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) });
389
349
  });
390
350
  var yMinMaxValues = findNumericMinMaxOfY(chartData);
391
351
  var _h = getTitles(input.layout), chartTitle = _h.chartTitle, xAxisTitle = _h.xAxisTitle, yAxisTitle = _h.yAxisTitle;
@@ -400,17 +360,17 @@ export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart
400
360
  return __assign(__assign({ data: chartProps, supportNegativeData: true, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle }, secondaryYAxisValues), { roundedTicks: true, yMinValue: yMinMaxValues.startValue, yMaxValue: yMinMaxValues.endValue, width: (_d = input.layout) === null || _d === void 0 ? void 0 : _d.width, height: (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : 350, hideTickOverlap: true, enableReflow: false, hideLegend: hideLegend, useUTC: false });
401
361
  }
402
362
  };
403
- export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
363
+ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, colorwayType, isDarkTheme) {
404
364
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
405
365
  var _s = getLegendProps(input.data, input.layout), legends = _s.legends, hideLegend = _s.hideLegend;
406
366
  var chartData = input.data
407
367
  .map(function (series, index) {
408
- var _a;
368
+ var _a, _b, _c, _d;
409
369
  // extract colors for each series only once
410
- var extractedColors = _extractColor(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
370
+ var extractedColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
411
371
  var legend = legends[index];
412
372
  // resolve color for each legend's bars from the extracted colors
413
- var color = _resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
373
+ var color = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
414
374
  return series.y.map(function (yValue, i) {
415
375
  return {
416
376
  x: series.x[i],
@@ -452,6 +412,7 @@ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, co
452
412
  hideLegend: hideLegend,
453
413
  noOfCharsToTruncate: 20,
454
414
  showYAxisLablesTooltip: true,
415
+ roundCorners: true,
455
416
  };
456
417
  };
457
418
  export var transformPlotlyJsonToHeatmapProps = function (input) {
@@ -501,6 +462,7 @@ export var transformPlotlyJsonToHeatmapProps = function (input) {
501
462
  else {
502
463
  (_h = firstData.x) === null || _h === void 0 ? void 0 : _h.forEach(function (xVal, xIdx) {
503
464
  var _a;
465
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
504
466
  (_a = firstData.y) === null || _a === void 0 ? void 0 : _a.forEach(function (yVal, yIdx) {
505
467
  var _a, _b, _c, _d, _e, _f;
506
468
  var zVal = (_b = (_a = firstData.z) === null || _a === void 0 ? void 0 : _a[yIdx]) === null || _b === void 0 ? void 0 : _b[xIdx];
@@ -553,9 +515,9 @@ export var transformPlotlyJsonToHeatmapProps = function (input) {
553
515
  showYAxisLablesTooltip: true,
554
516
  };
555
517
  };
556
- export var transformPlotlyJsonToSankeyProps = function (input, colorMap, isDarkTheme) {
557
- var _a, _b, _c, _d, _e, _f, _g, _h;
558
- var _j = input.data[0], link = _j.link, node = _j.node;
518
+ export var transformPlotlyJsonToSankeyProps = function (input, colorMap, colorwayType, isDarkTheme) {
519
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
520
+ var _m = input.data[0], link = _m.link, node = _m.node;
559
521
  var validLinks = ((_a = link === null || link === void 0 ? void 0 : link.value) !== null && _a !== void 0 ? _a : [])
560
522
  .map(function (val, index) { return ({
561
523
  value: val,
@@ -564,21 +526,23 @@ export var transformPlotlyJsonToSankeyProps = function (input, colorMap, isDarkT
564
526
  }); })
565
527
  // Filter out negative nodes, unequal nodes and self-references (circular links)
566
528
  .filter(function (x) { return x.source >= 0 && x.target >= 0 && x.source !== x.target; });
529
+ var extractedNodeColors = extractColor((_d = (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.template) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.colorway, colorwayType, node === null || node === void 0 ? void 0 : node.color, colorMap, isDarkTheme);
567
530
  var sankeyChartData = {
568
- nodes: (_b = node.label) === null || _b === void 0 ? void 0 : _b.map(function (label, index) {
569
- var color = getColor(label, colorMap, isDarkTheme);
531
+ nodes: (_e = node.label) === null || _e === void 0 ? void 0 : _e.map(function (label, index) {
532
+ var color = resolveColor(extractedNodeColors, index, label, colorMap, isDarkTheme);
570
533
  return {
571
534
  nodeId: index,
572
535
  name: label,
573
536
  color: color,
574
537
  };
575
538
  }),
539
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
576
540
  links: validLinks.map(function (validLink, index) {
577
541
  return __assign({}, validLink);
578
542
  }),
579
543
  };
580
544
  var styles = {
581
- root: __assign({}, (((_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.font) === null || _d === void 0 ? void 0 : _d.size) ? { fontSize: (_e = input.layout.font) === null || _e === void 0 ? void 0 : _e.size } : {})),
545
+ root: __assign({}, (((_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.font) === null || _g === void 0 ? void 0 : _g.size) ? { fontSize: (_h = input.layout.font) === null || _h === void 0 ? void 0 : _h.size } : {})),
582
546
  };
583
547
  var chartTitle = getTitles(input.layout).chartTitle;
584
548
  return {
@@ -586,50 +550,55 @@ export var transformPlotlyJsonToSankeyProps = function (input, colorMap, isDarkT
586
550
  chartTitle: chartTitle,
587
551
  SankeyChartData: sankeyChartData,
588
552
  },
589
- width: (_f = input.layout) === null || _f === void 0 ? void 0 : _f.width,
590
- height: (_h = (_g = input.layout) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : 468,
553
+ width: (_j = input.layout) === null || _j === void 0 ? void 0 : _j.width,
554
+ height: (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : 468,
591
555
  styles: styles,
592
556
  enableReflow: true,
593
557
  };
594
558
  };
595
- export var transformPlotlyJsonToGaugeProps = function (input, colorMap, isDarkTheme) {
596
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
559
+ export var transformPlotlyJsonToGaugeProps = function (input, colorMap, colorwayType, isDarkTheme) {
560
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
597
561
  var firstData = input.data[0];
598
- var segments = ((_b = (_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) === null || _b === void 0 ? void 0 : _b.length)
599
- ? firstData.gauge.steps.map(function (step, index) {
600
- var _a, _b;
601
- var legend = step.name || "Segment ".concat(index + 1);
602
- var color = getColor(legend, colorMap, isDarkTheme);
603
- return {
604
- legend: legend,
605
- size: ((_a = step.range) === null || _a === void 0 ? void 0 : _a[1]) - ((_b = step.range) === null || _b === void 0 ? void 0 : _b[0]),
606
- color: color,
607
- };
608
- })
562
+ var stepsColors = ((_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) ? firstData.gauge.steps.map(function (step) { return step.color; }) : undefined;
563
+ var extractedColors = extractColor((_d = (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.template) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.colorway, colorwayType, stepsColors, colorMap, isDarkTheme);
564
+ var segments = ((_f = (_e = firstData.gauge) === null || _e === void 0 ? void 0 : _e.steps) === null || _f === void 0 ? void 0 : _f.length)
565
+ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
566
+ firstData.gauge.steps.map(function (step, index) {
567
+ var _a, _b;
568
+ var legend = step.name || "Segment ".concat(index + 1);
569
+ var color = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
570
+ return {
571
+ legend: legend,
572
+ size: ((_a = step.range) === null || _a === void 0 ? void 0 : _a[1]) - ((_b = step.range) === null || _b === void 0 ? void 0 : _b[0]),
573
+ color: color,
574
+ };
575
+ })
609
576
  : [
610
577
  {
611
578
  legend: 'Current',
612
- size: (_c = firstData.value) !== null && _c !== void 0 ? _c : 0 - ((_g = (_f = (_e = (_d = firstData.gauge) === null || _d === void 0 ? void 0 : _d.axis) === null || _e === void 0 ? void 0 : _e.range) === null || _f === void 0 ? void 0 : _f[0]) !== null && _g !== void 0 ? _g : 0),
613
- color: getColor('Current', colorMap, isDarkTheme),
579
+ size: (_g = firstData.value) !== null && _g !== void 0 ? _g : 0 - ((_l = (_k = (_j = (_h = firstData.gauge) === null || _h === void 0 ? void 0 : _h.axis) === null || _j === void 0 ? void 0 : _j.range) === null || _k === void 0 ? void 0 : _k[0]) !== null && _l !== void 0 ? _l : 0),
580
+ color: _getGaugeAxisColor((_p = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.template) === null || _o === void 0 ? void 0 : _o.layout) === null || _p === void 0 ? void 0 : _p.colorway, colorwayType, (_r = (_q = firstData.gauge) === null || _q === void 0 ? void 0 : _q.axis) === null || _r === void 0 ? void 0 : _r.color, colorMap, isDarkTheme),
614
581
  },
615
582
  {
616
583
  legend: 'Target',
617
- size: ((_l = (_k = (_j = (_h = firstData.gauge) === null || _h === void 0 ? void 0 : _h.axis) === null || _j === void 0 ? void 0 : _j.range) === null || _k === void 0 ? void 0 : _k[1]) !== null && _l !== void 0 ? _l : 100) - ((_m = firstData.value) !== null && _m !== void 0 ? _m : 0),
584
+ size: ((_v = (_u = (_t = (_s = firstData.gauge) === null || _s === void 0 ? void 0 : _s.axis) === null || _t === void 0 ? void 0 : _t.range) === null || _u === void 0 ? void 0 : _u[1]) !== null && _v !== void 0 ? _v : 100) - ((_w = firstData.value) !== null && _w !== void 0 ? _w : 0),
618
585
  color: DataVizPalette.disabled,
619
586
  },
620
587
  ];
621
588
  var sublabel;
622
589
  var sublabelColor;
623
- if ((_o = firstData.delta) === null || _o === void 0 ? void 0 : _o.reference) {
590
+ if ((_x = firstData.delta) === null || _x === void 0 ? void 0 : _x.reference) {
624
591
  var diff = firstData.value - firstData.delta.reference;
625
592
  if (diff >= 0) {
626
593
  sublabel = "\u25B2 ".concat(diff);
627
- var color = getColorFromToken(DataVizPalette.success, isDarkTheme);
594
+ var extractedIncreasingDeltaColors = extractColor((_0 = (_z = (_y = input.layout) === null || _y === void 0 ? void 0 : _y.template) === null || _z === void 0 ? void 0 : _z.layout) === null || _0 === void 0 ? void 0 : _0.colorway, colorwayType, (_2 = (_1 = firstData.delta) === null || _1 === void 0 ? void 0 : _1.increasing) === null || _2 === void 0 ? void 0 : _2.color, colorMap, isDarkTheme);
595
+ var color = resolveColor(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
628
596
  sublabelColor = color;
629
597
  }
630
598
  else {
631
599
  sublabel = "\u25BC ".concat(Math.abs(diff));
632
- var color = getColorFromToken(DataVizPalette.error, isDarkTheme);
600
+ var extractedDecreasingDeltaColors = extractColor((_5 = (_4 = (_3 = input.layout) === null || _3 === void 0 ? void 0 : _3.template) === null || _4 === void 0 ? void 0 : _4.layout) === null || _5 === void 0 ? void 0 : _5.colorway, colorwayType, (_7 = (_6 = firstData.delta) === null || _6 === void 0 ? void 0 : _6.decreasing) === null || _7 === void 0 ? void 0 : _7.color, colorMap, isDarkTheme);
601
+ var color = resolveColor(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
633
602
  sublabelColor = color;
634
603
  }
635
604
  }
@@ -641,17 +610,60 @@ export var transformPlotlyJsonToGaugeProps = function (input, colorMap, isDarkTh
641
610
  var chartTitle = getTitles(input.layout).chartTitle;
642
611
  return {
643
612
  segments: segments,
644
- chartValue: (_p = firstData.value) !== null && _p !== void 0 ? _p : 0,
613
+ chartValue: (_8 = firstData.value) !== null && _8 !== void 0 ? _8 : 0,
645
614
  chartTitle: chartTitle,
646
615
  sublabel: sublabel,
647
616
  // range values can be null
648
- minValue: typeof ((_s = (_r = (_q = firstData.gauge) === null || _q === void 0 ? void 0 : _q.axis) === null || _r === void 0 ? void 0 : _r.range) === null || _s === void 0 ? void 0 : _s[0]) === 'number' ? (_v = (_u = (_t = firstData.gauge) === null || _t === void 0 ? void 0 : _t.axis) === null || _u === void 0 ? void 0 : _u.range) === null || _v === void 0 ? void 0 : _v[0] : undefined,
649
- maxValue: typeof ((_y = (_x = (_w = firstData.gauge) === null || _w === void 0 ? void 0 : _w.axis) === null || _x === void 0 ? void 0 : _x.range) === null || _y === void 0 ? void 0 : _y[1]) === 'number' ? (_1 = (_0 = (_z = firstData.gauge) === null || _z === void 0 ? void 0 : _z.axis) === null || _0 === void 0 ? void 0 : _0.range) === null || _1 === void 0 ? void 0 : _1[1] : undefined,
617
+ minValue: typeof ((_11 = (_10 = (_9 = firstData.gauge) === null || _9 === void 0 ? void 0 : _9.axis) === null || _10 === void 0 ? void 0 : _10.range) === null || _11 === void 0 ? void 0 : _11[0]) === 'number' ? (_14 = (_13 = (_12 = firstData.gauge) === null || _12 === void 0 ? void 0 : _12.axis) === null || _13 === void 0 ? void 0 : _13.range) === null || _14 === void 0 ? void 0 : _14[0] : undefined,
618
+ maxValue: typeof ((_17 = (_16 = (_15 = firstData.gauge) === null || _15 === void 0 ? void 0 : _15.axis) === null || _16 === void 0 ? void 0 : _16.range) === null || _17 === void 0 ? void 0 : _17[1]) === 'number' ? (_20 = (_19 = (_18 = firstData.gauge) === null || _18 === void 0 ? void 0 : _18.axis) === null || _19 === void 0 ? void 0 : _19.range) === null || _20 === void 0 ? void 0 : _20[1] : undefined,
650
619
  chartValueFormat: function () { var _a, _b; return (_b = (_a = firstData.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; },
651
- width: (_2 = input.layout) === null || _2 === void 0 ? void 0 : _2.width,
652
- height: (_4 = (_3 = input.layout) === null || _3 === void 0 ? void 0 : _3.height) !== null && _4 !== void 0 ? _4 : 220,
620
+ width: (_21 = input.layout) === null || _21 === void 0 ? void 0 : _21.width,
621
+ height: (_23 = (_22 = input.layout) === null || _22 === void 0 ? void 0 : _22.height) !== null && _23 !== void 0 ? _23 : 220,
622
+ styles: styles,
623
+ variant: ((_25 = (_24 = firstData.gauge) === null || _24 === void 0 ? void 0 : _24.steps) === null || _25 === void 0 ? void 0 : _25.length) ? GaugeChartVariant.MultipleSegments : GaugeChartVariant.SingleSegment,
624
+ roundCorners: true,
625
+ };
626
+ };
627
+ var cleanText = function (text) {
628
+ return text
629
+ .replace(/<[^&]*?>/g, '')
630
+ .replace(/<[^>]*>/g, '')
631
+ .replace(/&lt;br&gt;|\\u003cbr\\u003e|<br>/gi, '')
632
+ .replace(/\$[^$]*\$/g, '$')
633
+ .trim();
634
+ };
635
+ export var transformPlotlyJsonToChartTableProps = function (input, colorMap, isDarkTheme) {
636
+ var _a, _b, _c, _d, _e, _f, _g, _h;
637
+ var tableData = input.data[0];
638
+ var normalizeHeaders = function (values) {
639
+ // Case: values is array of arrays
640
+ if (Array.isArray(values[0])) {
641
+ return values.map(function (row) {
642
+ return row
643
+ .map(function (cell) { return cleanText(cell); })
644
+ .filter(Boolean)
645
+ .join(' ');
646
+ });
647
+ }
648
+ // Case: values is 1d array
649
+ return values.map(function (cell) { return cleanText(cell); });
650
+ };
651
+ var columns = (_b = (_a = tableData.cells) === null || _a === void 0 ? void 0 : _a.values) !== null && _b !== void 0 ? _b : [];
652
+ var rows = columns[0].map(function (_, rowIndex) {
653
+ return columns.map(function (col) {
654
+ var cell = col[rowIndex];
655
+ return typeof cell === 'string' ? cleanText(cell) : cell;
656
+ });
657
+ });
658
+ var styles = {
659
+ root: __assign({}, (((_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.font) === null || _d === void 0 ? void 0 : _d.size) ? { fontSize: input.layout.font.size } : {})),
660
+ };
661
+ return {
662
+ headers: normalizeHeaders((_f = (_e = tableData.header) === null || _e === void 0 ? void 0 : _e.values) !== null && _f !== void 0 ? _f : []),
663
+ rows: rows,
664
+ width: (_g = input.layout) === null || _g === void 0 ? void 0 : _g.width,
665
+ height: (_h = input.layout) === null || _h === void 0 ? void 0 : _h.height,
653
666
  styles: styles,
654
- variant: ((_6 = (_5 = firstData.gauge) === null || _5 === void 0 ? void 0 : _5.steps) === null || _6 === void 0 ? void 0 : _6.length) ? GaugeChartVariant.MultipleSegments : GaugeChartVariant.SingleSegment,
655
667
  };
656
668
  };
657
669
  export var projectPolarToCartesian = function (input) {
@@ -670,6 +682,7 @@ export var projectPolarToCartesian = function (input) {
670
682
  }
671
683
  return projection;
672
684
  };
685
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
673
686
  function isPlainObject(obj) {
674
687
  if (window && window.process && window.process.versions) {
675
688
  return Object.prototype.toString.call(obj) === '[object Object]';
@@ -677,19 +690,25 @@ function isPlainObject(obj) {
677
690
  return (Object.prototype.toString.call(obj) === '[object Object]' &&
678
691
  Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty'));
679
692
  }
693
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
680
694
  var arrayAttributes = [];
695
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
681
696
  var stack = [];
697
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
682
698
  var isArrayStack = [];
699
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
683
700
  var baseContainer, baseAttrName;
684
701
  /**
685
702
  * Interate iteratively through the trace object and find all the array attributes.
686
703
  * 1 trace record = 1 series of data
687
704
  * @param trace
688
705
  */
706
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
689
707
  export function findArrayAttributes(trace) {
690
708
  // Init basecontainer and baseAttrName
691
709
  crawlIntoTrace(baseContainer, 0, '');
692
710
  }
711
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
693
712
  function crawlIntoTrace(container, i, astrPartial) {
694
713
  var item = container[stack[i]];
695
714
  var newAstrPartial = astrPartial + stack[i];
@@ -740,7 +759,9 @@ function getLineOptions(line) {
740
759
  }
741
760
  return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
742
761
  }
762
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
743
763
  var isStringArray = function (arr) {
764
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
744
765
  return isArrayOfType(arr, function (value) { return typeof value === 'string'; });
745
766
  };
746
767
  // TODO: Use binary search to find the appropriate bin for numeric value.