@fluentui/react-charting 5.23.87 → 5.23.89

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 (104) hide show
  1. package/CHANGELOG.json +79 -1
  2. package/CHANGELOG.md +28 -2
  3. package/dist/react-charting.d.ts +72 -3
  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 -3
  26. package/lib/components/DeclarativeChart/DeclarativeChart.js +15 -11
  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 -11
  32. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +155 -113
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  34. package/lib/index.d.ts +2 -0
  35. package/lib/index.js +1 -0
  36. package/lib/index.js.map +1 -1
  37. package/lib/utilities/image-export-utils.js +25 -3
  38. package/lib/utilities/image-export-utils.js.map +1 -1
  39. package/lib-amd/ChartTable.d.ts +1 -0
  40. package/lib-amd/ChartTable.js +6 -0
  41. package/lib-amd/ChartTable.js.map +1 -0
  42. package/lib-amd/components/ChartTable/ChartTable.base.d.ts +10 -0
  43. package/lib-amd/components/ChartTable/ChartTable.base.js +45 -0
  44. package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -0
  45. package/lib-amd/components/ChartTable/ChartTable.d.ts +7 -0
  46. package/lib-amd/components/ChartTable/ChartTable.js +11 -0
  47. package/lib-amd/components/ChartTable/ChartTable.js.map +1 -0
  48. package/lib-amd/components/ChartTable/ChartTable.styles.d.ts +2 -0
  49. package/lib-amd/components/ChartTable/ChartTable.styles.js +32 -0
  50. package/lib-amd/components/ChartTable/ChartTable.styles.js.map +1 -0
  51. package/lib-amd/components/ChartTable/ChartTable.types.d.ts +58 -0
  52. package/lib-amd/components/ChartTable/ChartTable.types.js +5 -0
  53. package/lib-amd/components/ChartTable/ChartTable.types.js.map +1 -0
  54. package/lib-amd/components/ChartTable/index.d.ts +2 -0
  55. package/lib-amd/components/ChartTable/index.js +7 -0
  56. package/lib-amd/components/ChartTable/index.js.map +1 -0
  57. package/lib-amd/components/DeclarativeChart/DeclarativeChart.d.ts +7 -3
  58. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +14 -11
  59. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  60. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +7 -0
  61. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +108 -0
  62. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  63. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -11
  64. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +157 -115
  65. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  66. package/lib-amd/index.d.ts +2 -0
  67. package/lib-amd/index.js +3 -2
  68. package/lib-amd/index.js.map +1 -1
  69. package/lib-amd/utilities/image-export-utils.js +25 -3
  70. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  71. package/lib-commonjs/ChartTable.d.ts +1 -0
  72. package/lib-commonjs/ChartTable.js +5 -0
  73. package/lib-commonjs/ChartTable.js.map +1 -0
  74. package/lib-commonjs/components/ChartTable/ChartTable.base.d.ts +10 -0
  75. package/lib-commonjs/components/ChartTable/ChartTable.base.js +47 -0
  76. package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -0
  77. package/lib-commonjs/components/ChartTable/ChartTable.d.ts +7 -0
  78. package/lib-commonjs/components/ChartTable/ChartTable.js +12 -0
  79. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
  80. package/lib-commonjs/components/ChartTable/ChartTable.styles.d.ts +2 -0
  81. package/lib-commonjs/components/ChartTable/ChartTable.styles.js +32 -0
  82. package/lib-commonjs/components/ChartTable/ChartTable.styles.js.map +1 -0
  83. package/lib-commonjs/components/ChartTable/ChartTable.types.d.ts +58 -0
  84. package/lib-commonjs/components/ChartTable/ChartTable.types.js +3 -0
  85. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
  86. package/lib-commonjs/components/ChartTable/index.d.ts +2 -0
  87. package/lib-commonjs/components/ChartTable/index.js +6 -0
  88. package/lib-commonjs/components/ChartTable/index.js.map +1 -0
  89. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.d.ts +7 -3
  90. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +14 -10
  91. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  92. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +7 -0
  93. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +110 -0
  94. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  95. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -11
  96. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +157 -115
  97. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  98. package/lib-commonjs/index.d.ts +2 -0
  99. package/lib-commonjs/index.js +3 -1
  100. package/lib-commonjs/index.js.map +1 -1
  101. package/lib-commonjs/utilities/image-export-utils.js +25 -3
  102. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  103. package/package.json +5 -5
  104. package/src/components/ChartTable/ChartTable.types.ts +68 -0
@@ -9,20 +9,22 @@ import { IHeatMapChartProps } from '../HeatMapChart/index';
9
9
  import { IGaugeChartProps } from '../GaugeChart/index';
10
10
  import { IGroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index';
11
11
  import { IVerticalBarChartProps } from '../VerticalBarChart/index';
12
- import type { Datum, PlotlySchema, TypedArray, PieColors, Color } from '@fluentui/chart-utilities';
12
+ import { IChartTableProps } from '../ChartTable/index';
13
+ import type { Datum, PlotlySchema, TypedArray, Color } from '@fluentui/chart-utilities';
14
+ import type { ColorwayType } from './PlotlyColorAdapter';
13
15
  export declare const isMonthArray: (data: Datum[] | Datum[][] | TypedArray) => boolean;
14
16
  export declare const correctYearMonth: (xValues: Datum[] | Datum[][] | TypedArray) => any[];
15
- export declare const getColor: (legendLabel: string, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string;
16
- export declare const getSchemaColors: (colors: PieColors | Color | null | undefined, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string[] | string | undefined;
17
- export declare const transformPlotlyJsonToDonutProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, useFluentVizColorPalette: boolean, isDarkTheme?: boolean) => IDonutChartProps;
18
- export declare const transformPlotlyJsonToVSBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean, fallbackVSBC?: boolean) => IVerticalStackedBarChartProps;
19
- export declare const transformPlotlyJsonToGVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IGroupedVerticalBarChartProps;
20
- export declare const transformPlotlyJsonToVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IVerticalBarChartProps;
21
- export declare const transformPlotlyJsonToScatterChartProps: (input: PlotlySchema, isAreaChart: boolean, colorMap: React.MutableRefObject<Map<string, string>>, useFluentVizColorPalette: boolean, isDarkTheme?: boolean) => ILineChartProps | IAreaChartProps;
22
- export declare const transformPlotlyJsonToHorizontalBarWithAxisProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IHorizontalBarChartWithAxisProps;
17
+ export declare const _getGaugeAxisColor: (colorway: string[] | undefined, colorwayType: ColorwayType, color: Color | undefined, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string;
18
+ export declare const transformPlotlyJsonToDonutProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IDonutChartProps;
19
+ export declare const transformPlotlyJsonToVSBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean, fallbackVSBC?: boolean) => IVerticalStackedBarChartProps;
20
+ export declare const transformPlotlyJsonToGVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IGroupedVerticalBarChartProps;
21
+ export declare const transformPlotlyJsonToVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IVerticalBarChartProps;
22
+ export declare const transformPlotlyJsonToScatterChartProps: (input: PlotlySchema, isAreaChart: boolean, isScatterMarkers: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => ILineChartProps | IAreaChartProps;
23
+ export declare const transformPlotlyJsonToHorizontalBarWithAxisProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IHorizontalBarChartWithAxisProps;
23
24
  export declare const transformPlotlyJsonToHeatmapProps: (input: PlotlySchema) => IHeatMapChartProps;
24
- export declare const transformPlotlyJsonToSankeyProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => ISankeyChartProps;
25
- export declare const transformPlotlyJsonToGaugeProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IGaugeChartProps;
25
+ export declare const transformPlotlyJsonToSankeyProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => ISankeyChartProps;
26
+ export declare const transformPlotlyJsonToGaugeProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IGaugeChartProps;
27
+ export declare const transformPlotlyJsonToChartTableProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IChartTableProps;
26
28
  export declare const projectPolarToCartesian: (input: PlotlySchema) => PlotlySchema;
27
29
  /**
28
30
  * Interate iteratively through the trace object and find all the array attributes.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.getSchemaColors = exports.getColor = exports.correctYearMonth = exports.isMonthArray = void 0;
3
+ exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports._getGaugeAxisColor = exports.correctYearMonth = exports.isMonthArray = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var d3_array_1 = require("d3-array");
6
6
  var d3_scale_1 = require("d3-scale");
@@ -10,7 +10,7 @@ var utilities_1 = require("../../utilities/utilities");
10
10
  var chart_utilities_1 = require("@fluentui/chart-utilities");
11
11
  var d3_time_format_1 = require("d3-time-format");
12
12
  var d3_shape_1 = require("d3-shape");
13
- var d3_color_1 = require("d3-color");
13
+ var PlotlyColorAdapter_1 = require("./PlotlyColorAdapter");
14
14
  var dashOptions = {
15
15
  dot: {
16
16
  strokeDasharray: '1, 5',
@@ -49,6 +49,7 @@ var dashOptions = {
49
49
  lineBorderWidth: '4',
50
50
  },
51
51
  };
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
53
  var isMonth = function (possiblyMonthValue) {
53
54
  var parseFullMonth = (0, d3_time_format_1.timeParse)('%B');
54
55
  var parseShortMonth = (0, d3_time_format_1.timeParse)('%b');
@@ -67,6 +68,7 @@ function getTitles(layout) {
67
68
  };
68
69
  return titles;
69
70
  }
71
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
72
  var correctYearMonth = function (xValues) {
71
73
  var presentYear = new Date().getFullYear();
72
74
  if (xValues.length > 0 && Array.isArray(xValues[0])) {
@@ -94,15 +96,6 @@ var correctYearMonth = function (xValues) {
94
96
  return xValues;
95
97
  };
96
98
  exports.correctYearMonth = correctYearMonth;
97
- var getColor = function (legendLabel, colorMap, isDarkTheme) {
98
- if (!colorMap.current.has(legendLabel)) {
99
- var nextColor = (0, colors_1.getNextColor)(colorMap.current.size + 1, 0, isDarkTheme);
100
- colorMap.current.set(legendLabel, nextColor);
101
- return nextColor;
102
- }
103
- return colorMap.current.get(legendLabel);
104
- };
105
- exports.getColor = getColor;
106
99
  var usesSecondaryYScale = function (series) {
107
100
  return series.yaxis === 'y2';
108
101
  };
@@ -146,51 +139,21 @@ var getSecondaryYAxisValues = function (data, layout, maxAllowedMinY, minAllowed
146
139
  },
147
140
  };
148
141
  };
149
- var getSchemaColors = function (colors, colorMap, isDarkTheme) {
150
- var hexColors = [];
151
- if (!colors) {
152
- return undefined;
153
- }
154
- if ((0, chart_utilities_1.isArrayOrTypedArray)(colors)) {
155
- colors.forEach(function (element, index) {
156
- var colorString = element === null || element === void 0 ? void 0 : element.toString().trim();
157
- var nextFluentColor = (0, exports.getColor)("Label_".concat(index), colorMap, isDarkTheme);
158
- if (colorString) {
159
- var parsedColor = (0, d3_color_1.color)(colorString);
160
- hexColors.push(parsedColor ? parsedColor.formatHex() : nextFluentColor);
161
- }
162
- else {
163
- hexColors.push(nextFluentColor);
164
- }
165
- });
166
- }
167
- else if (typeof colors === 'string') {
168
- var parsedColor = (0, d3_color_1.color)(colors);
169
- return parsedColor ? parsedColor.formatHex() : (0, exports.getColor)('Label_0', colorMap, isDarkTheme);
170
- }
171
- return hexColors;
142
+ var _getGaugeAxisColor = function (colorway, colorwayType, color, colorMap, isDarkTheme) {
143
+ var extractedColors = (0, PlotlyColorAdapter_1.extractColor)(colorway, colorwayType, color, colorMap, isDarkTheme);
144
+ return (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, '', colorMap, isDarkTheme);
172
145
  };
173
- exports.getSchemaColors = getSchemaColors;
174
- var transformPlotlyJsonToDonutProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
175
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
146
+ exports._getGaugeAxisColor = _getGaugeAxisColor;
147
+ var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, isDarkTheme) {
148
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
176
149
  var firstData = input.data[0];
177
- var colors = undefined;
178
- if (!useFluentVizColorPalette) {
179
- colors = ((_a = firstData.marker) === null || _a === void 0 ? void 0 : _a.colors) ? (0, exports.getSchemaColors)((_b = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _b === void 0 ? void 0 : _b.colors, colorMap, isDarkTheme) : undefined;
180
- }
150
+ // extract colors for each series only once
151
+ var colors = (0, PlotlyColorAdapter_1.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);
181
152
  var mapLegendToDataPoint = {};
182
- (_c = firstData.labels) === null || _c === void 0 ? void 0 : _c.forEach(function (label, index) {
153
+ (_e = firstData.labels) === null || _e === void 0 ? void 0 : _e.forEach(function (label, index) {
183
154
  var _a;
184
- var color = '';
185
- if (colors && isStringArray(colors)) {
186
- color = colors[index % colors.length];
187
- }
188
- else if (typeof colors === 'string') {
189
- color = colors;
190
- }
191
- else {
192
- color = (0, exports.getColor)(label, colorMap, isDarkTheme);
193
- }
155
+ // resolve color for each legend from the extracted colors
156
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(colors, index, label, colorMap, isDarkTheme);
194
157
  //ToDo how to handle string data?
195
158
  var value = typeof ((_a = firstData.values) === null || _a === void 0 ? void 0 : _a[index]) === 'number' ? firstData.values[index] : 1;
196
159
  if (!mapLegendToDataPoint[label]) {
@@ -204,8 +167,8 @@ var transformPlotlyJsonToDonutProps = function (input, colorMap, useFluentVizCol
204
167
  mapLegendToDataPoint[label].data += value;
205
168
  }
206
169
  });
207
- var width = (_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.width) !== null && _e !== void 0 ? _e : 440;
208
- var height = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : 220;
170
+ var width = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.width) !== null && _g !== void 0 ? _g : 440;
171
+ var height = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.height) !== null && _j !== void 0 ? _j : 220;
209
172
  var hideLabels = firstData.textinfo
210
173
  ? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)
211
174
  : false;
@@ -220,33 +183,39 @@ var transformPlotlyJsonToDonutProps = function (input, colorMap, useFluentVizCol
220
183
  chartTitle: chartTitle,
221
184
  chartData: Object.values(mapLegendToDataPoint),
222
185
  },
223
- hideLegend: ((_h = input.layout) === null || _h === void 0 ? void 0 : _h.showlegend) === false ? true : false,
224
- width: (_j = input.layout) === null || _j === void 0 ? void 0 : _j.width,
186
+ hideLegend: ((_k = input.layout) === null || _k === void 0 ? void 0 : _k.showlegend) === false ? true : false,
187
+ width: (_l = input.layout) === null || _l === void 0 ? void 0 : _l.width,
225
188
  height: height,
226
189
  innerRadius: innerRadius,
227
190
  hideLabels: hideLabels,
228
191
  showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
192
+ roundCorners: true,
229
193
  };
230
194
  };
231
195
  exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
232
- var transformPlotlyJsonToVSBCProps = function (input, colorMap, isDarkTheme, fallbackVSBC) {
196
+ var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
233
197
  var _a, _b, _c;
234
198
  var mapXToDataPoints = {};
235
199
  var yMaxValue = 0;
236
200
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
237
201
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
238
202
  input.data.forEach(function (series, index1) {
239
- var _a;
203
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
240
204
  var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
241
- (_a = series.x) === null || _a === void 0 ? void 0 : _a.forEach(function (x, index2) {
205
+ // extract bar colors for each series only once
206
+ var extractedBarColors = (0, PlotlyColorAdapter_1.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);
207
+ // extract line colors for each series only once
208
+ var extractedLineColors = (0, PlotlyColorAdapter_1.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);
209
+ (_j = series.x) === null || _j === void 0 ? void 0 : _j.forEach(function (x, index2) {
242
210
  var _a, _b, _c;
243
211
  if (!mapXToDataPoints[x]) {
244
212
  mapXToDataPoints[x] = { xAxisPoint: isXYearCategory ? x.toString() : x, chartData: [], lineData: [] };
245
213
  }
246
214
  var legend = legends[index1];
215
+ // resolve color for each legend's bars from the extracted colors
216
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index1, legend, colorMap, isDarkTheme);
247
217
  var yVal = (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2]) !== null && _b !== void 0 ? _b : 0;
248
218
  if (series.type === 'bar') {
249
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
250
219
  mapXToDataPoints[x].chartData.push({
251
220
  legend: legend,
252
221
  data: yVal,
@@ -255,11 +224,11 @@ var transformPlotlyJsonToVSBCProps = function (input, colorMap, isDarkTheme, fal
255
224
  yMaxValue = Math.max(yMaxValue, yVal);
256
225
  }
257
226
  else if (series.type === 'scatter' || !!fallbackVSBC) {
258
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
227
+ var lineColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
259
228
  var lineOptions = getLineOptions(series.line);
260
229
  var dashType = ((_c = series.line) === null || _c === void 0 ? void 0 : _c.dash) || 'solid';
261
230
  var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
262
- mapXToDataPoints[x].lineData.push(tslib_1.__assign(tslib_1.__assign({ legend: legend, legendShape: legendShape, y: yVal, color: color }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) }));
231
+ mapXToDataPoints[x].lineData.push(tslib_1.__assign(tslib_1.__assign({ legend: legend, legendShape: legendShape, y: yVal, color: lineColor }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) }));
263
232
  if (!usesSecondaryYScale(series)) {
264
233
  yMaxValue = Math.max(yMaxValue, yVal);
265
234
  }
@@ -267,24 +236,27 @@ var transformPlotlyJsonToVSBCProps = function (input, colorMap, isDarkTheme, fal
267
236
  });
268
237
  });
269
238
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
270
- return tslib_1.__assign(tslib_1.__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 });
239
+ return tslib_1.__assign(tslib_1.__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 });
271
240
  };
272
241
  exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
273
- var transformPlotlyJsonToGVBCProps = function (input, colorMap, isDarkTheme) {
242
+ var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
274
243
  var _a, _b, _c;
275
244
  var mapXToDataPoints = {};
276
245
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
277
246
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
278
247
  input.data.forEach(function (series, index1) {
279
- var _a;
280
- (_a = series.x) === null || _a === void 0 ? void 0 : _a.forEach(function (x, xIndex) {
248
+ var _a, _b, _c, _d, _e;
249
+ // extract colors for each series only once
250
+ var extractedColors = (0, PlotlyColorAdapter_1.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);
251
+ (_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
281
252
  var _a, _b;
282
253
  if (!mapXToDataPoints[x]) {
283
254
  mapXToDataPoints[x] = { name: x.toString(), series: [] };
284
255
  }
285
256
  if (series.type === 'bar') {
286
257
  var legend = legends[index1];
287
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
258
+ // resolve color for each legend's bars from the extracted colors
259
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
288
260
  mapXToDataPoints[x].series.push({
289
261
  key: legend,
290
262
  data: (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex]) !== null && _b !== void 0 ? _b : 0,
@@ -297,22 +269,24 @@ var transformPlotlyJsonToGVBCProps = function (input, colorMap, isDarkTheme) {
297
269
  });
298
270
  });
299
271
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
300
- return tslib_1.__assign(tslib_1.__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 });
272
+ return tslib_1.__assign(tslib_1.__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 });
301
273
  };
302
274
  exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
303
- var transformPlotlyJsonToVBCProps = function (input, colorMap, isDarkTheme) {
275
+ var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
304
276
  var _a, _b, _c;
305
277
  var vbcData = [];
306
278
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
307
279
  input.data.forEach(function (series, seriesIdx) {
308
- var _a, _b, _c;
280
+ var _a, _b, _c, _d, _e, _f, _g;
309
281
  if (!series.x) {
310
282
  return;
311
283
  }
284
+ // extract colors for each series only once
285
+ var extractedColors = (0, PlotlyColorAdapter_1.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);
312
286
  var isXString = isStringArray(series.x);
313
287
  // TODO: In case of a single bin, add an empty bin of the same size to prevent the
314
288
  // default bar width from being used and ensure the bar spans the full intended range.
315
- var xBins = createBins(series.x, (_a = series.xbins) === null || _a === void 0 ? void 0 : _a.start, (_b = series.xbins) === null || _b === void 0 ? void 0 : _b.end, (_c = series.xbins) === null || _c === void 0 ? void 0 : _c.size);
289
+ 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);
316
290
  var yBins = xBins.map(function () { return []; });
317
291
  var total = 0;
318
292
  series.x.forEach(function (xVal, index) {
@@ -329,7 +303,8 @@ var transformPlotlyJsonToVBCProps = function (input, colorMap, isDarkTheme) {
329
303
  });
330
304
  xBins.forEach(function (bin, index) {
331
305
  var legend = legends[seriesIdx];
332
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
306
+ // resolve color for each legend's bars from the extracted colors
307
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, seriesIdx, legend, colorMap, isDarkTheme);
333
308
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
334
309
  vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
335
310
  ? {}
@@ -349,27 +324,29 @@ var transformPlotlyJsonToVBCProps = function (input, colorMap, isDarkTheme) {
349
324
  hideTickOverlap: true,
350
325
  maxBarWidth: 50,
351
326
  hideLegend: hideLegend,
327
+ roundCorners: true,
352
328
  };
353
329
  };
354
330
  exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
355
- var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, colorMap, useFluentVizColorPalette, isDarkTheme) {
331
+ var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, isScatterMarkers, colorMap, colorwayType, isDarkTheme) {
356
332
  var _a, _b, _c, _d, _e, _f;
357
333
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
358
334
  var mode = 'tonexty';
359
335
  var _g = getLegendProps(input.data, input.layout), legends = _g.legends, hideLegend = _g.hideLegend;
360
336
  var chartData = input.data.map(function (series, index) {
361
- var _a, _b, _c;
337
+ var _a, _b, _c, _d, _e, _f;
338
+ // extract colors for each series only once
339
+ var extractedColors = (0, PlotlyColorAdapter_1.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);
362
340
  var xValues = series.x;
363
341
  var isString = typeof xValues[0] === 'string';
364
342
  var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
365
343
  var isXNumber = (0, chart_utilities_1.isNumberArray)(xValues);
366
344
  var legend = legends[index];
367
- var lineColor = !useFluentVizColorPalette && ((_a = series.line) === null || _a === void 0 ? void 0 : _a.color)
368
- ? (0, exports.getSchemaColors)((_b = series.line) === null || _b === void 0 ? void 0 : _b.color, colorMap, isDarkTheme)
369
- : (0, exports.getColor)(legend, colorMap, isDarkTheme);
345
+ // resolve color for each legend's lines from the extracted colors
346
+ var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
370
347
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
371
348
  var lineOptions = getLineOptions(series.line);
372
- var dashType = ((_c = series.line) === null || _c === void 0 ? void 0 : _c.dash) || 'solid';
349
+ var dashType = ((_f = series.line) === null || _f === void 0 ? void 0 : _f.dash) || 'solid';
373
350
  var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
374
351
  return tslib_1.__assign(tslib_1.__assign({ legend: legend, legendShape: legendShape, data: xValues.map(function (x, i) {
375
352
  var _a, _b;
@@ -378,7 +355,7 @@ var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, color
378
355
  : typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
379
356
  ? { markerSize: series.marker.size }
380
357
  : {})));
381
- }), color: lineColor }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) });
358
+ }), color: seriesColor }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) });
382
359
  });
383
360
  var yMinMaxValues = (0, utilities_1.findNumericMinMaxOfY)(chartData);
384
361
  var _h = getTitles(input.layout), chartTitle = _h.chartTitle, xAxisTitle = _h.xAxisTitle, yAxisTitle = _h.yAxisTitle;
@@ -394,13 +371,17 @@ var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, color
394
371
  }
395
372
  };
396
373
  exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
397
- var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, isDarkTheme) {
374
+ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, colorwayType, isDarkTheme) {
398
375
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
399
376
  var _s = getLegendProps(input.data, input.layout), legends = _s.legends, hideLegend = _s.hideLegend;
400
377
  var chartData = input.data
401
378
  .map(function (series, index) {
379
+ var _a, _b, _c, _d;
380
+ // extract colors for each series only once
381
+ var extractedColors = (0, PlotlyColorAdapter_1.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);
402
382
  var legend = legends[index];
403
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
383
+ // resolve color for each legend's bars from the extracted colors
384
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
404
385
  return series.y.map(function (yValue, i) {
405
386
  return {
406
387
  x: series.x[i],
@@ -442,6 +423,7 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap,
442
423
  hideLegend: hideLegend,
443
424
  noOfCharsToTruncate: 20,
444
425
  showYAxisLablesTooltip: true,
426
+ roundCorners: true,
445
427
  };
446
428
  };
447
429
  exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
@@ -492,6 +474,7 @@ var transformPlotlyJsonToHeatmapProps = function (input) {
492
474
  else {
493
475
  (_h = firstData.x) === null || _h === void 0 ? void 0 : _h.forEach(function (xVal, xIdx) {
494
476
  var _a;
477
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
495
478
  (_a = firstData.y) === null || _a === void 0 ? void 0 : _a.forEach(function (yVal, yIdx) {
496
479
  var _a, _b, _c, _d, _e, _f;
497
480
  var zVal = (_b = (_a = firstData.z) === null || _a === void 0 ? void 0 : _a[yIdx]) === null || _b === void 0 ? void 0 : _b[xIdx];
@@ -545,33 +528,34 @@ var transformPlotlyJsonToHeatmapProps = function (input) {
545
528
  };
546
529
  };
547
530
  exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
548
- var transformPlotlyJsonToSankeyProps = function (input, colorMap, isDarkTheme) {
549
- var _a, _b, _c, _d, _e, _f, _g, _h;
550
- var _j = input.data[0], link = _j.link, node = _j.node;
531
+ var transformPlotlyJsonToSankeyProps = function (input, colorMap, colorwayType, isDarkTheme) {
532
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
533
+ var _m = input.data[0], link = _m.link, node = _m.node;
551
534
  var validLinks = ((_a = link === null || link === void 0 ? void 0 : link.value) !== null && _a !== void 0 ? _a : [])
552
535
  .map(function (val, index) { return ({
553
536
  value: val,
554
537
  source: link === null || link === void 0 ? void 0 : link.source[index],
555
538
  target: link === null || link === void 0 ? void 0 : link.target[index],
556
539
  }); })
557
- // eslint-disable-next-line @typescript-eslint/no-shadow
558
540
  // Filter out negative nodes, unequal nodes and self-references (circular links)
559
541
  .filter(function (x) { return x.source >= 0 && x.target >= 0 && x.source !== x.target; });
542
+ var extractedNodeColors = (0, PlotlyColorAdapter_1.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);
560
543
  var sankeyChartData = {
561
- nodes: (_b = node.label) === null || _b === void 0 ? void 0 : _b.map(function (label, index) {
562
- var color = (0, exports.getColor)(label, colorMap, isDarkTheme);
544
+ nodes: (_e = node.label) === null || _e === void 0 ? void 0 : _e.map(function (label, index) {
545
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedNodeColors, index, label, colorMap, isDarkTheme);
563
546
  return {
564
547
  nodeId: index,
565
548
  name: label,
566
549
  color: color,
567
550
  };
568
551
  }),
552
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
569
553
  links: validLinks.map(function (validLink, index) {
570
554
  return tslib_1.__assign({}, validLink);
571
555
  }),
572
556
  };
573
557
  var styles = {
574
- root: tslib_1.__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 } : {})),
558
+ root: tslib_1.__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 } : {})),
575
559
  };
576
560
  var chartTitle = getTitles(input.layout).chartTitle;
577
561
  return {
@@ -579,51 +563,56 @@ var transformPlotlyJsonToSankeyProps = function (input, colorMap, isDarkTheme) {
579
563
  chartTitle: chartTitle,
580
564
  SankeyChartData: sankeyChartData,
581
565
  },
582
- width: (_f = input.layout) === null || _f === void 0 ? void 0 : _f.width,
583
- height: (_h = (_g = input.layout) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : 468,
566
+ width: (_j = input.layout) === null || _j === void 0 ? void 0 : _j.width,
567
+ height: (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : 468,
584
568
  styles: styles,
585
569
  enableReflow: true,
586
570
  };
587
571
  };
588
572
  exports.transformPlotlyJsonToSankeyProps = transformPlotlyJsonToSankeyProps;
589
- var transformPlotlyJsonToGaugeProps = function (input, colorMap, isDarkTheme) {
590
- 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;
573
+ var transformPlotlyJsonToGaugeProps = function (input, colorMap, colorwayType, isDarkTheme) {
574
+ 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;
591
575
  var firstData = input.data[0];
592
- var segments = ((_b = (_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) === null || _b === void 0 ? void 0 : _b.length)
593
- ? firstData.gauge.steps.map(function (step, index) {
594
- var _a, _b;
595
- var legend = step.name || "Segment ".concat(index + 1);
596
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
597
- return {
598
- legend: legend,
599
- size: ((_a = step.range) === null || _a === void 0 ? void 0 : _a[1]) - ((_b = step.range) === null || _b === void 0 ? void 0 : _b[0]),
600
- color: color,
601
- };
602
- })
576
+ var stepsColors = ((_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) ? firstData.gauge.steps.map(function (step) { return step.color; }) : undefined;
577
+ var extractedColors = (0, PlotlyColorAdapter_1.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);
578
+ var segments = ((_f = (_e = firstData.gauge) === null || _e === void 0 ? void 0 : _e.steps) === null || _f === void 0 ? void 0 : _f.length)
579
+ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
580
+ firstData.gauge.steps.map(function (step, index) {
581
+ var _a, _b;
582
+ var legend = step.name || "Segment ".concat(index + 1);
583
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
584
+ return {
585
+ legend: legend,
586
+ size: ((_a = step.range) === null || _a === void 0 ? void 0 : _a[1]) - ((_b = step.range) === null || _b === void 0 ? void 0 : _b[0]),
587
+ color: color,
588
+ };
589
+ })
603
590
  : [
604
591
  {
605
592
  legend: 'Current',
606
- 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),
607
- color: (0, exports.getColor)('Current', colorMap, isDarkTheme),
593
+ 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),
594
+ color: (0, exports._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),
608
595
  },
609
596
  {
610
597
  legend: 'Target',
611
- 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),
598
+ 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),
612
599
  color: colors_1.DataVizPalette.disabled,
613
600
  },
614
601
  ];
615
602
  var sublabel;
616
603
  var sublabelColor;
617
- if ((_o = firstData.delta) === null || _o === void 0 ? void 0 : _o.reference) {
604
+ if ((_x = firstData.delta) === null || _x === void 0 ? void 0 : _x.reference) {
618
605
  var diff = firstData.value - firstData.delta.reference;
619
606
  if (diff >= 0) {
620
607
  sublabel = "\u25B2 ".concat(diff);
621
- var color = (0, colors_1.getColorFromToken)(colors_1.DataVizPalette.success, isDarkTheme);
608
+ var extractedIncreasingDeltaColors = (0, PlotlyColorAdapter_1.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);
609
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
622
610
  sublabelColor = color;
623
611
  }
624
612
  else {
625
613
  sublabel = "\u25BC ".concat(Math.abs(diff));
626
- var color = (0, colors_1.getColorFromToken)(colors_1.DataVizPalette.error, isDarkTheme);
614
+ var extractedDecreasingDeltaColors = (0, PlotlyColorAdapter_1.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);
615
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
627
616
  sublabelColor = color;
628
617
  }
629
618
  }
@@ -635,20 +624,64 @@ var transformPlotlyJsonToGaugeProps = function (input, colorMap, isDarkTheme) {
635
624
  var chartTitle = getTitles(input.layout).chartTitle;
636
625
  return {
637
626
  segments: segments,
638
- chartValue: (_p = firstData.value) !== null && _p !== void 0 ? _p : 0,
627
+ chartValue: (_8 = firstData.value) !== null && _8 !== void 0 ? _8 : 0,
639
628
  chartTitle: chartTitle,
640
629
  sublabel: sublabel,
641
630
  // range values can be null
642
- 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,
643
- 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,
631
+ 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,
632
+ 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,
644
633
  chartValueFormat: function () { var _a, _b; return (_b = (_a = firstData.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; },
645
- width: (_2 = input.layout) === null || _2 === void 0 ? void 0 : _2.width,
646
- height: (_4 = (_3 = input.layout) === null || _3 === void 0 ? void 0 : _3.height) !== null && _4 !== void 0 ? _4 : 220,
634
+ width: (_21 = input.layout) === null || _21 === void 0 ? void 0 : _21.width,
635
+ height: (_23 = (_22 = input.layout) === null || _22 === void 0 ? void 0 : _22.height) !== null && _23 !== void 0 ? _23 : 220,
647
636
  styles: styles,
648
- variant: ((_6 = (_5 = firstData.gauge) === null || _5 === void 0 ? void 0 : _5.steps) === null || _6 === void 0 ? void 0 : _6.length) ? index_1.GaugeChartVariant.MultipleSegments : index_1.GaugeChartVariant.SingleSegment,
637
+ variant: ((_25 = (_24 = firstData.gauge) === null || _24 === void 0 ? void 0 : _24.steps) === null || _25 === void 0 ? void 0 : _25.length) ? index_1.GaugeChartVariant.MultipleSegments : index_1.GaugeChartVariant.SingleSegment,
638
+ roundCorners: true,
649
639
  };
650
640
  };
651
641
  exports.transformPlotlyJsonToGaugeProps = transformPlotlyJsonToGaugeProps;
642
+ var cleanText = function (text) {
643
+ return text
644
+ .replace(/&lt;[^&]*?&gt;/g, '')
645
+ .replace(/<[^>]*>/g, '')
646
+ .replace(/&lt;br&gt;|\\u003cbr\\u003e|<br>/gi, '')
647
+ .replace(/\$[^$]*\$/g, '$')
648
+ .trim();
649
+ };
650
+ var transformPlotlyJsonToChartTableProps = function (input, colorMap, isDarkTheme) {
651
+ var _a, _b, _c, _d, _e, _f, _g, _h;
652
+ var tableData = input.data[0];
653
+ var normalizeHeaders = function (values) {
654
+ // Case: values is array of arrays
655
+ if (Array.isArray(values[0])) {
656
+ return values.map(function (row) {
657
+ return row
658
+ .map(function (cell) { return cleanText(cell); })
659
+ .filter(Boolean)
660
+ .join(' ');
661
+ });
662
+ }
663
+ // Case: values is 1d array
664
+ return values.map(function (cell) { return cleanText(cell); });
665
+ };
666
+ var columns = (_b = (_a = tableData.cells) === null || _a === void 0 ? void 0 : _a.values) !== null && _b !== void 0 ? _b : [];
667
+ var rows = columns[0].map(function (_, rowIndex) {
668
+ return columns.map(function (col) {
669
+ var cell = col[rowIndex];
670
+ return typeof cell === 'string' ? cleanText(cell) : cell;
671
+ });
672
+ });
673
+ var styles = {
674
+ root: tslib_1.__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 } : {})),
675
+ };
676
+ return {
677
+ headers: normalizeHeaders((_f = (_e = tableData.header) === null || _e === void 0 ? void 0 : _e.values) !== null && _f !== void 0 ? _f : []),
678
+ rows: rows,
679
+ width: (_g = input.layout) === null || _g === void 0 ? void 0 : _g.width,
680
+ height: (_h = input.layout) === null || _h === void 0 ? void 0 : _h.height,
681
+ styles: styles,
682
+ };
683
+ };
684
+ exports.transformPlotlyJsonToChartTableProps = transformPlotlyJsonToChartTableProps;
652
685
  var projectPolarToCartesian = function (input) {
653
686
  var projection = tslib_1.__assign({}, input);
654
687
  for (var sindex = 0; sindex < input.data.length; sindex++) {
@@ -666,6 +699,7 @@ var projectPolarToCartesian = function (input) {
666
699
  return projection;
667
700
  };
668
701
  exports.projectPolarToCartesian = projectPolarToCartesian;
702
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
669
703
  function isPlainObject(obj) {
670
704
  if (window && window.process && window.process.versions) {
671
705
  return Object.prototype.toString.call(obj) === '[object Object]';
@@ -673,20 +707,26 @@ function isPlainObject(obj) {
673
707
  return (Object.prototype.toString.call(obj) === '[object Object]' &&
674
708
  Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty'));
675
709
  }
710
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
676
711
  var arrayAttributes = [];
712
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
677
713
  var stack = [];
714
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
678
715
  var isArrayStack = [];
716
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
679
717
  var baseContainer, baseAttrName;
680
718
  /**
681
719
  * Interate iteratively through the trace object and find all the array attributes.
682
720
  * 1 trace record = 1 series of data
683
721
  * @param trace
684
722
  */
723
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
685
724
  function findArrayAttributes(trace) {
686
725
  // Init basecontainer and baseAttrName
687
726
  crawlIntoTrace(baseContainer, 0, '');
688
727
  }
689
728
  exports.findArrayAttributes = findArrayAttributes;
729
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
690
730
  function crawlIntoTrace(container, i, astrPartial) {
691
731
  var item = container[stack[i]];
692
732
  var newAstrPartial = astrPartial + stack[i];
@@ -737,7 +777,9 @@ function getLineOptions(line) {
737
777
  }
738
778
  return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
739
779
  }
780
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
740
781
  var isStringArray = function (arr) {
782
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
741
783
  return (0, chart_utilities_1.isArrayOfType)(arr, function (value) { return typeof value === 'string'; });
742
784
  };
743
785
  // TODO: Use binary search to find the appropriate bin for numeric value.