@fluentui/react-charting 5.23.88 → 5.23.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +67 -1
- package/CHANGELOG.md +26 -2
- package/dist/react-charting.d.ts +72 -6
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +37 -1
- package/lib/ChartTable.d.ts +1 -0
- package/lib/ChartTable.js +2 -0
- package/lib/ChartTable.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.base.d.ts +10 -0
- package/lib/components/ChartTable/ChartTable.base.js +44 -0
- package/lib/components/ChartTable/ChartTable.base.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.d.ts +7 -0
- package/lib/components/ChartTable/ChartTable.js +9 -0
- package/lib/components/ChartTable/ChartTable.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.styles.d.ts +2 -0
- package/lib/components/ChartTable/ChartTable.styles.js +28 -0
- package/lib/components/ChartTable/ChartTable.styles.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.types.d.ts +58 -0
- package/lib/components/ChartTable/ChartTable.types.js +2 -0
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib/components/ChartTable/index.d.ts +2 -0
- package/lib/components/ChartTable/index.js +3 -0
- package/lib/components/ChartTable/index.js.map +1 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.d.ts +7 -6
- package/lib/components/DeclarativeChart/DeclarativeChart.js +15 -12
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +7 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +103 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -13
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +141 -120
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.js +19 -9
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utilities/image-export-utils.js +25 -3
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib-amd/ChartTable.d.ts +1 -0
- package/lib-amd/ChartTable.js +6 -0
- package/lib-amd/ChartTable.js.map +1 -0
- package/lib-amd/components/ChartTable/ChartTable.base.d.ts +10 -0
- package/lib-amd/components/ChartTable/ChartTable.base.js +45 -0
- package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -0
- package/lib-amd/components/ChartTable/ChartTable.d.ts +7 -0
- package/lib-amd/components/ChartTable/ChartTable.js +11 -0
- package/lib-amd/components/ChartTable/ChartTable.js.map +1 -0
- package/lib-amd/components/ChartTable/ChartTable.styles.d.ts +2 -0
- package/lib-amd/components/ChartTable/ChartTable.styles.js +32 -0
- package/lib-amd/components/ChartTable/ChartTable.styles.js.map +1 -0
- package/lib-amd/components/ChartTable/ChartTable.types.d.ts +58 -0
- package/lib-amd/components/ChartTable/ChartTable.types.js +5 -0
- package/lib-amd/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib-amd/components/ChartTable/index.d.ts +2 -0
- package/lib-amd/components/ChartTable/index.js +7 -0
- package/lib-amd/components/ChartTable/index.js.map +1 -0
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.d.ts +7 -6
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +14 -12
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +7 -0
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +108 -0
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -13
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +143 -124
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.js +19 -9
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/index.d.ts +2 -0
- package/lib-amd/index.js +3 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/utilities/image-export-utils.js +25 -3
- package/lib-amd/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/ChartTable.d.ts +1 -0
- package/lib-commonjs/ChartTable.js +5 -0
- package/lib-commonjs/ChartTable.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.base.d.ts +10 -0
- package/lib-commonjs/components/ChartTable/ChartTable.base.js +47 -0
- package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.d.ts +7 -0
- package/lib-commonjs/components/ChartTable/ChartTable.js +12 -0
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.styles.d.ts +2 -0
- package/lib-commonjs/components/ChartTable/ChartTable.styles.js +32 -0
- package/lib-commonjs/components/ChartTable/ChartTable.styles.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.d.ts +58 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js +3 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib-commonjs/components/ChartTable/index.d.ts +2 -0
- package/lib-commonjs/components/ChartTable/index.js +6 -0
- package/lib-commonjs/components/ChartTable/index.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.d.ts +7 -6
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +14 -11
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +7 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +110 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -13
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +143 -124
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js +19 -9
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/index.d.ts +2 -0
- package/lib-commonjs/index.js +3 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js +25 -3
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/package.json +4 -4
- package/src/components/ChartTable/ChartTable.types.ts +68 -0
|
@@ -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", "
|
|
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.
|
|
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,59 +130,21 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
137
130
|
},
|
|
138
131
|
};
|
|
139
132
|
};
|
|
140
|
-
var
|
|
141
|
-
var
|
|
142
|
-
|
|
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;
|
|
163
|
-
};
|
|
164
|
-
exports.getSchemaColors = getSchemaColors;
|
|
165
|
-
var _extractColor = function (useFluentVizColorPalette, colors, colorMap, isDarkTheme) {
|
|
166
|
-
return !useFluentVizColorPalette && colors ? (0, exports.getSchemaColors)(colors, colorMap, isDarkTheme) : undefined;
|
|
167
|
-
};
|
|
168
|
-
exports._extractColor = _extractColor;
|
|
169
|
-
var _resolveColor = function (extractedColors, index, legend, colorMap, isDarkTheme) {
|
|
170
|
-
var color = '';
|
|
171
|
-
if (extractedColors && (0, chart_utilities_1.isArrayOrTypedArray)(extractedColors) && extractedColors[index]) {
|
|
172
|
-
color = extractedColors[index % extractedColors.length];
|
|
173
|
-
}
|
|
174
|
-
else if (typeof extractedColors === 'string') {
|
|
175
|
-
color = extractedColors;
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
|
|
179
|
-
}
|
|
180
|
-
return color;
|
|
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);
|
|
181
136
|
};
|
|
182
|
-
exports.
|
|
183
|
-
var transformPlotlyJsonToDonutProps = function (input, colorMap,
|
|
184
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
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;
|
|
185
140
|
var firstData = input.data[0];
|
|
186
141
|
// extract colors for each series only once
|
|
187
|
-
var colors = (0,
|
|
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);
|
|
188
143
|
var mapLegendToDataPoint = {};
|
|
189
|
-
(
|
|
144
|
+
(_e = firstData.labels) === null || _e === void 0 ? void 0 : _e.forEach(function (label, index) {
|
|
190
145
|
var _a;
|
|
191
146
|
// resolve color for each legend from the extracted colors
|
|
192
|
-
var color = (0,
|
|
147
|
+
var color = (0, PlotlyColorAdapter_1.resolveColor)(colors, index, label, colorMap, isDarkTheme);
|
|
193
148
|
//ToDo how to handle string data?
|
|
194
149
|
var value = typeof ((_a = firstData.values) === null || _a === void 0 ? void 0 : _a[index]) === 'number' ? firstData.values[index] : 1;
|
|
195
150
|
if (!mapLegendToDataPoint[label]) {
|
|
@@ -203,8 +158,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
203
158
|
mapLegendToDataPoint[label].data += value;
|
|
204
159
|
}
|
|
205
160
|
});
|
|
206
|
-
var width = (
|
|
207
|
-
var height = (
|
|
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;
|
|
208
163
|
var hideLabels = firstData.textinfo
|
|
209
164
|
? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)
|
|
210
165
|
: false;
|
|
@@ -219,36 +174,37 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
219
174
|
chartTitle: chartTitle,
|
|
220
175
|
chartData: Object.values(mapLegendToDataPoint),
|
|
221
176
|
},
|
|
222
|
-
hideLegend: ((
|
|
223
|
-
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,
|
|
224
179
|
height: height,
|
|
225
180
|
innerRadius: innerRadius,
|
|
226
181
|
hideLabels: hideLabels,
|
|
227
182
|
showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
|
|
183
|
+
roundCorners: true,
|
|
228
184
|
};
|
|
229
185
|
};
|
|
230
186
|
exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
|
|
231
|
-
var transformPlotlyJsonToVSBCProps = function (input, colorMap,
|
|
187
|
+
var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
|
|
232
188
|
var _a, _b, _c;
|
|
233
189
|
var mapXToDataPoints = {};
|
|
234
190
|
var yMaxValue = 0;
|
|
235
191
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
236
192
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
237
193
|
input.data.forEach(function (series, index1) {
|
|
238
|
-
var _a, _b, _c;
|
|
194
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
239
195
|
var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
|
|
240
196
|
// extract bar colors for each series only once
|
|
241
|
-
var extractedBarColors = (0,
|
|
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);
|
|
242
198
|
// extract line colors for each series only once
|
|
243
|
-
var extractedLineColors = (0,
|
|
244
|
-
(
|
|
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) {
|
|
245
201
|
var _a, _b, _c;
|
|
246
202
|
if (!mapXToDataPoints[x]) {
|
|
247
203
|
mapXToDataPoints[x] = { xAxisPoint: isXYearCategory ? x.toString() : x, chartData: [], lineData: [] };
|
|
248
204
|
}
|
|
249
205
|
var legend = legends[index1];
|
|
250
206
|
// resolve color for each legend's bars from the extracted colors
|
|
251
|
-
var color = (0,
|
|
207
|
+
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index1, legend, colorMap, isDarkTheme);
|
|
252
208
|
var yVal = (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2]) !== null && _b !== void 0 ? _b : 0;
|
|
253
209
|
if (series.type === 'bar') {
|
|
254
210
|
mapXToDataPoints[x].chartData.push({
|
|
@@ -259,7 +215,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
259
215
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
260
216
|
}
|
|
261
217
|
else if (series.type === 'scatter' || !!fallbackVSBC) {
|
|
262
|
-
var lineColor = (0,
|
|
218
|
+
var lineColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
|
|
263
219
|
var lineOptions = getLineOptions(series.line);
|
|
264
220
|
var dashType = ((_c = series.line) === null || _c === void 0 ? void 0 : _c.dash) || 'solid';
|
|
265
221
|
var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
|
|
@@ -271,19 +227,19 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
271
227
|
});
|
|
272
228
|
});
|
|
273
229
|
var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
|
|
274
|
-
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 });
|
|
275
231
|
};
|
|
276
232
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
277
|
-
var transformPlotlyJsonToGVBCProps = function (input, colorMap,
|
|
233
|
+
var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
|
|
278
234
|
var _a, _b, _c;
|
|
279
235
|
var mapXToDataPoints = {};
|
|
280
236
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
|
|
281
237
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
282
238
|
input.data.forEach(function (series, index1) {
|
|
283
|
-
var _a, _b;
|
|
239
|
+
var _a, _b, _c, _d, _e;
|
|
284
240
|
// extract colors for each series only once
|
|
285
|
-
var extractedColors = (0,
|
|
286
|
-
(
|
|
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) {
|
|
287
243
|
var _a, _b;
|
|
288
244
|
if (!mapXToDataPoints[x]) {
|
|
289
245
|
mapXToDataPoints[x] = { name: x.toString(), series: [] };
|
|
@@ -291,7 +247,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
291
247
|
if (series.type === 'bar') {
|
|
292
248
|
var legend = legends[index1];
|
|
293
249
|
// resolve color for each legend's bars from the extracted colors
|
|
294
|
-
var color = (0,
|
|
250
|
+
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
|
|
295
251
|
mapXToDataPoints[x].series.push({
|
|
296
252
|
key: legend,
|
|
297
253
|
data: (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex]) !== null && _b !== void 0 ? _b : 0,
|
|
@@ -304,24 +260,24 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
304
260
|
});
|
|
305
261
|
});
|
|
306
262
|
var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
|
|
307
|
-
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 });
|
|
308
264
|
};
|
|
309
265
|
exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
|
|
310
|
-
var transformPlotlyJsonToVBCProps = function (input, colorMap,
|
|
266
|
+
var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
|
|
311
267
|
var _a, _b, _c;
|
|
312
268
|
var vbcData = [];
|
|
313
269
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
314
270
|
input.data.forEach(function (series, seriesIdx) {
|
|
315
|
-
var _a, _b, _c, _d;
|
|
271
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
316
272
|
if (!series.x) {
|
|
317
273
|
return;
|
|
318
274
|
}
|
|
319
275
|
// extract colors for each series only once
|
|
320
|
-
var extractedColors = (0,
|
|
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);
|
|
321
277
|
var isXString = isStringArray(series.x);
|
|
322
278
|
// TODO: In case of a single bin, add an empty bin of the same size to prevent the
|
|
323
279
|
// default bar width from being used and ensure the bar spans the full intended range.
|
|
324
|
-
var xBins = createBins(series.x, (
|
|
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);
|
|
325
281
|
var yBins = xBins.map(function () { return []; });
|
|
326
282
|
var total = 0;
|
|
327
283
|
series.x.forEach(function (xVal, index) {
|
|
@@ -339,7 +295,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
339
295
|
xBins.forEach(function (bin, index) {
|
|
340
296
|
var legend = legends[seriesIdx];
|
|
341
297
|
// resolve color for each legend's bars from the extracted colors
|
|
342
|
-
var color = (0,
|
|
298
|
+
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, seriesIdx, legend, colorMap, isDarkTheme);
|
|
343
299
|
var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
344
300
|
vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
|
|
345
301
|
? {}
|
|
@@ -359,28 +315,29 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
359
315
|
hideTickOverlap: true,
|
|
360
316
|
maxBarWidth: 50,
|
|
361
317
|
hideLegend: hideLegend,
|
|
318
|
+
roundCorners: true,
|
|
362
319
|
};
|
|
363
320
|
};
|
|
364
321
|
exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
|
|
365
|
-
var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, colorMap,
|
|
322
|
+
var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, isScatterMarkers, colorMap, colorwayType, isDarkTheme) {
|
|
366
323
|
var _a, _b, _c, _d, _e, _f;
|
|
367
324
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
|
|
368
325
|
var mode = 'tonexty';
|
|
369
326
|
var _g = getLegendProps(input.data, input.layout), legends = _g.legends, hideLegend = _g.hideLegend;
|
|
370
327
|
var chartData = input.data.map(function (series, index) {
|
|
371
|
-
var _a, _b;
|
|
328
|
+
var _a, _b, _c, _d, _e, _f;
|
|
372
329
|
// extract colors for each series only once
|
|
373
|
-
var extractedColors = (0,
|
|
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);
|
|
374
331
|
var xValues = series.x;
|
|
375
332
|
var isString = typeof xValues[0] === 'string';
|
|
376
333
|
var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
|
|
377
334
|
var isXNumber = (0, chart_utilities_1.isNumberArray)(xValues);
|
|
378
335
|
var legend = legends[index];
|
|
379
336
|
// resolve color for each legend's lines from the extracted colors
|
|
380
|
-
var
|
|
337
|
+
var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
381
338
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
382
339
|
var lineOptions = getLineOptions(series.line);
|
|
383
|
-
var dashType = ((
|
|
340
|
+
var dashType = ((_f = series.line) === null || _f === void 0 ? void 0 : _f.dash) || 'solid';
|
|
384
341
|
var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
|
|
385
342
|
return tslib_1.__assign(tslib_1.__assign({ legend: legend, legendShape: legendShape, data: xValues.map(function (x, i) {
|
|
386
343
|
var _a, _b;
|
|
@@ -389,7 +346,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
389
346
|
: typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
|
|
390
347
|
? { markerSize: series.marker.size }
|
|
391
348
|
: {})));
|
|
392
|
-
}), color:
|
|
349
|
+
}), color: seriesColor }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) });
|
|
393
350
|
});
|
|
394
351
|
var yMinMaxValues = (0, utilities_1.findNumericMinMaxOfY)(chartData);
|
|
395
352
|
var _h = getTitles(input.layout), chartTitle = _h.chartTitle, xAxisTitle = _h.xAxisTitle, yAxisTitle = _h.yAxisTitle;
|
|
@@ -405,17 +362,17 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
405
362
|
}
|
|
406
363
|
};
|
|
407
364
|
exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
|
|
408
|
-
var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap,
|
|
365
|
+
var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, colorwayType, isDarkTheme) {
|
|
409
366
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
410
367
|
var _s = getLegendProps(input.data, input.layout), legends = _s.legends, hideLegend = _s.hideLegend;
|
|
411
368
|
var chartData = input.data
|
|
412
369
|
.map(function (series, index) {
|
|
413
|
-
var _a;
|
|
370
|
+
var _a, _b, _c, _d;
|
|
414
371
|
// extract colors for each series only once
|
|
415
|
-
var extractedColors = (0,
|
|
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);
|
|
416
373
|
var legend = legends[index];
|
|
417
374
|
// resolve color for each legend's bars from the extracted colors
|
|
418
|
-
var color = (0,
|
|
375
|
+
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
419
376
|
return series.y.map(function (yValue, i) {
|
|
420
377
|
return {
|
|
421
378
|
x: series.x[i],
|
|
@@ -457,6 +414,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
457
414
|
hideLegend: hideLegend,
|
|
458
415
|
noOfCharsToTruncate: 20,
|
|
459
416
|
showYAxisLablesTooltip: true,
|
|
417
|
+
roundCorners: true,
|
|
460
418
|
};
|
|
461
419
|
};
|
|
462
420
|
exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
|
|
@@ -507,6 +465,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
507
465
|
else {
|
|
508
466
|
(_h = firstData.x) === null || _h === void 0 ? void 0 : _h.forEach(function (xVal, xIdx) {
|
|
509
467
|
var _a;
|
|
468
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
510
469
|
(_a = firstData.y) === null || _a === void 0 ? void 0 : _a.forEach(function (yVal, yIdx) {
|
|
511
470
|
var _a, _b, _c, _d, _e, _f;
|
|
512
471
|
var zVal = (_b = (_a = firstData.z) === null || _a === void 0 ? void 0 : _a[yIdx]) === null || _b === void 0 ? void 0 : _b[xIdx];
|
|
@@ -560,9 +519,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
560
519
|
};
|
|
561
520
|
};
|
|
562
521
|
exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
|
|
563
|
-
var transformPlotlyJsonToSankeyProps = function (input, colorMap, isDarkTheme) {
|
|
564
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
565
|
-
var
|
|
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;
|
|
566
525
|
var validLinks = ((_a = link === null || link === void 0 ? void 0 : link.value) !== null && _a !== void 0 ? _a : [])
|
|
567
526
|
.map(function (val, index) { return ({
|
|
568
527
|
value: val,
|
|
@@ -571,21 +530,23 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
571
530
|
}); })
|
|
572
531
|
// Filter out negative nodes, unequal nodes and self-references (circular links)
|
|
573
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);
|
|
574
534
|
var sankeyChartData = {
|
|
575
|
-
nodes: (
|
|
576
|
-
var color = (0,
|
|
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);
|
|
577
537
|
return {
|
|
578
538
|
nodeId: index,
|
|
579
539
|
name: label,
|
|
580
540
|
color: color,
|
|
581
541
|
};
|
|
582
542
|
}),
|
|
543
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
583
544
|
links: validLinks.map(function (validLink, index) {
|
|
584
545
|
return tslib_1.__assign({}, validLink);
|
|
585
546
|
}),
|
|
586
547
|
};
|
|
587
548
|
var styles = {
|
|
588
|
-
root: tslib_1.__assign({}, (((
|
|
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 } : {})),
|
|
589
550
|
};
|
|
590
551
|
var chartTitle = getTitles(input.layout).chartTitle;
|
|
591
552
|
return {
|
|
@@ -593,51 +554,56 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
593
554
|
chartTitle: chartTitle,
|
|
594
555
|
SankeyChartData: sankeyChartData,
|
|
595
556
|
},
|
|
596
|
-
width: (
|
|
597
|
-
height: (
|
|
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,
|
|
598
559
|
styles: styles,
|
|
599
560
|
enableReflow: true,
|
|
600
561
|
};
|
|
601
562
|
};
|
|
602
563
|
exports.transformPlotlyJsonToSankeyProps = transformPlotlyJsonToSankeyProps;
|
|
603
|
-
var transformPlotlyJsonToGaugeProps = function (input, colorMap, isDarkTheme) {
|
|
604
|
-
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;
|
|
605
566
|
var firstData = input.data[0];
|
|
606
|
-
var
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
legend
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
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
|
+
})
|
|
617
581
|
: [
|
|
618
582
|
{
|
|
619
583
|
legend: 'Current',
|
|
620
|
-
size: (
|
|
621
|
-
color: (0, exports.
|
|
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),
|
|
622
586
|
},
|
|
623
587
|
{
|
|
624
588
|
legend: 'Target',
|
|
625
|
-
size: ((
|
|
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),
|
|
626
590
|
color: colors_1.DataVizPalette.disabled,
|
|
627
591
|
},
|
|
628
592
|
];
|
|
629
593
|
var sublabel;
|
|
630
594
|
var sublabelColor;
|
|
631
|
-
if ((
|
|
595
|
+
if ((_x = firstData.delta) === null || _x === void 0 ? void 0 : _x.reference) {
|
|
632
596
|
var diff = firstData.value - firstData.delta.reference;
|
|
633
597
|
if (diff >= 0) {
|
|
634
598
|
sublabel = "\u25B2 ".concat(diff);
|
|
635
|
-
var
|
|
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);
|
|
636
601
|
sublabelColor = color;
|
|
637
602
|
}
|
|
638
603
|
else {
|
|
639
604
|
sublabel = "\u25BC ".concat(Math.abs(diff));
|
|
640
|
-
var
|
|
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);
|
|
641
607
|
sublabelColor = color;
|
|
642
608
|
}
|
|
643
609
|
}
|
|
@@ -649,20 +615,64 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
649
615
|
var chartTitle = getTitles(input.layout).chartTitle;
|
|
650
616
|
return {
|
|
651
617
|
segments: segments,
|
|
652
|
-
chartValue: (
|
|
618
|
+
chartValue: (_8 = firstData.value) !== null && _8 !== void 0 ? _8 : 0,
|
|
653
619
|
chartTitle: chartTitle,
|
|
654
620
|
sublabel: sublabel,
|
|
655
621
|
// range values can be null
|
|
656
|
-
minValue: typeof ((
|
|
657
|
-
maxValue: typeof ((
|
|
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,
|
|
658
624
|
chartValueFormat: function () { var _a, _b; return (_b = (_a = firstData.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; },
|
|
659
|
-
width: (
|
|
660
|
-
height: (
|
|
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,
|
|
661
627
|
styles: styles,
|
|
662
|
-
variant: ((
|
|
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,
|
|
663
630
|
};
|
|
664
631
|
};
|
|
665
632
|
exports.transformPlotlyJsonToGaugeProps = transformPlotlyJsonToGaugeProps;
|
|
633
|
+
var cleanText = function (text) {
|
|
634
|
+
return text
|
|
635
|
+
.replace(/<[^&]*?>/g, '')
|
|
636
|
+
.replace(/<[^>]*>/g, '')
|
|
637
|
+
.replace(/<br>|\\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;
|
|
666
676
|
var projectPolarToCartesian = function (input) {
|
|
667
677
|
var projection = tslib_1.__assign({}, input);
|
|
668
678
|
for (var sindex = 0; sindex < input.data.length; sindex++) {
|
|
@@ -680,6 +690,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
680
690
|
return projection;
|
|
681
691
|
};
|
|
682
692
|
exports.projectPolarToCartesian = projectPolarToCartesian;
|
|
693
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
683
694
|
function isPlainObject(obj) {
|
|
684
695
|
if (window && window.process && window.process.versions) {
|
|
685
696
|
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
@@ -687,20 +698,26 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
687
698
|
return (Object.prototype.toString.call(obj) === '[object Object]' &&
|
|
688
699
|
Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty'));
|
|
689
700
|
}
|
|
701
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
690
702
|
var arrayAttributes = [];
|
|
703
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
691
704
|
var stack = [];
|
|
705
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
692
706
|
var isArrayStack = [];
|
|
707
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
693
708
|
var baseContainer, baseAttrName;
|
|
694
709
|
/**
|
|
695
710
|
* Interate iteratively through the trace object and find all the array attributes.
|
|
696
711
|
* 1 trace record = 1 series of data
|
|
697
712
|
* @param trace
|
|
698
713
|
*/
|
|
714
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
699
715
|
function findArrayAttributes(trace) {
|
|
700
716
|
// Init basecontainer and baseAttrName
|
|
701
717
|
crawlIntoTrace(baseContainer, 0, '');
|
|
702
718
|
}
|
|
703
719
|
exports.findArrayAttributes = findArrayAttributes;
|
|
720
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
704
721
|
function crawlIntoTrace(container, i, astrPartial) {
|
|
705
722
|
var item = container[stack[i]];
|
|
706
723
|
var newAstrPartial = astrPartial + stack[i];
|
|
@@ -751,7 +768,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
751
768
|
}
|
|
752
769
|
return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
|
|
753
770
|
}
|
|
771
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
754
772
|
var isStringArray = function (arr) {
|
|
773
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
755
774
|
return (0, chart_utilities_1.isArrayOfType)(arr, function (value) { return typeof value === 'string'; });
|
|
756
775
|
};
|
|
757
776
|
// TODO: Use binary search to find the appropriate bin for numeric value.
|