@fluentui/react-charting 5.23.42 → 5.23.44

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 (54) hide show
  1. package/CHANGELOG.json +61 -1
  2. package/CHANGELOG.md +25 -2
  3. package/bundle-size/DeclarativeChart.fixture.js +7 -0
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/lib/components/DeclarativeChart/DeclarativeChart.js +66 -49
  7. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  8. package/lib/components/DeclarativeChart/PlotlySchema.d.ts +1516 -0
  9. package/lib/components/DeclarativeChart/PlotlySchema.js +4 -0
  10. package/lib/components/DeclarativeChart/PlotlySchema.js.map +1 -0
  11. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +16 -13
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +221 -114
  13. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  14. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +5 -4
  15. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  16. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +10 -1
  17. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  18. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +1 -1
  19. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  20. package/lib/utilities/utilities.js +2 -9
  21. package/lib/utilities/utilities.js.map +1 -1
  22. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +64 -47
  23. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  24. package/lib-amd/components/DeclarativeChart/PlotlySchema.d.ts +1516 -0
  25. package/lib-amd/components/DeclarativeChart/PlotlySchema.js +7 -0
  26. package/lib-amd/components/DeclarativeChart/PlotlySchema.js.map +1 -0
  27. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +16 -13
  28. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +223 -115
  29. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  30. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +5 -4
  31. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  32. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +10 -1
  33. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  34. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +1 -1
  35. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  36. package/lib-amd/utilities/utilities.js +2 -9
  37. package/lib-amd/utilities/utilities.js.map +1 -1
  38. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +65 -48
  39. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  40. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.d.ts +1516 -0
  41. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +5 -0
  42. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +1 -0
  43. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +16 -13
  44. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +223 -115
  45. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  46. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +5 -4
  47. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  48. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +10 -1
  49. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  50. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +1 -1
  51. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  52. package/lib-commonjs/utilities/utilities.js +2 -9
  53. package/lib-commonjs/utilities/utilities.js.map +1 -1
  54. package/package.json +3 -3
@@ -1,43 +1,92 @@
1
1
  define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../../utilities/colors", "../GaugeChart/index", "d3-time-format"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, d3_format_1, colors_1, index_1, d3_time_format_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.findArrayAttributes = exports.isArrayOrTypedArray = exports.sanitizeJson = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.getColor = exports.updateXValues = exports.isMonthArray = exports.isNumberArray = exports.isDateArray = void 0;
5
- var isDate = function (value) { return !isNaN(Date.parse(value)); };
4
+ exports.findArrayAttributes = exports.isArrayOrTypedArray = exports.sanitizeJson = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.getColor = exports.updateXValues = exports.isLineData = exports.isMonthArray = exports.isNumberArray = exports.isDateArray = void 0;
5
+ var SUPPORTED_PLOT_TYPES = ['pie', 'bar', 'scatter', 'heatmap', 'sankey', 'indicator', 'histogram'];
6
+ var isDate = function (value) {
7
+ var parsedDate = new Date(Date.parse(value));
8
+ if (isNaN(parsedDate.getTime())) {
9
+ return false;
10
+ }
11
+ var parsedYear = parsedDate.getFullYear();
12
+ var yearInString = /\b\d{4}\b/.test(value);
13
+ if (!yearInString && (parsedYear === 2000 || parsedYear === 2001)) {
14
+ return false;
15
+ }
16
+ return true;
17
+ };
6
18
  var isNumber = function (value) { return !isNaN(parseFloat(value)) && isFinite(value); };
7
- var isDateArray = function (array) { return isArrayOrTypedArray(array) && array.every(isDate); };
19
+ var isMonth = function (possiblyMonthValue) {
20
+ var parseFullMonth = (0, d3_time_format_1.timeParse)('%B');
21
+ var parseShortMonth = (0, d3_time_format_1.timeParse)('%b');
22
+ return parseFullMonth(possiblyMonthValue) !== null || parseShortMonth(possiblyMonthValue) !== null;
23
+ };
24
+ var isArrayOfType = function (plotCoordinates, typeCheck) {
25
+ var args = [];
26
+ for (var _i = 2; _i < arguments.length; _i++) {
27
+ args[_i - 2] = arguments[_i];
28
+ }
29
+ if (!isArrayOrTypedArray(plotCoordinates)) {
30
+ return false;
31
+ }
32
+ if (plotCoordinates.length === 0) {
33
+ return false;
34
+ }
35
+ if (Array.isArray(plotCoordinates[0])) {
36
+ // Handle 2D array
37
+ return plotCoordinates.every(function (innerArray) { return innerArray.every(function (datum) { return typeCheck.apply(void 0, tslib_1.__spreadArray([datum], args, false)); }); });
38
+ }
39
+ else {
40
+ // Handle 1D array
41
+ return plotCoordinates.every(function (datum) { return typeCheck.apply(void 0, tslib_1.__spreadArray([datum], args, false)); });
42
+ }
43
+ };
44
+ var isDateArray = function (data) {
45
+ return isArrayOfType(data, isDate);
46
+ };
8
47
  exports.isDateArray = isDateArray;
9
- var isNumberArray = function (array) { return isArrayOrTypedArray(array) && array.every(isNumber); };
48
+ var isNumberArray = function (data) {
49
+ return isArrayOfType(data, isNumber);
50
+ };
10
51
  exports.isNumberArray = isNumberArray;
11
- var isMonthArray = function (array) {
12
- if (array && array.length > 0) {
13
- var parseFullMonth_1 = (0, d3_time_format_1.timeParse)('%B');
14
- var parseShortMonth_1 = (0, d3_time_format_1.timeParse)('%b');
15
- return array.every(function (possiblyMonthValue) {
16
- return parseFullMonth_1(possiblyMonthValue) !== null || parseShortMonth_1(possiblyMonthValue) !== null;
17
- });
18
- }
19
- return false;
52
+ var isMonthArray = function (data) {
53
+ return isArrayOfType(data, isMonth);
20
54
  };
21
55
  exports.isMonthArray = isMonthArray;
56
+ var isLineData = function (data) {
57
+ return (!SUPPORTED_PLOT_TYPES.includes("".concat(data.type)) &&
58
+ Array.isArray(data.x) &&
59
+ isArrayOfType(data.y, function (value) { return typeof value === 'number'; }) &&
60
+ data.x.length > 0 &&
61
+ data.x.length === data.y.length);
62
+ };
63
+ exports.isLineData = isLineData;
64
+ var invalidate2Dseries = function (series, chartType) {
65
+ var _a, _b;
66
+ if (((_a = series.x) === null || _a === void 0 ? void 0 : _a.length) > 0 && Array.isArray(series.x[0])) {
67
+ throw new Error("transform to ".concat(chartType, ":: 2D x array not supported"));
68
+ }
69
+ if (((_b = series.y) === null || _b === void 0 ? void 0 : _b.length) > 0 && Array.isArray(series.y[0])) {
70
+ throw new Error("transform to ".concat(chartType, ":: 2D y array not supported"));
71
+ }
72
+ };
73
+ var getLegend = function (series, index) {
74
+ return series.name || "Series ".concat(index + 1);
75
+ };
22
76
  function getTitles(layout) {
23
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
77
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
24
78
  var titles = {
25
- chartTitle: typeof layout.title === 'string' ? layout.title : typeof ((_a = layout.title) === null || _a === void 0 ? void 0 : _a.text) === 'string' ? layout.title.text : '',
26
- xAxisTitle: typeof ((_b = layout === null || layout === void 0 ? void 0 : layout.xaxis) === null || _b === void 0 ? void 0 : _b.title) === 'string'
27
- ? (_c = layout === null || layout === void 0 ? void 0 : layout.xaxis) === null || _c === void 0 ? void 0 : _c.title
28
- : typeof ((_e = (_d = layout === null || layout === void 0 ? void 0 : layout.xaxis) === null || _d === void 0 ? void 0 : _d.title) === null || _e === void 0 ? void 0 : _e.text) === 'string'
29
- ? (_g = (_f = layout === null || layout === void 0 ? void 0 : layout.xaxis) === null || _f === void 0 ? void 0 : _f.title) === null || _g === void 0 ? void 0 : _g.text
30
- : '',
31
- yAxisTitle: typeof ((_h = layout === null || layout === void 0 ? void 0 : layout.yaxis) === null || _h === void 0 ? void 0 : _h.title) === 'string'
32
- ? (_j = layout === null || layout === void 0 ? void 0 : layout.yaxis) === null || _j === void 0 ? void 0 : _j.title
33
- : typeof ((_l = (_k = layout === null || layout === void 0 ? void 0 : layout.yaxis) === null || _k === void 0 ? void 0 : _k.title) === null || _l === void 0 ? void 0 : _l.text) === 'string'
34
- ? (_o = (_m = layout === null || layout === void 0 ? void 0 : layout.yaxis) === null || _m === void 0 ? void 0 : _m.title) === null || _o === void 0 ? void 0 : _o.text
35
- : '',
79
+ chartTitle: typeof (layout === null || layout === void 0 ? void 0 : layout.title) === 'string' ? layout.title : (_b = (_a = layout === null || layout === void 0 ? void 0 : layout.title) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : '',
80
+ xAxisTitle: typeof ((_c = layout === null || layout === void 0 ? void 0 : layout.xaxis) === null || _c === void 0 ? void 0 : _c.title) === 'string' ? (_d = layout === null || layout === void 0 ? void 0 : layout.xaxis) === null || _d === void 0 ? void 0 : _d.title : (_g = (_f = (_e = layout === null || layout === void 0 ? void 0 : layout.xaxis) === null || _e === void 0 ? void 0 : _e.title) === null || _f === void 0 ? void 0 : _f.text) !== null && _g !== void 0 ? _g : '',
81
+ yAxisTitle: typeof ((_h = layout === null || layout === void 0 ? void 0 : layout.yaxis) === null || _h === void 0 ? void 0 : _h.title) === 'string' ? (_j = layout === null || layout === void 0 ? void 0 : layout.yaxis) === null || _j === void 0 ? void 0 : _j.title : (_m = (_l = (_k = layout === null || layout === void 0 ? void 0 : layout.yaxis) === null || _k === void 0 ? void 0 : _k.title) === null || _l === void 0 ? void 0 : _l.text) !== null && _m !== void 0 ? _m : '',
36
82
  };
37
83
  return titles;
38
84
  }
39
85
  var updateXValues = function (xValues) {
40
86
  var presentYear = new Date().getFullYear();
87
+ if (xValues.length > 0 && Array.isArray(xValues[0])) {
88
+ throw new Error('updateXValues:: 2D array not supported');
89
+ }
41
90
  var dates = xValues.map(function (possiblyMonthValue) {
42
91
  var parsedDate = "".concat(possiblyMonthValue, " 01, ").concat(presentYear);
43
92
  return isDate(parsedDate) ? new Date(parsedDate) : null;
@@ -69,21 +118,54 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
69
118
  return colorMap.current.get(legendLabel);
70
119
  };
71
120
  exports.getColor = getColor;
72
- var transformPlotlyJsonToDonutProps = function (jsonObj, colorMap, isDarkTheme) {
73
- var _a, _b;
74
- var data = jsonObj.data, layout = jsonObj.layout;
75
- var firstData = data[0];
121
+ var getSecondaryYAxisValues = function (series, layout) {
122
+ var _a;
123
+ var secondaryYAxisValues = {};
124
+ if (layout && layout.yaxis2 && series.yaxis === 'y2') {
125
+ secondaryYAxisValues.secondaryYAxistitle =
126
+ typeof layout.yaxis2.title === 'string'
127
+ ? layout.yaxis2.title
128
+ : typeof ((_a = layout.yaxis2.title) === null || _a === void 0 ? void 0 : _a.text) === 'string'
129
+ ? layout.yaxis2.title.text
130
+ : '';
131
+ if (layout.yaxis2.range) {
132
+ secondaryYAxisValues.secondaryYScaleOptions = {
133
+ yMinValue: layout.yaxis2.range[0],
134
+ yMaxValue: layout.yaxis2.range[1],
135
+ };
136
+ }
137
+ else {
138
+ var yValues = series.y;
139
+ if (yValues) {
140
+ secondaryYAxisValues.secondaryYScaleOptions = {
141
+ yMinValue: Math.min.apply(Math, yValues),
142
+ yMaxValue: Math.max.apply(Math, yValues),
143
+ };
144
+ }
145
+ }
146
+ }
147
+ secondaryYAxisValues.secondaryYAxistitle =
148
+ secondaryYAxisValues.secondaryYAxistitle !== '' ? secondaryYAxisValues.secondaryYAxistitle : undefined;
149
+ secondaryYAxisValues.secondaryYScaleOptions =
150
+ secondaryYAxisValues.secondaryYScaleOptions && Object.keys(secondaryYAxisValues.secondaryYScaleOptions).length !== 0
151
+ ? secondaryYAxisValues.secondaryYScaleOptions
152
+ : undefined;
153
+ return secondaryYAxisValues;
154
+ };
155
+ var transformPlotlyJsonToDonutProps = function (input, colorMap, isDarkTheme) {
156
+ var _a, _b, _c, _d, _e, _f, _g;
157
+ var firstData = input.data[0];
76
158
  var donutData = (_a = firstData.labels) === null || _a === void 0 ? void 0 : _a.map(function (label, index) {
77
159
  var _a;
78
160
  var color = (0, exports.getColor)(label, colorMap, isDarkTheme);
79
161
  return {
80
162
  legend: label,
81
- data: (_a = firstData.values) === null || _a === void 0 ? void 0 : _a[index],
163
+ data: (_a = firstData.values) === null || _a === void 0 ? void 0 : _a[index], //ToDo how to handle string data?
82
164
  color: color,
83
165
  };
84
166
  });
85
- var width = typeof (layout === null || layout === void 0 ? void 0 : layout.width) === 'number' ? layout === null || layout === void 0 ? void 0 : layout.width : 440;
86
- var height = typeof (layout === null || layout === void 0 ? void 0 : layout.height) === 'number' ? layout === null || layout === void 0 ? void 0 : layout.height : 220;
167
+ var width = (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : 440;
168
+ var height = (_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.height) !== null && _e !== void 0 ? _e : 220;
87
169
  var hideLabels = firstData.textinfo
88
170
  ? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)
89
171
  : false;
@@ -94,16 +176,16 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
94
176
  : 0;
95
177
  var styles = {
96
178
  root: {
97
- '[class^="arcLabel"]': tslib_1.__assign({}, (typeof ((_b = firstData.textfont) === null || _b === void 0 ? void 0 : _b.size) === 'number' ? { fontSize: firstData.textfont.size } : {})),
179
+ '[class^="arcLabel"]': tslib_1.__assign({}, (typeof ((_f = firstData.textfont) === null || _f === void 0 ? void 0 : _f.size) === 'number' ? { fontSize: firstData.textfont.size } : {})),
98
180
  },
99
181
  };
100
- var chartTitle = getTitles(layout).chartTitle;
182
+ var chartTitle = getTitles(input.layout).chartTitle;
101
183
  return {
102
184
  data: {
103
185
  chartTitle: chartTitle,
104
186
  chartData: donutData,
105
187
  },
106
- hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false ? true : false,
188
+ hideLegend: ((_g = input.layout) === null || _g === void 0 ? void 0 : _g.showlegend) === false ? true : false,
107
189
  width: width,
108
190
  height: height,
109
191
  innerRadius: innerRadius,
@@ -113,38 +195,44 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
113
195
  };
114
196
  };
115
197
  exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
116
- var transformPlotlyJsonToVSBCProps = function (jsonObj, colorMap, isDarkTheme) {
117
- var data = jsonObj.data, layout = jsonObj.layout;
198
+ var transformPlotlyJsonToVSBCProps = function (input, colorMap, isDarkTheme, fallbackVSBC) {
118
199
  var mapXToDataPoints = {};
119
200
  var yMaxValue = 0;
120
- data.forEach(function (series, index1) {
201
+ var secondaryYAxisValues = {};
202
+ input.data.forEach(function (series, index1) {
121
203
  var _a;
204
+ invalidate2Dseries(series, 'VSBC');
205
+ if (!(0, exports.isNumberArray)(series.y)) {
206
+ throw new Error('transform to VSBC:: y values should be numeric');
207
+ }
122
208
  (_a = series.x) === null || _a === void 0 ? void 0 : _a.forEach(function (x, index2) {
123
- var _a, _b, _c;
209
+ var _a, _b;
124
210
  if (!mapXToDataPoints[x]) {
125
211
  mapXToDataPoints[x] = { xAxisPoint: x, chartData: [], lineData: [] };
126
212
  }
127
- var legend = series.name || "Series ".concat(index1 + 1);
128
- if (series.type === 'bar' || series.type === 'scatter') {
213
+ var legend = getLegend(series, index1);
214
+ var yVal = (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2]) !== null && _b !== void 0 ? _b : 0;
215
+ if (series.type === 'bar') {
129
216
  var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
130
217
  mapXToDataPoints[x].chartData.push({
131
218
  legend: legend,
132
- data: (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2],
219
+ data: yVal,
133
220
  color: color,
134
221
  });
135
222
  }
136
- else if (series.type === 'line') {
223
+ else if (series.type === 'scatter' || (0, exports.isLineData)(series) || !!fallbackVSBC) {
137
224
  var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
138
225
  mapXToDataPoints[x].lineData.push({
139
226
  legend: legend,
140
- y: (_b = series.y) === null || _b === void 0 ? void 0 : _b[index2],
227
+ y: yVal,
141
228
  color: color,
142
229
  });
143
230
  }
144
- yMaxValue = Math.max(yMaxValue, (_c = series.y) === null || _c === void 0 ? void 0 : _c[index2]);
231
+ yMaxValue = Math.max(yMaxValue, yVal);
145
232
  });
233
+ secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);
146
234
  });
147
- var _a = getTitles(layout), chartTitle = _a.chartTitle, xAxisTitle = _a.xAxisTitle, yAxisTitle = _a.yAxisTitle;
235
+ var _a = getTitles(input.layout), chartTitle = _a.chartTitle, xAxisTitle = _a.xAxisTitle, yAxisTitle = _a.yAxisTitle;
148
236
  return {
149
237
  data: Object.values(mapXToDataPoints),
150
238
  // width: layout?.width,
@@ -155,33 +243,40 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
155
243
  xAxisTitle: xAxisTitle,
156
244
  yAxisTitle: yAxisTitle,
157
245
  mode: 'plotly',
246
+ secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,
247
+ secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,
158
248
  };
159
249
  };
160
250
  exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
161
- var transformPlotlyJsonToGVBCProps = function (jsonObj, colorMap, isDarkTheme) {
162
- var data = jsonObj.data, layout = jsonObj.layout;
251
+ var transformPlotlyJsonToGVBCProps = function (input, colorMap, isDarkTheme) {
163
252
  var mapXToDataPoints = {};
164
- data.forEach(function (series, index1) {
253
+ var secondaryYAxisValues = {};
254
+ input.data.forEach(function (series, index1) {
165
255
  var _a;
256
+ invalidate2Dseries(series, 'GVBC');
257
+ if (!(0, exports.isNumberArray)(series.y)) {
258
+ throw new Error('transform to GVBC:: y values should be numeric');
259
+ }
166
260
  (_a = series.x) === null || _a === void 0 ? void 0 : _a.forEach(function (x, index2) {
167
- var _a;
261
+ var _a, _b;
168
262
  if (!mapXToDataPoints[x]) {
169
263
  mapXToDataPoints[x] = { name: x.toString(), series: [] };
170
264
  }
171
265
  if (series.type === 'bar') {
172
- var legend = series.name || "Series ".concat(index1 + 1);
266
+ var legend = getLegend(series, index1);
173
267
  var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
174
268
  mapXToDataPoints[x].series.push({
175
269
  key: legend,
176
- data: (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2],
270
+ data: (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2]) !== null && _b !== void 0 ? _b : 0,
177
271
  xAxisCalloutData: x,
178
272
  color: color,
179
273
  legend: legend,
180
274
  });
181
275
  }
182
276
  });
277
+ secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);
183
278
  });
184
- var _a = getTitles(layout), chartTitle = _a.chartTitle, xAxisTitle = _a.xAxisTitle, yAxisTitle = _a.yAxisTitle;
279
+ var _a = getTitles(input.layout), chartTitle = _a.chartTitle, xAxisTitle = _a.xAxisTitle, yAxisTitle = _a.yAxisTitle;
185
280
  return {
186
281
  data: Object.values(mapXToDataPoints),
187
282
  // width: layout?.width,
@@ -191,14 +286,16 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
191
286
  xAxisTitle: xAxisTitle,
192
287
  yAxisTitle: yAxisTitle,
193
288
  mode: 'plotly',
289
+ secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,
290
+ secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,
194
291
  };
195
292
  };
196
293
  exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
197
- var transformPlotlyJsonToVBCProps = function (jsonObj, colorMap, isDarkTheme) {
198
- var data = jsonObj.data, layout = jsonObj.layout;
294
+ var transformPlotlyJsonToVBCProps = function (input, colorMap, isDarkTheme) {
199
295
  var vbcData = [];
200
- data.forEach(function (series, index) {
296
+ input.data.forEach(function (series, index) {
201
297
  var _a, _b, _c;
298
+ invalidate2Dseries(series, 'VBC');
202
299
  if (!series.x) {
203
300
  return;
204
301
  }
@@ -226,7 +323,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
226
323
  // If the start or end of xbins is specified, then the number of datapoints may become less than x.length
227
324
  var totalDataPoints = (0, d3_array_1.merge)(buckets).length;
228
325
  buckets.forEach(function (bucket) {
229
- var legend = series.name || "Series ".concat(index + 1);
326
+ var legend = getLegend(series, index);
230
327
  var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
231
328
  var y = bucket.length;
232
329
  if (series.histnorm === 'percent') {
@@ -262,12 +359,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
262
359
  });
263
360
  });
264
361
  });
265
- var _a = getTitles(layout), chartTitle = _a.chartTitle, xAxisTitle = _a.xAxisTitle, yAxisTitle = _a.yAxisTitle;
362
+ var _a = getTitles(input.layout), chartTitle = _a.chartTitle, xAxisTitle = _a.xAxisTitle, yAxisTitle = _a.yAxisTitle;
266
363
  return {
267
364
  data: vbcData,
268
365
  // width: layout?.width,
269
366
  // height: layout?.height,
270
- barWidth: 24,
271
367
  supportNegativeData: true,
272
368
  chartTitle: chartTitle,
273
369
  xAxisTitle: xAxisTitle,
@@ -276,16 +372,18 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
276
372
  };
277
373
  };
278
374
  exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
279
- var transformPlotlyJsonToScatterChartProps = function (jsonObj, isAreaChart, colorMap, isDarkTheme) {
280
- var data = jsonObj.data, layout = jsonObj.layout;
375
+ var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, colorMap, isDarkTheme) {
376
+ var secondaryYAxisValues = {};
281
377
  var mode = 'tonexty';
282
- var chartData = data.map(function (series, index) {
378
+ var chartData = input.data.map(function (series, index) {
379
+ invalidate2Dseries(series, 'Scatter');
283
380
  var xValues = series.x;
284
381
  var isString = typeof xValues[0] === 'string';
285
382
  var isXDate = (0, exports.isDateArray)(xValues);
286
383
  var isXNumber = (0, exports.isNumberArray)(xValues);
287
- var legend = series.name || "Series ".concat(index + 1);
384
+ var legend = getLegend(series, index);
288
385
  var lineColor = (0, exports.getColor)(legend, colorMap, isDarkTheme);
386
+ secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);
289
387
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
290
388
  return {
291
389
  legend: legend,
@@ -296,7 +394,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
296
394
  color: lineColor,
297
395
  };
298
396
  });
299
- var _a = getTitles(layout), chartTitle = _a.chartTitle, xAxisTitle = _a.xAxisTitle, yAxisTitle = _a.yAxisTitle;
397
+ var _a = getTitles(input.layout), chartTitle = _a.chartTitle, xAxisTitle = _a.xAxisTitle, yAxisTitle = _a.yAxisTitle;
300
398
  var chartProps = {
301
399
  chartTitle: chartTitle,
302
400
  lineChartData: chartData,
@@ -307,6 +405,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
307
405
  supportNegativeData: true,
308
406
  xAxisTitle: xAxisTitle,
309
407
  yAxisTitle: yAxisTitle,
408
+ secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,
409
+ secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,
310
410
  mode: mode,
311
411
  };
312
412
  }
@@ -316,15 +416,17 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
316
416
  supportNegativeData: true,
317
417
  xAxisTitle: xAxisTitle,
318
418
  yAxisTitle: yAxisTitle,
419
+ secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,
420
+ secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,
319
421
  };
320
422
  }
321
423
  };
322
424
  exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
323
- var transformPlotlyJsonToHorizontalBarWithAxisProps = function (jsonObj, colorMap, isDarkTheme) {
324
- var _a, _b, _c, _d, _e, _f, _g, _h;
325
- var data = jsonObj.data, layout = jsonObj.layout;
326
- var chartData = data
425
+ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, isDarkTheme) {
426
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
427
+ var chartData = input.data
327
428
  .map(function (series, index) {
429
+ invalidate2Dseries(series, 'HBC');
328
430
  return series.y.map(function (yValue, i) {
329
431
  var color = (0, exports.getColor)(yValue, colorMap, isDarkTheme);
330
432
  return {
@@ -338,47 +440,48 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
338
440
  .flat()
339
441
  //reversing the order to invert the Y bars order as required by plotly.
340
442
  .reverse();
341
- var chartHeight = typeof layout.height === 'number' ? layout.height : 450;
342
- var margin = typeof ((_a = layout.margin) === null || _a === void 0 ? void 0 : _a.l) === 'number' ? (_b = layout.margin) === null || _b === void 0 ? void 0 : _b.l : 0;
343
- var padding = typeof ((_c = layout.margin) === null || _c === void 0 ? void 0 : _c.pad) === 'number' ? (_d = layout.margin) === null || _d === void 0 ? void 0 : _d.pad : 0;
443
+ var chartHeight = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 450;
444
+ var margin = (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.margin) === null || _d === void 0 ? void 0 : _d.l) !== null && _e !== void 0 ? _e : 0;
445
+ var padding = (_h = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.margin) === null || _g === void 0 ? void 0 : _g.pad) !== null && _h !== void 0 ? _h : 0;
344
446
  var availableHeight = chartHeight - margin - padding;
345
- var numberOfBars = data[0].y.length;
447
+ var numberOfBars = input.data[0].y.length;
346
448
  var scalingFactor = 0.01;
347
449
  var gapFactor = 1 / (1 + scalingFactor * numberOfBars);
348
450
  var barHeight = availableHeight / (numberOfBars * (1 + gapFactor));
349
- var _j = getTitles(layout), chartTitle = _j.chartTitle, xAxisTitle = _j.xAxisTitle, yAxisTitle = _j.yAxisTitle;
451
+ var _t = getTitles(input.layout), chartTitle = _t.chartTitle, xAxisTitle = _t.xAxisTitle, yAxisTitle = _t.yAxisTitle;
350
452
  return {
351
453
  data: chartData,
352
454
  chartTitle: chartTitle,
353
455
  xAxisTitle: xAxisTitle,
354
456
  yAxisTitle: yAxisTitle,
355
- secondaryYAxistitle: typeof ((_e = layout === null || layout === void 0 ? void 0 : layout.yaxis2) === null || _e === void 0 ? void 0 : _e.title) === 'string' ? (_f = layout === null || layout === void 0 ? void 0 : layout.yaxis2) === null || _f === void 0 ? void 0 : _f.title : ((_h = (_g = layout === null || layout === void 0 ? void 0 : layout.yaxis2) === null || _g === void 0 ? void 0 : _g.title) === null || _h === void 0 ? void 0 : _h.text) || '',
457
+ secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
458
+ ? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
459
+ : ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '',
356
460
  barHeight: barHeight,
357
461
  showYAxisLables: true,
358
462
  styles: {
359
463
  root: {
360
464
  height: chartHeight,
361
- width: typeof layout.width === 'number' ? layout.width : 600,
465
+ width: (_s = (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width) !== null && _s !== void 0 ? _s : 600,
362
466
  },
363
467
  },
364
468
  };
365
469
  };
366
470
  exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
367
- var transformPlotlyJsonToHeatmapProps = function (jsonObj) {
471
+ var transformPlotlyJsonToHeatmapProps = function (input) {
368
472
  var _a;
369
- var data = jsonObj.data, layout = jsonObj.layout;
370
- var firstData = data[0];
473
+ var firstData = input.data[0];
371
474
  var heatmapDataPoints = [];
372
475
  var zMin = Number.POSITIVE_INFINITY;
373
476
  var zMax = Number.NEGATIVE_INFINITY;
374
477
  (_a = firstData.x) === null || _a === void 0 ? void 0 : _a.forEach(function (xVal, xIdx) {
375
478
  var _a;
376
479
  (_a = firstData.y) === null || _a === void 0 ? void 0 : _a.forEach(function (yVal, yIdx) {
377
- var _a, _b, _c, _d;
480
+ var _a, _b, _c, _d, _e, _f;
378
481
  var zVal = (_b = (_a = firstData.z) === null || _a === void 0 ? void 0 : _a[yIdx]) === null || _b === void 0 ? void 0 : _b[xIdx];
379
482
  heatmapDataPoints.push({
380
- x: ((_c = layout.xaxis) === null || _c === void 0 ? void 0 : _c.type) === 'date' ? new Date(xVal) : xVal,
381
- y: ((_d = layout.yaxis) === null || _d === void 0 ? void 0 : _d.type) === 'date' ? new Date(yVal) : yVal,
483
+ x: ((_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.xaxis) === null || _d === void 0 ? void 0 : _d.type) === 'date' ? xVal : xVal !== null && xVal !== void 0 ? xVal : 0,
484
+ y: ((_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.yaxis) === null || _f === void 0 ? void 0 : _f.type) === 'date' ? yVal : yVal,
382
485
  value: zVal,
383
486
  rectText: zVal,
384
487
  });
@@ -387,16 +490,24 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
387
490
  });
388
491
  });
389
492
  var heatmapData = {
390
- legend: typeof firstData.name === 'string' ? firstData.name : '',
493
+ legend: firstData.name,
391
494
  data: heatmapDataPoints,
392
495
  value: 0,
393
496
  };
394
- // Convert normalized values to actual values
395
- var domainValuesForColorScale = firstData.colorscale
497
+ // Initialize domain and range to default values
498
+ var defaultDomain = [zMin, zMax];
499
+ var defaultRange = [
500
+ (0, colors_1.getColorFromToken)(colors_1.DataVizPalette.color1),
501
+ (0, colors_1.getColorFromToken)(colors_1.DataVizPalette.color2),
502
+ (0, colors_1.getColorFromToken)(colors_1.DataVizPalette.color3),
503
+ ];
504
+ var domainValuesForColorScale = Array.isArray(firstData.colorscale)
396
505
  ? firstData.colorscale.map(function (arr) { return arr[0] * (zMax - zMin) + zMin; })
397
- : [];
398
- var rangeValuesForColorScale = firstData.colorscale ? firstData.colorscale.map(function (arr) { return arr[1]; }) : [];
399
- var _b = getTitles(layout), chartTitle = _b.chartTitle, xAxisTitle = _b.xAxisTitle, yAxisTitle = _b.yAxisTitle;
506
+ : defaultDomain;
507
+ var rangeValuesForColorScale = Array.isArray(firstData.colorscale)
508
+ ? firstData.colorscale.map(function (arr) { return arr[1]; })
509
+ : defaultRange;
510
+ var _b = getTitles(input.layout), chartTitle = _b.chartTitle, xAxisTitle = _b.xAxisTitle, yAxisTitle = _b.yAxisTitle;
400
511
  return {
401
512
  data: [heatmapData],
402
513
  domainValuesForColorScale: domainValuesForColorScale,
@@ -410,22 +521,20 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
410
521
  };
411
522
  };
412
523
  exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
413
- var transformPlotlyJsonToSankeyProps = function (jsonObj, colorMap, isDarkTheme) {
414
- var _a, _b;
415
- var data = jsonObj.data, layout = jsonObj.layout;
416
- var _c = data[0], link = _c.link, node = _c.node;
417
- var validLinks = link.value
524
+ var transformPlotlyJsonToSankeyProps = function (input, colorMap, isDarkTheme) {
525
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
526
+ var _k = input.data[0], link = _k.link, node = _k.node;
527
+ var validLinks = ((_a = link === null || link === void 0 ? void 0 : link.value) !== null && _a !== void 0 ? _a : [])
418
528
  .map(function (val, index) { return ({
419
529
  value: val,
420
- source: link.source[index],
421
- target: link.target[index],
530
+ source: link === null || link === void 0 ? void 0 : link.source[index],
531
+ target: link === null || link === void 0 ? void 0 : link.target[index],
422
532
  }); })
423
533
  // eslint-disable-next-line @typescript-eslint/no-shadow
424
- //@ts-expect-error Dynamic link object. Ignore for now.
425
534
  // Filter out negative nodes, unequal nodes and self-references (circular links)
426
535
  .filter(function (x) { return x.source >= 0 && x.target >= 0 && x.source !== x.target; });
427
536
  var sankeyChartData = {
428
- nodes: node.label.map(function (label, index) {
537
+ nodes: (_b = node.label) === null || _b === void 0 ? void 0 : _b.map(function (label, index) {
429
538
  var color = (0, exports.getColor)(label, colorMap, isDarkTheme);
430
539
  return {
431
540
  nodeId: index,
@@ -437,13 +546,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
437
546
  return tslib_1.__assign({}, validLink);
438
547
  }),
439
548
  };
440
- var width = typeof (layout === null || layout === void 0 ? void 0 : layout.width) === 'number' ? layout === null || layout === void 0 ? void 0 : layout.width : 440;
441
- var height = typeof (layout === null || layout === void 0 ? void 0 : layout.height) === 'number' ? layout === null || layout === void 0 ? void 0 : layout.height : 220;
549
+ var width = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 440;
550
+ var height = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : 220;
442
551
  var styles = {
443
- root: tslib_1.__assign({}, (typeof ((_a = layout.font) === null || _a === void 0 ? void 0 : _a.size) === 'number' ? { fontSize: (_b = layout.font) === null || _b === void 0 ? void 0 : _b.size } : {})),
552
+ root: tslib_1.__assign({}, (((_h = (_g = input.layout) === null || _g === void 0 ? void 0 : _g.font) === null || _h === void 0 ? void 0 : _h.size) ? { fontSize: (_j = input.layout.font) === null || _j === void 0 ? void 0 : _j.size } : {})),
444
553
  };
445
554
  var shouldResize = width + height;
446
- var chartTitle = getTitles(layout).chartTitle;
555
+ var chartTitle = getTitles(input.layout).chartTitle;
447
556
  return {
448
557
  data: {
449
558
  chartTitle: chartTitle,
@@ -457,10 +566,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
457
566
  };
458
567
  };
459
568
  exports.transformPlotlyJsonToSankeyProps = transformPlotlyJsonToSankeyProps;
460
- var transformPlotlyJsonToGaugeProps = function (jsonObj, colorMap, isDarkTheme) {
461
- 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;
462
- var data = jsonObj.data, layout = jsonObj.layout;
463
- var firstData = data[0];
569
+ var transformPlotlyJsonToGaugeProps = function (input, colorMap, isDarkTheme) {
570
+ 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;
571
+ var firstData = input.data[0];
464
572
  var segments = ((_b = (_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) === null || _b === void 0 ? void 0 : _b.length)
465
573
  ? firstData.gauge.steps.map(function (step, index) {
466
574
  var _a, _b;
@@ -475,18 +583,18 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
475
583
  : [
476
584
  {
477
585
  legend: 'Current',
478
- size: (_c = firstData.value) !== null && _c !== void 0 ? _c : 0 - ((_f = (_e = (_d = firstData.gauge) === null || _d === void 0 ? void 0 : _d.range) === null || _e === void 0 ? void 0 : _e[0]) !== null && _f !== void 0 ? _f : 0),
586
+ 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),
479
587
  color: (0, exports.getColor)('Current', colorMap, isDarkTheme),
480
588
  },
481
589
  {
482
590
  legend: 'Target',
483
- size: ((_j = (_h = (_g = firstData.gauge) === null || _g === void 0 ? void 0 : _g.range) === null || _h === void 0 ? void 0 : _h[1]) !== null && _j !== void 0 ? _j : 100) - ((_k = firstData.value) !== null && _k !== void 0 ? _k : 0),
591
+ 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),
484
592
  color: colors_1.DataVizPalette.disabled,
485
593
  },
486
594
  ];
487
595
  var sublabel;
488
596
  var sublabelColor;
489
- if (typeof ((_l = firstData.delta) === null || _l === void 0 ? void 0 : _l.reference) === 'number') {
597
+ if ((_o = firstData.delta) === null || _o === void 0 ? void 0 : _o.reference) {
490
598
  var diff = firstData.value - firstData.delta.reference;
491
599
  if (diff >= 0) {
492
600
  sublabel = "\u25B2 ".concat(diff);
@@ -504,20 +612,20 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
504
612
  fill: sublabelColor,
505
613
  },
506
614
  };
507
- var chartTitle = getTitles(layout).chartTitle;
615
+ var chartTitle = getTitles(input.layout).chartTitle;
508
616
  return {
509
617
  segments: segments,
510
- chartValue: typeof firstData.value === 'number' ? firstData.value : 0,
618
+ chartValue: (_p = firstData.value) !== null && _p !== void 0 ? _p : 0,
511
619
  chartTitle: chartTitle,
512
620
  sublabel: sublabel,
513
621
  // range values can be null
514
- minValue: typeof ((_p = (_o = (_m = firstData.gauge) === null || _m === void 0 ? void 0 : _m.axis) === null || _o === void 0 ? void 0 : _o.range) === null || _p === void 0 ? void 0 : _p[0]) === 'number' ? (_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] : undefined,
515
- maxValue: typeof ((_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[1]) === 'number' ? (_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] : undefined,
516
- chartValueFormat: function () { return firstData.value; },
517
- width: typeof (layout === null || layout === void 0 ? void 0 : layout.width) === 'number' ? layout === null || layout === void 0 ? void 0 : layout.width : 440,
518
- height: typeof (layout === null || layout === void 0 ? void 0 : layout.height) === 'number' ? layout === null || layout === void 0 ? void 0 : layout.height : 220,
622
+ 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,
623
+ 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,
624
+ chartValueFormat: function () { var _a, _b; return (_b = (_a = firstData.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; },
625
+ width: (_3 = (_2 = input.layout) === null || _2 === void 0 ? void 0 : _2.width) !== null && _3 !== void 0 ? _3 : 440,
626
+ height: (_5 = (_4 = input.layout) === null || _4 === void 0 ? void 0 : _4.height) !== null && _5 !== void 0 ? _5 : 220,
519
627
  styles: styles,
520
- variant: ((_0 = (_z = firstData.gauge) === null || _z === void 0 ? void 0 : _z.steps) === null || _0 === void 0 ? void 0 : _0.length) ? index_1.GaugeChartVariant.MultipleSegments : index_1.GaugeChartVariant.SingleSegment,
628
+ variant: ((_7 = (_6 = firstData.gauge) === null || _6 === void 0 ? void 0 : _6.steps) === null || _7 === void 0 ? void 0 : _7.length) ? index_1.GaugeChartVariant.MultipleSegments : index_1.GaugeChartVariant.SingleSegment,
521
629
  };
522
630
  };
523
631
  exports.transformPlotlyJsonToGaugeProps = transformPlotlyJsonToGaugeProps;