@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,7 +1,7 @@
1
- define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-time-format", "d3-shape", "d3-color"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, colors_1, index_1, utilities_1, chart_utilities_1, d3_time_format_1, d3_shape_1, d3_color_1) {
1
+ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-time-format", "d3-shape", "./PlotlyColorAdapter"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, colors_1, index_1, utilities_1, chart_utilities_1, d3_time_format_1, d3_shape_1, PlotlyColorAdapter_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- 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;
4
+ 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;
5
5
  var dashOptions = {
6
6
  dot: {
7
7
  strokeDasharray: '1, 5',
@@ -40,6 +40,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
40
40
  lineBorderWidth: '4',
41
41
  },
42
42
  };
43
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
44
  var isMonth = function (possiblyMonthValue) {
44
45
  var parseFullMonth = (0, d3_time_format_1.timeParse)('%B');
45
46
  var parseShortMonth = (0, d3_time_format_1.timeParse)('%b');
@@ -58,6 +59,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
58
59
  };
59
60
  return titles;
60
61
  }
62
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
63
  var correctYearMonth = function (xValues) {
62
64
  var presentYear = new Date().getFullYear();
63
65
  if (xValues.length > 0 && Array.isArray(xValues[0])) {
@@ -85,15 +87,6 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
85
87
  return xValues;
86
88
  };
87
89
  exports.correctYearMonth = correctYearMonth;
88
- var getColor = function (legendLabel, colorMap, isDarkTheme) {
89
- if (!colorMap.current.has(legendLabel)) {
90
- var nextColor = (0, colors_1.getNextColor)(colorMap.current.size + 1, 0, isDarkTheme);
91
- colorMap.current.set(legendLabel, nextColor);
92
- return nextColor;
93
- }
94
- return colorMap.current.get(legendLabel);
95
- };
96
- exports.getColor = getColor;
97
90
  var usesSecondaryYScale = function (series) {
98
91
  return series.yaxis === 'y2';
99
92
  };
@@ -137,51 +130,21 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
137
130
  },
138
131
  };
139
132
  };
140
- var getSchemaColors = function (colors, colorMap, isDarkTheme) {
141
- var hexColors = [];
142
- if (!colors) {
143
- return undefined;
144
- }
145
- if ((0, chart_utilities_1.isArrayOrTypedArray)(colors)) {
146
- colors.forEach(function (element, index) {
147
- var colorString = element === null || element === void 0 ? void 0 : element.toString().trim();
148
- var nextFluentColor = (0, exports.getColor)("Label_".concat(index), colorMap, isDarkTheme);
149
- if (colorString) {
150
- var parsedColor = (0, d3_color_1.color)(colorString);
151
- hexColors.push(parsedColor ? parsedColor.formatHex() : nextFluentColor);
152
- }
153
- else {
154
- hexColors.push(nextFluentColor);
155
- }
156
- });
157
- }
158
- else if (typeof colors === 'string') {
159
- var parsedColor = (0, d3_color_1.color)(colors);
160
- return parsedColor ? parsedColor.formatHex() : (0, exports.getColor)('Label_0', colorMap, isDarkTheme);
161
- }
162
- return hexColors;
133
+ var _getGaugeAxisColor = function (colorway, colorwayType, color, colorMap, isDarkTheme) {
134
+ var extractedColors = (0, PlotlyColorAdapter_1.extractColor)(colorway, colorwayType, color, colorMap, isDarkTheme);
135
+ return (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, '', colorMap, isDarkTheme);
163
136
  };
164
- exports.getSchemaColors = getSchemaColors;
165
- var transformPlotlyJsonToDonutProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
166
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
137
+ exports._getGaugeAxisColor = _getGaugeAxisColor;
138
+ var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, isDarkTheme) {
139
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
167
140
  var firstData = input.data[0];
168
- var colors = undefined;
169
- if (!useFluentVizColorPalette) {
170
- 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;
171
- }
141
+ // extract colors for each series only once
142
+ 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);
172
143
  var mapLegendToDataPoint = {};
173
- (_c = firstData.labels) === null || _c === void 0 ? void 0 : _c.forEach(function (label, index) {
144
+ (_e = firstData.labels) === null || _e === void 0 ? void 0 : _e.forEach(function (label, index) {
174
145
  var _a;
175
- var color = '';
176
- if (colors && isStringArray(colors)) {
177
- color = colors[index % colors.length];
178
- }
179
- else if (typeof colors === 'string') {
180
- color = colors;
181
- }
182
- else {
183
- color = (0, exports.getColor)(label, colorMap, isDarkTheme);
184
- }
146
+ // resolve color for each legend from the extracted colors
147
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(colors, index, label, colorMap, isDarkTheme);
185
148
  //ToDo how to handle string data?
186
149
  var value = typeof ((_a = firstData.values) === null || _a === void 0 ? void 0 : _a[index]) === 'number' ? firstData.values[index] : 1;
187
150
  if (!mapLegendToDataPoint[label]) {
@@ -195,8 +158,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
195
158
  mapLegendToDataPoint[label].data += value;
196
159
  }
197
160
  });
198
- var width = (_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.width) !== null && _e !== void 0 ? _e : 440;
199
- var height = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : 220;
161
+ var width = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.width) !== null && _g !== void 0 ? _g : 440;
162
+ var height = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.height) !== null && _j !== void 0 ? _j : 220;
200
163
  var hideLabels = firstData.textinfo
201
164
  ? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)
202
165
  : false;
@@ -211,33 +174,39 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
211
174
  chartTitle: chartTitle,
212
175
  chartData: Object.values(mapLegendToDataPoint),
213
176
  },
214
- hideLegend: ((_h = input.layout) === null || _h === void 0 ? void 0 : _h.showlegend) === false ? true : false,
215
- width: (_j = input.layout) === null || _j === void 0 ? void 0 : _j.width,
177
+ hideLegend: ((_k = input.layout) === null || _k === void 0 ? void 0 : _k.showlegend) === false ? true : false,
178
+ width: (_l = input.layout) === null || _l === void 0 ? void 0 : _l.width,
216
179
  height: height,
217
180
  innerRadius: innerRadius,
218
181
  hideLabels: hideLabels,
219
182
  showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
183
+ roundCorners: true,
220
184
  };
221
185
  };
222
186
  exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
223
- var transformPlotlyJsonToVSBCProps = function (input, colorMap, isDarkTheme, fallbackVSBC) {
187
+ var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
224
188
  var _a, _b, _c;
225
189
  var mapXToDataPoints = {};
226
190
  var yMaxValue = 0;
227
191
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
228
192
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
229
193
  input.data.forEach(function (series, index1) {
230
- var _a;
194
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
231
195
  var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
232
- (_a = series.x) === null || _a === void 0 ? void 0 : _a.forEach(function (x, index2) {
196
+ // extract bar colors for each series only once
197
+ 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);
198
+ // extract line colors for each series only once
199
+ 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);
200
+ (_j = series.x) === null || _j === void 0 ? void 0 : _j.forEach(function (x, index2) {
233
201
  var _a, _b, _c;
234
202
  if (!mapXToDataPoints[x]) {
235
203
  mapXToDataPoints[x] = { xAxisPoint: isXYearCategory ? x.toString() : x, chartData: [], lineData: [] };
236
204
  }
237
205
  var legend = legends[index1];
206
+ // resolve color for each legend's bars from the extracted colors
207
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index1, legend, colorMap, isDarkTheme);
238
208
  var yVal = (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2]) !== null && _b !== void 0 ? _b : 0;
239
209
  if (series.type === 'bar') {
240
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
241
210
  mapXToDataPoints[x].chartData.push({
242
211
  legend: legend,
243
212
  data: yVal,
@@ -246,11 +215,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
246
215
  yMaxValue = Math.max(yMaxValue, yVal);
247
216
  }
248
217
  else if (series.type === 'scatter' || !!fallbackVSBC) {
249
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
218
+ var lineColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
250
219
  var lineOptions = getLineOptions(series.line);
251
220
  var dashType = ((_c = series.line) === null || _c === void 0 ? void 0 : _c.dash) || 'solid';
252
221
  var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
253
- mapXToDataPoints[x].lineData.push(tslib_1.__assign(tslib_1.__assign({ legend: legend, legendShape: legendShape, y: yVal, color: color }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) }));
222
+ mapXToDataPoints[x].lineData.push(tslib_1.__assign(tslib_1.__assign({ legend: legend, legendShape: legendShape, y: yVal, color: lineColor }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) }));
254
223
  if (!usesSecondaryYScale(series)) {
255
224
  yMaxValue = Math.max(yMaxValue, yVal);
256
225
  }
@@ -258,24 +227,27 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
258
227
  });
259
228
  });
260
229
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
261
- 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 });
230
+ 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 });
262
231
  };
263
232
  exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
264
- var transformPlotlyJsonToGVBCProps = function (input, colorMap, isDarkTheme) {
233
+ var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
265
234
  var _a, _b, _c;
266
235
  var mapXToDataPoints = {};
267
236
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
268
237
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
269
238
  input.data.forEach(function (series, index1) {
270
- var _a;
271
- (_a = series.x) === null || _a === void 0 ? void 0 : _a.forEach(function (x, xIndex) {
239
+ var _a, _b, _c, _d, _e;
240
+ // extract colors for each series only once
241
+ 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);
242
+ (_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
272
243
  var _a, _b;
273
244
  if (!mapXToDataPoints[x]) {
274
245
  mapXToDataPoints[x] = { name: x.toString(), series: [] };
275
246
  }
276
247
  if (series.type === 'bar') {
277
248
  var legend = legends[index1];
278
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
249
+ // resolve color for each legend's bars from the extracted colors
250
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
279
251
  mapXToDataPoints[x].series.push({
280
252
  key: legend,
281
253
  data: (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex]) !== null && _b !== void 0 ? _b : 0,
@@ -288,22 +260,24 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
288
260
  });
289
261
  });
290
262
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
291
- 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 });
263
+ 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 });
292
264
  };
293
265
  exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
294
- var transformPlotlyJsonToVBCProps = function (input, colorMap, isDarkTheme) {
266
+ var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
295
267
  var _a, _b, _c;
296
268
  var vbcData = [];
297
269
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
298
270
  input.data.forEach(function (series, seriesIdx) {
299
- var _a, _b, _c;
271
+ var _a, _b, _c, _d, _e, _f, _g;
300
272
  if (!series.x) {
301
273
  return;
302
274
  }
275
+ // extract colors for each series only once
276
+ 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);
303
277
  var isXString = isStringArray(series.x);
304
278
  // TODO: In case of a single bin, add an empty bin of the same size to prevent the
305
279
  // default bar width from being used and ensure the bar spans the full intended range.
306
- 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);
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);
307
281
  var yBins = xBins.map(function () { return []; });
308
282
  var total = 0;
309
283
  series.x.forEach(function (xVal, index) {
@@ -320,7 +294,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
320
294
  });
321
295
  xBins.forEach(function (bin, index) {
322
296
  var legend = legends[seriesIdx];
323
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
297
+ // resolve color for each legend's bars from the extracted colors
298
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, seriesIdx, legend, colorMap, isDarkTheme);
324
299
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
325
300
  vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
326
301
  ? {}
@@ -340,27 +315,29 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
340
315
  hideTickOverlap: true,
341
316
  maxBarWidth: 50,
342
317
  hideLegend: hideLegend,
318
+ roundCorners: true,
343
319
  };
344
320
  };
345
321
  exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
346
- var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, colorMap, useFluentVizColorPalette, isDarkTheme) {
322
+ var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, isScatterMarkers, colorMap, colorwayType, isDarkTheme) {
347
323
  var _a, _b, _c, _d, _e, _f;
348
324
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
349
325
  var mode = 'tonexty';
350
326
  var _g = getLegendProps(input.data, input.layout), legends = _g.legends, hideLegend = _g.hideLegend;
351
327
  var chartData = input.data.map(function (series, index) {
352
- var _a, _b, _c;
328
+ var _a, _b, _c, _d, _e, _f;
329
+ // extract colors for each series only once
330
+ 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);
353
331
  var xValues = series.x;
354
332
  var isString = typeof xValues[0] === 'string';
355
333
  var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
356
334
  var isXNumber = (0, chart_utilities_1.isNumberArray)(xValues);
357
335
  var legend = legends[index];
358
- var lineColor = !useFluentVizColorPalette && ((_a = series.line) === null || _a === void 0 ? void 0 : _a.color)
359
- ? (0, exports.getSchemaColors)((_b = series.line) === null || _b === void 0 ? void 0 : _b.color, colorMap, isDarkTheme)
360
- : (0, exports.getColor)(legend, colorMap, isDarkTheme);
336
+ // resolve color for each legend's lines from the extracted colors
337
+ var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
361
338
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
362
339
  var lineOptions = getLineOptions(series.line);
363
- var dashType = ((_c = series.line) === null || _c === void 0 ? void 0 : _c.dash) || 'solid';
340
+ var dashType = ((_f = series.line) === null || _f === void 0 ? void 0 : _f.dash) || 'solid';
364
341
  var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
365
342
  return tslib_1.__assign(tslib_1.__assign({ legend: legend, legendShape: legendShape, data: xValues.map(function (x, i) {
366
343
  var _a, _b;
@@ -369,7 +346,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
369
346
  : typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
370
347
  ? { markerSize: series.marker.size }
371
348
  : {})));
372
- }), color: lineColor }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) });
349
+ }), color: seriesColor }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) });
373
350
  });
374
351
  var yMinMaxValues = (0, utilities_1.findNumericMinMaxOfY)(chartData);
375
352
  var _h = getTitles(input.layout), chartTitle = _h.chartTitle, xAxisTitle = _h.xAxisTitle, yAxisTitle = _h.yAxisTitle;
@@ -385,13 +362,17 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
385
362
  }
386
363
  };
387
364
  exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
388
- var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, isDarkTheme) {
365
+ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, colorwayType, isDarkTheme) {
389
366
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
390
367
  var _s = getLegendProps(input.data, input.layout), legends = _s.legends, hideLegend = _s.hideLegend;
391
368
  var chartData = input.data
392
369
  .map(function (series, index) {
370
+ var _a, _b, _c, _d;
371
+ // extract colors for each series only once
372
+ 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);
393
373
  var legend = legends[index];
394
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
374
+ // resolve color for each legend's bars from the extracted colors
375
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
395
376
  return series.y.map(function (yValue, i) {
396
377
  return {
397
378
  x: series.x[i],
@@ -433,6 +414,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
433
414
  hideLegend: hideLegend,
434
415
  noOfCharsToTruncate: 20,
435
416
  showYAxisLablesTooltip: true,
417
+ roundCorners: true,
436
418
  };
437
419
  };
438
420
  exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
@@ -483,6 +465,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
483
465
  else {
484
466
  (_h = firstData.x) === null || _h === void 0 ? void 0 : _h.forEach(function (xVal, xIdx) {
485
467
  var _a;
468
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
486
469
  (_a = firstData.y) === null || _a === void 0 ? void 0 : _a.forEach(function (yVal, yIdx) {
487
470
  var _a, _b, _c, _d, _e, _f;
488
471
  var zVal = (_b = (_a = firstData.z) === null || _a === void 0 ? void 0 : _a[yIdx]) === null || _b === void 0 ? void 0 : _b[xIdx];
@@ -536,33 +519,34 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
536
519
  };
537
520
  };
538
521
  exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
539
- var transformPlotlyJsonToSankeyProps = function (input, colorMap, isDarkTheme) {
540
- var _a, _b, _c, _d, _e, _f, _g, _h;
541
- var _j = input.data[0], link = _j.link, node = _j.node;
522
+ var transformPlotlyJsonToSankeyProps = function (input, colorMap, colorwayType, isDarkTheme) {
523
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
524
+ var _m = input.data[0], link = _m.link, node = _m.node;
542
525
  var validLinks = ((_a = link === null || link === void 0 ? void 0 : link.value) !== null && _a !== void 0 ? _a : [])
543
526
  .map(function (val, index) { return ({
544
527
  value: val,
545
528
  source: link === null || link === void 0 ? void 0 : link.source[index],
546
529
  target: link === null || link === void 0 ? void 0 : link.target[index],
547
530
  }); })
548
- // eslint-disable-next-line @typescript-eslint/no-shadow
549
531
  // Filter out negative nodes, unequal nodes and self-references (circular links)
550
532
  .filter(function (x) { return x.source >= 0 && x.target >= 0 && x.source !== x.target; });
533
+ 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);
551
534
  var sankeyChartData = {
552
- nodes: (_b = node.label) === null || _b === void 0 ? void 0 : _b.map(function (label, index) {
553
- var color = (0, exports.getColor)(label, colorMap, isDarkTheme);
535
+ nodes: (_e = node.label) === null || _e === void 0 ? void 0 : _e.map(function (label, index) {
536
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedNodeColors, index, label, colorMap, isDarkTheme);
554
537
  return {
555
538
  nodeId: index,
556
539
  name: label,
557
540
  color: color,
558
541
  };
559
542
  }),
543
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
560
544
  links: validLinks.map(function (validLink, index) {
561
545
  return tslib_1.__assign({}, validLink);
562
546
  }),
563
547
  };
564
548
  var styles = {
565
- 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 } : {})),
549
+ 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 } : {})),
566
550
  };
567
551
  var chartTitle = getTitles(input.layout).chartTitle;
568
552
  return {
@@ -570,51 +554,56 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
570
554
  chartTitle: chartTitle,
571
555
  SankeyChartData: sankeyChartData,
572
556
  },
573
- width: (_f = input.layout) === null || _f === void 0 ? void 0 : _f.width,
574
- height: (_h = (_g = input.layout) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : 468,
557
+ width: (_j = input.layout) === null || _j === void 0 ? void 0 : _j.width,
558
+ height: (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : 468,
575
559
  styles: styles,
576
560
  enableReflow: true,
577
561
  };
578
562
  };
579
563
  exports.transformPlotlyJsonToSankeyProps = transformPlotlyJsonToSankeyProps;
580
- var transformPlotlyJsonToGaugeProps = function (input, colorMap, isDarkTheme) {
581
- 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;
564
+ var transformPlotlyJsonToGaugeProps = function (input, colorMap, colorwayType, isDarkTheme) {
565
+ 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;
582
566
  var firstData = input.data[0];
583
- var segments = ((_b = (_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) === null || _b === void 0 ? void 0 : _b.length)
584
- ? firstData.gauge.steps.map(function (step, index) {
585
- var _a, _b;
586
- var legend = step.name || "Segment ".concat(index + 1);
587
- var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
588
- return {
589
- legend: legend,
590
- size: ((_a = step.range) === null || _a === void 0 ? void 0 : _a[1]) - ((_b = step.range) === null || _b === void 0 ? void 0 : _b[0]),
591
- color: color,
592
- };
593
- })
567
+ var stepsColors = ((_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) ? firstData.gauge.steps.map(function (step) { return step.color; }) : undefined;
568
+ 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);
569
+ var segments = ((_f = (_e = firstData.gauge) === null || _e === void 0 ? void 0 : _e.steps) === null || _f === void 0 ? void 0 : _f.length)
570
+ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
571
+ firstData.gauge.steps.map(function (step, index) {
572
+ var _a, _b;
573
+ var legend = step.name || "Segment ".concat(index + 1);
574
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
575
+ return {
576
+ legend: legend,
577
+ size: ((_a = step.range) === null || _a === void 0 ? void 0 : _a[1]) - ((_b = step.range) === null || _b === void 0 ? void 0 : _b[0]),
578
+ color: color,
579
+ };
580
+ })
594
581
  : [
595
582
  {
596
583
  legend: 'Current',
597
- 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),
598
- color: (0, exports.getColor)('Current', colorMap, isDarkTheme),
584
+ 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),
585
+ 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),
599
586
  },
600
587
  {
601
588
  legend: 'Target',
602
- 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),
589
+ 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),
603
590
  color: colors_1.DataVizPalette.disabled,
604
591
  },
605
592
  ];
606
593
  var sublabel;
607
594
  var sublabelColor;
608
- if ((_o = firstData.delta) === null || _o === void 0 ? void 0 : _o.reference) {
595
+ if ((_x = firstData.delta) === null || _x === void 0 ? void 0 : _x.reference) {
609
596
  var diff = firstData.value - firstData.delta.reference;
610
597
  if (diff >= 0) {
611
598
  sublabel = "\u25B2 ".concat(diff);
612
- var color = (0, colors_1.getColorFromToken)(colors_1.DataVizPalette.success, isDarkTheme);
599
+ 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);
600
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
613
601
  sublabelColor = color;
614
602
  }
615
603
  else {
616
604
  sublabel = "\u25BC ".concat(Math.abs(diff));
617
- var color = (0, colors_1.getColorFromToken)(colors_1.DataVizPalette.error, isDarkTheme);
605
+ 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);
606
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
618
607
  sublabelColor = color;
619
608
  }
620
609
  }
@@ -626,20 +615,64 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
626
615
  var chartTitle = getTitles(input.layout).chartTitle;
627
616
  return {
628
617
  segments: segments,
629
- chartValue: (_p = firstData.value) !== null && _p !== void 0 ? _p : 0,
618
+ chartValue: (_8 = firstData.value) !== null && _8 !== void 0 ? _8 : 0,
630
619
  chartTitle: chartTitle,
631
620
  sublabel: sublabel,
632
621
  // range values can be null
633
- 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,
634
- 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,
622
+ 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,
623
+ 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,
635
624
  chartValueFormat: function () { var _a, _b; return (_b = (_a = firstData.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; },
636
- width: (_2 = input.layout) === null || _2 === void 0 ? void 0 : _2.width,
637
- height: (_4 = (_3 = input.layout) === null || _3 === void 0 ? void 0 : _3.height) !== null && _4 !== void 0 ? _4 : 220,
625
+ width: (_21 = input.layout) === null || _21 === void 0 ? void 0 : _21.width,
626
+ height: (_23 = (_22 = input.layout) === null || _22 === void 0 ? void 0 : _22.height) !== null && _23 !== void 0 ? _23 : 220,
638
627
  styles: styles,
639
- 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,
628
+ 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,
629
+ roundCorners: true,
640
630
  };
641
631
  };
642
632
  exports.transformPlotlyJsonToGaugeProps = transformPlotlyJsonToGaugeProps;
633
+ var cleanText = function (text) {
634
+ return text
635
+ .replace(/&lt;[^&]*?&gt;/g, '')
636
+ .replace(/<[^>]*>/g, '')
637
+ .replace(/&lt;br&gt;|\\u003cbr\\u003e|<br>/gi, '')
638
+ .replace(/\$[^$]*\$/g, '$')
639
+ .trim();
640
+ };
641
+ var transformPlotlyJsonToChartTableProps = function (input, colorMap, isDarkTheme) {
642
+ var _a, _b, _c, _d, _e, _f, _g, _h;
643
+ var tableData = input.data[0];
644
+ var normalizeHeaders = function (values) {
645
+ // Case: values is array of arrays
646
+ if (Array.isArray(values[0])) {
647
+ return values.map(function (row) {
648
+ return row
649
+ .map(function (cell) { return cleanText(cell); })
650
+ .filter(Boolean)
651
+ .join(' ');
652
+ });
653
+ }
654
+ // Case: values is 1d array
655
+ return values.map(function (cell) { return cleanText(cell); });
656
+ };
657
+ var columns = (_b = (_a = tableData.cells) === null || _a === void 0 ? void 0 : _a.values) !== null && _b !== void 0 ? _b : [];
658
+ var rows = columns[0].map(function (_, rowIndex) {
659
+ return columns.map(function (col) {
660
+ var cell = col[rowIndex];
661
+ return typeof cell === 'string' ? cleanText(cell) : cell;
662
+ });
663
+ });
664
+ var styles = {
665
+ 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 } : {})),
666
+ };
667
+ return {
668
+ headers: normalizeHeaders((_f = (_e = tableData.header) === null || _e === void 0 ? void 0 : _e.values) !== null && _f !== void 0 ? _f : []),
669
+ rows: rows,
670
+ width: (_g = input.layout) === null || _g === void 0 ? void 0 : _g.width,
671
+ height: (_h = input.layout) === null || _h === void 0 ? void 0 : _h.height,
672
+ styles: styles,
673
+ };
674
+ };
675
+ exports.transformPlotlyJsonToChartTableProps = transformPlotlyJsonToChartTableProps;
643
676
  var projectPolarToCartesian = function (input) {
644
677
  var projection = tslib_1.__assign({}, input);
645
678
  for (var sindex = 0; sindex < input.data.length; sindex++) {
@@ -657,6 +690,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
657
690
  return projection;
658
691
  };
659
692
  exports.projectPolarToCartesian = projectPolarToCartesian;
693
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
660
694
  function isPlainObject(obj) {
661
695
  if (window && window.process && window.process.versions) {
662
696
  return Object.prototype.toString.call(obj) === '[object Object]';
@@ -664,20 +698,26 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
664
698
  return (Object.prototype.toString.call(obj) === '[object Object]' &&
665
699
  Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty'));
666
700
  }
701
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
667
702
  var arrayAttributes = [];
703
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
668
704
  var stack = [];
705
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
669
706
  var isArrayStack = [];
707
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
670
708
  var baseContainer, baseAttrName;
671
709
  /**
672
710
  * Interate iteratively through the trace object and find all the array attributes.
673
711
  * 1 trace record = 1 series of data
674
712
  * @param trace
675
713
  */
714
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
676
715
  function findArrayAttributes(trace) {
677
716
  // Init basecontainer and baseAttrName
678
717
  crawlIntoTrace(baseContainer, 0, '');
679
718
  }
680
719
  exports.findArrayAttributes = findArrayAttributes;
720
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
681
721
  function crawlIntoTrace(container, i, astrPartial) {
682
722
  var item = container[stack[i]];
683
723
  var newAstrPartial = astrPartial + stack[i];
@@ -728,7 +768,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
728
768
  }
729
769
  return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
730
770
  }
771
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
731
772
  var isStringArray = function (arr) {
773
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
732
774
  return (0, chart_utilities_1.isArrayOfType)(arr, function (value) { return typeof value === 'string'; });
733
775
  };
734
776
  // TODO: Use binary search to find the appropriate bin for numeric value.