@fluentui/react-charts 9.2.1 → 9.2.2
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.md +24 -2
- package/dist/index.d.ts +79 -5
- package/lib/ChartTable.js +1 -0
- package/lib/ChartTable.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +57 -0
- package/lib/components/ChartTable/ChartTable.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.types.js +1 -0
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib/components/ChartTable/index.js +3 -0
- package/lib/components/ChartTable/index.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js +93 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +55 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +110 -81
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +20 -10
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +95 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +164 -77
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +161 -141
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +12 -11
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +57 -51
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/utilities.js +26 -37
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js +24 -0
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/ChartTable.js +6 -0
- package/lib-commonjs/ChartTable.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +68 -0
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js +6 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib-commonjs/components/ChartTable/index.js +8 -0
- package/lib-commonjs/components/ChartTable/index.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +196 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +69 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +109 -80
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +19 -9
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +120 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +164 -77
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +159 -139
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +11 -10
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +56 -50
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +29 -37
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js +27 -0
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* eslint-disable one-var */ /* eslint-disable vars-on-top */ /* eslint-disable no-var */
|
|
1
|
+
/* eslint-disable one-var */ /* eslint-disable vars-on-top */ /* eslint-disable no-var */ "use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
@@ -9,18 +9,21 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
_getGaugeAxisColor: function() {
|
|
13
|
+
return _getGaugeAxisColor;
|
|
14
|
+
},
|
|
12
15
|
correctYearMonth: function() {
|
|
13
16
|
return correctYearMonth;
|
|
14
17
|
},
|
|
15
18
|
findArrayAttributes: function() {
|
|
16
19
|
return findArrayAttributes;
|
|
17
20
|
},
|
|
18
|
-
getColor: function() {
|
|
19
|
-
return getColor;
|
|
20
|
-
},
|
|
21
21
|
projectPolarToCartesian: function() {
|
|
22
22
|
return projectPolarToCartesian;
|
|
23
23
|
},
|
|
24
|
+
transformPlotlyJsonToChartTableProps: function() {
|
|
25
|
+
return transformPlotlyJsonToChartTableProps;
|
|
26
|
+
},
|
|
24
27
|
transformPlotlyJsonToDonutProps: function() {
|
|
25
28
|
return transformPlotlyJsonToDonutProps;
|
|
26
29
|
},
|
|
@@ -57,6 +60,7 @@ const _colors = require("../../utilities/colors");
|
|
|
57
60
|
const _utilities = require("../../utilities/utilities");
|
|
58
61
|
const _chartutilities = require("@fluentui/chart-utilities");
|
|
59
62
|
const _d3shape = require("d3-shape");
|
|
63
|
+
const _PlotlyColorAdapter = require("./PlotlyColorAdapter");
|
|
60
64
|
const dashOptions = {
|
|
61
65
|
dot: {
|
|
62
66
|
strokeDasharray: '1, 5',
|
|
@@ -130,14 +134,6 @@ const correctYearMonth = (xValues)=>{
|
|
|
130
134
|
});
|
|
131
135
|
return xValues;
|
|
132
136
|
};
|
|
133
|
-
const getColor = (legendLabel, colorMap, isDarkTheme)=>{
|
|
134
|
-
if (!colorMap.current.has(legendLabel)) {
|
|
135
|
-
const nextColor = (0, _colors.getNextColor)(colorMap.current.size + 1, 0, isDarkTheme);
|
|
136
|
-
colorMap.current.set(legendLabel, nextColor);
|
|
137
|
-
return nextColor;
|
|
138
|
-
}
|
|
139
|
-
return colorMap.current.get(legendLabel);
|
|
140
|
-
};
|
|
141
137
|
const usesSecondaryYScale = (series)=>{
|
|
142
138
|
return series.yaxis === 'y2';
|
|
143
139
|
};
|
|
@@ -177,13 +173,20 @@ const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>
|
|
|
177
173
|
}
|
|
178
174
|
};
|
|
179
175
|
};
|
|
180
|
-
const
|
|
181
|
-
|
|
176
|
+
const _getGaugeAxisColor = (colorway, colorwayType, color, colorMap, isDarkTheme)=>{
|
|
177
|
+
const extractedColors = (0, _PlotlyColorAdapter.extractColor)(colorway, colorwayType, color, colorMap, isDarkTheme);
|
|
178
|
+
return (0, _PlotlyColorAdapter.resolveColor)(extractedColors, 0, '', colorMap, isDarkTheme);
|
|
179
|
+
};
|
|
180
|
+
const transformPlotlyJsonToDonutProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
181
|
+
var _input_layout_template_layout, _input_layout_template, _input_layout, _firstData_marker, _firstData_labels, _input_layout1, _input_layout2, _input_layout3, _input_layout4;
|
|
182
182
|
const firstData = input.data[0];
|
|
183
|
+
// extract colors for each series only once
|
|
184
|
+
const colors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, firstData === null || firstData === void 0 ? void 0 : (_firstData_marker = firstData.marker) === null || _firstData_marker === void 0 ? void 0 : _firstData_marker.colors, colorMap, isDarkTheme);
|
|
183
185
|
const mapLegendToDataPoint = {};
|
|
184
186
|
(_firstData_labels = firstData.labels) === null || _firstData_labels === void 0 ? void 0 : _firstData_labels.forEach((label, index)=>{
|
|
185
187
|
var _firstData_values;
|
|
186
|
-
|
|
188
|
+
// resolve color for each legend from the extracted colors
|
|
189
|
+
const color = (0, _PlotlyColorAdapter.resolveColor)(colors, index, label, colorMap, isDarkTheme);
|
|
187
190
|
//ToDo how to handle string data?
|
|
188
191
|
const value = typeof ((_firstData_values = firstData.values) === null || _firstData_values === void 0 ? void 0 : _firstData_values[index]) === 'number' ? firstData.values[index] : 1;
|
|
189
192
|
if (!mapLegendToDataPoint[label]) {
|
|
@@ -197,9 +200,9 @@ const transformPlotlyJsonToDonutProps = (input, colorMap, isDarkTheme)=>{
|
|
|
197
200
|
}
|
|
198
201
|
});
|
|
199
202
|
var _input_layout_width;
|
|
200
|
-
const width = (_input_layout_width = (
|
|
203
|
+
const width = (_input_layout_width = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width) !== null && _input_layout_width !== void 0 ? _input_layout_width : 440;
|
|
201
204
|
var _input_layout_height;
|
|
202
|
-
const height = (_input_layout_height = (
|
|
205
|
+
const height = (_input_layout_height = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 220;
|
|
203
206
|
const hideLabels = firstData.textinfo ? ![
|
|
204
207
|
'value',
|
|
205
208
|
'percent',
|
|
@@ -214,27 +217,32 @@ const transformPlotlyJsonToDonutProps = (input, colorMap, isDarkTheme)=>{
|
|
|
214
217
|
chartTitle,
|
|
215
218
|
chartData: Object.values(mapLegendToDataPoint)
|
|
216
219
|
},
|
|
217
|
-
hideLegend: ((
|
|
218
|
-
width: (
|
|
220
|
+
hideLegend: ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.showlegend) === false ? true : false,
|
|
221
|
+
width: (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.width,
|
|
219
222
|
height,
|
|
220
223
|
innerRadius,
|
|
221
224
|
hideLabels,
|
|
222
225
|
showLabelsInPercent: firstData.textinfo ? [
|
|
223
226
|
'percent',
|
|
224
227
|
'label+percent'
|
|
225
|
-
].includes(firstData.textinfo) : true
|
|
228
|
+
].includes(firstData.textinfo) : true,
|
|
229
|
+
roundCorners: true
|
|
226
230
|
};
|
|
227
231
|
};
|
|
228
|
-
const transformPlotlyJsonToVSBCProps = (input, colorMap, isDarkTheme, fallbackVSBC)=>{
|
|
229
|
-
var _input_layout, _input_layout1;
|
|
232
|
+
const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
|
|
233
|
+
var _input_layout, _input_layout1, _vsbcData_;
|
|
230
234
|
const mapXToDataPoints = {};
|
|
231
235
|
let yMaxValue = 0;
|
|
232
236
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
233
237
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout);
|
|
234
238
|
let yMinValue = 0;
|
|
235
239
|
input.data.forEach((series, index1)=>{
|
|
236
|
-
var _series_x;
|
|
240
|
+
var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_line, _series_x;
|
|
237
241
|
const isXYearCategory = (0, _chartutilities.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
|
|
242
|
+
// extract bar colors for each series only once
|
|
243
|
+
const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
|
|
244
|
+
// extract line colors for each series only once
|
|
245
|
+
const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
|
|
238
246
|
(_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x.forEach((x, index2)=>{
|
|
239
247
|
var _series_y;
|
|
240
248
|
if (!mapXToDataPoints[x]) {
|
|
@@ -245,10 +253,11 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, isDarkTheme, fallbackVS
|
|
|
245
253
|
};
|
|
246
254
|
}
|
|
247
255
|
const legend = legends[index1];
|
|
256
|
+
// resolve color for each legend's bars from the extracted colors
|
|
257
|
+
const color = (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, index1, legend, colorMap, isDarkTheme);
|
|
248
258
|
var _series_y_index2;
|
|
249
259
|
const yVal = (_series_y_index2 = (_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index2]) !== null && _series_y_index2 !== void 0 ? _series_y_index2 : 0;
|
|
250
260
|
if (series.type === 'bar') {
|
|
251
|
-
const color = getColor(legend, colorMap, isDarkTheme);
|
|
252
261
|
mapXToDataPoints[x].chartData.push({
|
|
253
262
|
legend,
|
|
254
263
|
data: yVal,
|
|
@@ -257,7 +266,7 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, isDarkTheme, fallbackVS
|
|
|
257
266
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
258
267
|
} else if (series.type === 'scatter' || !!fallbackVSBC) {
|
|
259
268
|
var _series_line;
|
|
260
|
-
const
|
|
269
|
+
const lineColor = (0, _PlotlyColorAdapter.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
|
|
261
270
|
const lineOptions = getLineOptions(series.line);
|
|
262
271
|
const dashType = ((_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.dash) || 'solid';
|
|
263
272
|
const legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
|
|
@@ -265,7 +274,7 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, isDarkTheme, fallbackVS
|
|
|
265
274
|
legend,
|
|
266
275
|
legendShape,
|
|
267
276
|
y: yVal,
|
|
268
|
-
color,
|
|
277
|
+
color: lineColor,
|
|
269
278
|
...lineOptions ? {
|
|
270
279
|
lineOptions
|
|
271
280
|
} : {},
|
|
@@ -280,9 +289,10 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, isDarkTheme, fallbackVS
|
|
|
280
289
|
});
|
|
281
290
|
});
|
|
282
291
|
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
292
|
+
const vsbcData = Object.values(mapXToDataPoints);
|
|
283
293
|
var _input_layout_height;
|
|
284
294
|
return {
|
|
285
|
-
data:
|
|
295
|
+
data: vsbcData,
|
|
286
296
|
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
287
297
|
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
288
298
|
barWidth: 'auto',
|
|
@@ -293,18 +303,22 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, isDarkTheme, fallbackVS
|
|
|
293
303
|
yAxisTitle,
|
|
294
304
|
mode: 'plotly',
|
|
295
305
|
...secondaryYAxisValues,
|
|
306
|
+
wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
|
|
296
307
|
hideTickOverlap: true,
|
|
297
308
|
barGapMax: 2,
|
|
298
|
-
hideLegend
|
|
309
|
+
hideLegend,
|
|
310
|
+
roundCorners: true
|
|
299
311
|
};
|
|
300
312
|
};
|
|
301
|
-
const transformPlotlyJsonToGVBCProps = (input, colorMap, isDarkTheme)=>{
|
|
302
|
-
var _input_layout, _input_layout1;
|
|
313
|
+
const transformPlotlyJsonToGVBCProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
314
|
+
var _input_layout, _input_layout1, _gvbcData_;
|
|
303
315
|
const mapXToDataPoints = {};
|
|
304
316
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
|
|
305
317
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout);
|
|
306
318
|
input.data.forEach((series, index1)=>{
|
|
307
|
-
var _series_x;
|
|
319
|
+
var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_x;
|
|
320
|
+
// extract colors for each series only once
|
|
321
|
+
const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
|
|
308
322
|
(_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x.forEach((x, index2)=>{
|
|
309
323
|
if (!mapXToDataPoints[x]) {
|
|
310
324
|
mapXToDataPoints[x] = {
|
|
@@ -315,7 +329,8 @@ const transformPlotlyJsonToGVBCProps = (input, colorMap, isDarkTheme)=>{
|
|
|
315
329
|
if (series.type === 'bar') {
|
|
316
330
|
var _series_y;
|
|
317
331
|
const legend = legends[index1];
|
|
318
|
-
|
|
332
|
+
// resolve color for each legend's bars from the extracted colors
|
|
333
|
+
const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
|
|
319
334
|
var _series_y_index2;
|
|
320
335
|
mapXToDataPoints[x].series.push({
|
|
321
336
|
key: legend,
|
|
@@ -329,9 +344,10 @@ const transformPlotlyJsonToGVBCProps = (input, colorMap, isDarkTheme)=>{
|
|
|
329
344
|
});
|
|
330
345
|
});
|
|
331
346
|
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
347
|
+
const gvbcData = Object.values(mapXToDataPoints);
|
|
332
348
|
var _input_layout_height;
|
|
333
349
|
return {
|
|
334
|
-
data:
|
|
350
|
+
data: gvbcData,
|
|
335
351
|
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
336
352
|
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
337
353
|
barWidth: 'auto',
|
|
@@ -341,18 +357,22 @@ const transformPlotlyJsonToGVBCProps = (input, colorMap, isDarkTheme)=>{
|
|
|
341
357
|
mode: 'plotly',
|
|
342
358
|
...secondaryYAxisValues,
|
|
343
359
|
hideTickOverlap: true,
|
|
344
|
-
|
|
360
|
+
wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
|
|
361
|
+
hideLegend,
|
|
362
|
+
roundCorners: true
|
|
345
363
|
};
|
|
346
364
|
};
|
|
347
|
-
const transformPlotlyJsonToVBCProps = (input, colorMap, isDarkTheme)=>{
|
|
348
|
-
var _input_layout, _input_layout1;
|
|
365
|
+
const transformPlotlyJsonToVBCProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
366
|
+
var _input_layout, _input_layout1, _vbcData_;
|
|
349
367
|
const vbcData = [];
|
|
350
368
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout);
|
|
351
369
|
input.data.forEach((series, seriesIdx)=>{
|
|
352
|
-
var _series_xbins, _series_xbins1, _series_xbins2;
|
|
370
|
+
var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_xbins, _series_xbins1, _series_xbins2;
|
|
353
371
|
if (!series.x) {
|
|
354
372
|
return;
|
|
355
373
|
}
|
|
374
|
+
// extract colors for each series only once
|
|
375
|
+
const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
|
|
356
376
|
const isXString = isStringArray(series.x);
|
|
357
377
|
// TODO: In case of a single bin, add an empty bin of the same size to prevent the
|
|
358
378
|
// default bar width from being used and ensure the bar spans the full intended range.
|
|
@@ -374,7 +394,8 @@ const transformPlotlyJsonToVBCProps = (input, colorMap, isDarkTheme)=>{
|
|
|
374
394
|
});
|
|
375
395
|
xBins.forEach((bin, index)=>{
|
|
376
396
|
const legend = legends[seriesIdx];
|
|
377
|
-
|
|
397
|
+
// resolve color for each legend's bars from the extracted colors
|
|
398
|
+
const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, seriesIdx, legend, colorMap, isDarkTheme);
|
|
378
399
|
const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
379
400
|
vbcData.push({
|
|
380
401
|
x: isXString ? bin.join(', ') : getBinCenter(bin),
|
|
@@ -398,25 +419,30 @@ const transformPlotlyJsonToVBCProps = (input, colorMap, isDarkTheme)=>{
|
|
|
398
419
|
yAxisTitle,
|
|
399
420
|
mode: 'histogram',
|
|
400
421
|
hideTickOverlap: true,
|
|
422
|
+
wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
|
|
401
423
|
maxBarWidth: 50,
|
|
402
|
-
hideLegend
|
|
424
|
+
hideLegend,
|
|
425
|
+
roundCorners: true
|
|
403
426
|
};
|
|
404
427
|
};
|
|
405
|
-
const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, colorMap, isDarkTheme)=>{
|
|
428
|
+
const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, isScatterMarkers, colorMap, colorwayType, isDarkTheme)=>{
|
|
406
429
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
|
|
407
430
|
let mode = 'tonexty';
|
|
408
431
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout);
|
|
409
432
|
const chartData = input.data.map((series, index)=>{
|
|
410
|
-
var _series_line;
|
|
433
|
+
var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_line, _series_line1;
|
|
434
|
+
// extract colors for each series only once
|
|
435
|
+
const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, isScatterMarkers ? (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color : (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
|
|
411
436
|
const xValues = series.x;
|
|
412
437
|
const isString = typeof xValues[0] === 'string';
|
|
413
438
|
const isXDate = (0, _chartutilities.isDateArray)(xValues);
|
|
414
439
|
const isXNumber = (0, _chartutilities.isNumberArray)(xValues);
|
|
415
440
|
const legend = legends[index];
|
|
416
|
-
|
|
441
|
+
// resolve color for each legend's lines from the extracted colors
|
|
442
|
+
const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
417
443
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
418
444
|
const lineOptions = getLineOptions(series.line);
|
|
419
|
-
const dashType = ((
|
|
445
|
+
const dashType = ((_series_line1 = series.line) === null || _series_line1 === void 0 ? void 0 : _series_line1.dash) || 'solid';
|
|
420
446
|
const legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
|
|
421
447
|
return {
|
|
422
448
|
legend,
|
|
@@ -433,7 +459,7 @@ const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, colorMap, is
|
|
|
433
459
|
} : {}
|
|
434
460
|
};
|
|
435
461
|
}),
|
|
436
|
-
color:
|
|
462
|
+
color: seriesColor,
|
|
437
463
|
...lineOptions ? {
|
|
438
464
|
lineOptions
|
|
439
465
|
} : {},
|
|
@@ -482,12 +508,16 @@ const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, colorMap, is
|
|
|
482
508
|
};
|
|
483
509
|
}
|
|
484
510
|
};
|
|
485
|
-
const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, isDarkTheme)=>{
|
|
511
|
+
const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
486
512
|
var _input_layout, _input_layout_margin, _input_layout1, _input_layout_margin1, _input_layout2, _input_layout_yaxis2, _input_layout3, _input_layout_yaxis21, _input_layout4, _input_layout_yaxis2_title, _input_layout_yaxis22, _input_layout5, _input_layout6;
|
|
487
513
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout);
|
|
488
514
|
const chartData = input.data.map((series, index)=>{
|
|
515
|
+
var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker;
|
|
516
|
+
// extract colors for each series only once
|
|
517
|
+
const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
|
|
489
518
|
const legend = legends[index];
|
|
490
|
-
|
|
519
|
+
// resolve color for each legend's bars from the extracted colors
|
|
520
|
+
const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
491
521
|
return series.y.map((yValue, i)=>{
|
|
492
522
|
return {
|
|
493
523
|
x: series.x[i],
|
|
@@ -523,7 +553,8 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, isDark
|
|
|
523
553
|
hideTickOverlap: true,
|
|
524
554
|
noOfCharsToTruncate: 20,
|
|
525
555
|
showYAxisLablesTooltip: true,
|
|
526
|
-
hideLegend
|
|
556
|
+
hideLegend,
|
|
557
|
+
roundCorners: true
|
|
527
558
|
};
|
|
528
559
|
};
|
|
529
560
|
const transformPlotlyJsonToHeatmapProps = (input)=>{
|
|
@@ -629,29 +660,31 @@ const transformPlotlyJsonToHeatmapProps = (input)=>{
|
|
|
629
660
|
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
630
661
|
hideTickOverlap: true,
|
|
631
662
|
noOfCharsToTruncate: 20,
|
|
632
|
-
showYAxisLablesTooltip: true
|
|
663
|
+
showYAxisLablesTooltip: true,
|
|
664
|
+
wrapXAxisLables: true
|
|
633
665
|
};
|
|
634
666
|
};
|
|
635
|
-
const transformPlotlyJsonToSankeyProps = (input, colorMap, isDarkTheme)=>{
|
|
636
|
-
var
|
|
667
|
+
const transformPlotlyJsonToSankeyProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
668
|
+
var _input_layout_template_layout, _input_layout_template, _input_layout, _node_label, _input_layout1, _input_layout2;
|
|
637
669
|
const { link, node } = input.data[0];
|
|
638
670
|
var _link_value;
|
|
639
671
|
const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>({
|
|
640
672
|
value: val,
|
|
641
673
|
source: link === null || link === void 0 ? void 0 : link.source[index],
|
|
642
674
|
target: link === null || link === void 0 ? void 0 : link.target[index]
|
|
643
|
-
})) //
|
|
644
|
-
// Filter out negative nodes, unequal nodes and self-references (circular links)
|
|
675
|
+
})) // Filter out negative nodes, unequal nodes and self-references (circular links)
|
|
645
676
|
.filter((x)=>x.source >= 0 && x.target >= 0 && x.source !== x.target);
|
|
677
|
+
const extractedNodeColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, node === null || node === void 0 ? void 0 : node.color, colorMap, isDarkTheme);
|
|
646
678
|
const sankeyChartData = {
|
|
647
679
|
nodes: (_node_label = node.label) === null || _node_label === void 0 ? void 0 : _node_label.map((label, index)=>{
|
|
648
|
-
const color =
|
|
680
|
+
const color = (0, _PlotlyColorAdapter.resolveColor)(extractedNodeColors, index, label, colorMap, isDarkTheme);
|
|
649
681
|
return {
|
|
650
682
|
nodeId: index,
|
|
651
683
|
name: label,
|
|
652
684
|
color
|
|
653
685
|
};
|
|
654
686
|
}),
|
|
687
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
655
688
|
links: validLinks.map((validLink, index)=>{
|
|
656
689
|
return {
|
|
657
690
|
...validLink
|
|
@@ -670,18 +703,20 @@ const transformPlotlyJsonToSankeyProps = (input, colorMap, isDarkTheme)=>{
|
|
|
670
703
|
chartTitle,
|
|
671
704
|
SankeyChartData: sankeyChartData
|
|
672
705
|
},
|
|
673
|
-
width: (
|
|
674
|
-
height: (_input_layout_height = (
|
|
706
|
+
width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
|
|
707
|
+
height: (_input_layout_height = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468
|
|
675
708
|
};
|
|
676
709
|
};
|
|
677
|
-
const transformPlotlyJsonToGaugeProps = (input, colorMap, isDarkTheme)=>{
|
|
678
|
-
var _firstData_gauge_steps,
|
|
710
|
+
const transformPlotlyJsonToGaugeProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
711
|
+
var _firstData_gauge, _input_layout_template_layout, _input_layout_template, _input_layout, _firstData_gauge_steps, _firstData_gauge1, _firstData_gauge_axis_range, _firstData_gauge_axis, _firstData_gauge2, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _firstData_gauge_axis1, _firstData_gauge3, _firstData_gauge_axis_range1, _firstData_gauge_axis2, _firstData_gauge4, _firstData_delta, _firstData_gauge_axis_range2, _firstData_gauge_axis3, _firstData_gauge5, _firstData_gauge_axis_range3, _firstData_gauge_axis4, _firstData_gauge6, _firstData_gauge_axis_range4, _firstData_gauge_axis5, _firstData_gauge7, _firstData_gauge_axis_range5, _firstData_gauge_axis6, _firstData_gauge8, _input_layout2, _input_layout3, _firstData_gauge_steps1, _firstData_gauge9;
|
|
679
712
|
const firstData = input.data[0];
|
|
713
|
+
const stepsColors = ((_firstData_gauge = firstData.gauge) === null || _firstData_gauge === void 0 ? void 0 : _firstData_gauge.steps) ? firstData.gauge.steps.map((step)=>step.color) : undefined;
|
|
714
|
+
const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, stepsColors, colorMap, isDarkTheme);
|
|
680
715
|
var _firstData_gauge_axis_range_, _firstData_value, _firstData_gauge_axis_range_1, _firstData_value1;
|
|
681
|
-
const segments = ((
|
|
716
|
+
const segments = ((_firstData_gauge1 = firstData.gauge) === null || _firstData_gauge1 === void 0 ? void 0 : (_firstData_gauge_steps = _firstData_gauge1.steps) === null || _firstData_gauge_steps === void 0 ? void 0 : _firstData_gauge_steps.length) ? firstData.gauge.steps.map((step, index)=>{
|
|
682
717
|
var _step_range, _step_range1;
|
|
683
718
|
const legend = step.name || `Segment ${index + 1}`;
|
|
684
|
-
const color =
|
|
719
|
+
const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
685
720
|
return {
|
|
686
721
|
legend,
|
|
687
722
|
size: ((_step_range = step.range) === null || _step_range === void 0 ? void 0 : _step_range[1]) - ((_step_range1 = step.range) === null || _step_range1 === void 0 ? void 0 : _step_range1[0]),
|
|
@@ -690,34 +725,36 @@ const transformPlotlyJsonToGaugeProps = (input, colorMap, isDarkTheme)=>{
|
|
|
690
725
|
}) : [
|
|
691
726
|
{
|
|
692
727
|
legend: 'Current',
|
|
693
|
-
size: (_firstData_value = firstData.value) !== null && _firstData_value !== void 0 ? _firstData_value : 0 - ((_firstData_gauge_axis_range_ = (
|
|
694
|
-
color:
|
|
728
|
+
size: (_firstData_value = firstData.value) !== null && _firstData_value !== void 0 ? _firstData_value : 0 - ((_firstData_gauge_axis_range_ = (_firstData_gauge2 = firstData.gauge) === null || _firstData_gauge2 === void 0 ? void 0 : (_firstData_gauge_axis = _firstData_gauge2.axis) === null || _firstData_gauge_axis === void 0 ? void 0 : (_firstData_gauge_axis_range = _firstData_gauge_axis.range) === null || _firstData_gauge_axis_range === void 0 ? void 0 : _firstData_gauge_axis_range[0]) !== null && _firstData_gauge_axis_range_ !== void 0 ? _firstData_gauge_axis_range_ : 0),
|
|
729
|
+
color: _getGaugeAxisColor((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, (_firstData_gauge3 = firstData.gauge) === null || _firstData_gauge3 === void 0 ? void 0 : (_firstData_gauge_axis1 = _firstData_gauge3.axis) === null || _firstData_gauge_axis1 === void 0 ? void 0 : _firstData_gauge_axis1.color, colorMap, isDarkTheme)
|
|
695
730
|
},
|
|
696
731
|
{
|
|
697
732
|
legend: 'Target',
|
|
698
|
-
size: ((_firstData_gauge_axis_range_1 = (
|
|
733
|
+
size: ((_firstData_gauge_axis_range_1 = (_firstData_gauge4 = firstData.gauge) === null || _firstData_gauge4 === void 0 ? void 0 : (_firstData_gauge_axis2 = _firstData_gauge4.axis) === null || _firstData_gauge_axis2 === void 0 ? void 0 : (_firstData_gauge_axis_range1 = _firstData_gauge_axis2.range) === null || _firstData_gauge_axis_range1 === void 0 ? void 0 : _firstData_gauge_axis_range1[1]) !== null && _firstData_gauge_axis_range_1 !== void 0 ? _firstData_gauge_axis_range_1 : 100) - ((_firstData_value1 = firstData.value) !== null && _firstData_value1 !== void 0 ? _firstData_value1 : 0),
|
|
699
734
|
color: _colors.DataVizPalette.disabled
|
|
700
735
|
}
|
|
701
736
|
];
|
|
702
737
|
let sublabel;
|
|
703
|
-
|
|
738
|
+
let sublabelColor;
|
|
704
739
|
if ((_firstData_delta = firstData.delta) === null || _firstData_delta === void 0 ? void 0 : _firstData_delta.reference) {
|
|
705
740
|
const diff = firstData.value - firstData.delta.reference;
|
|
706
741
|
if (diff >= 0) {
|
|
742
|
+
var _input_layout_template_layout2, _input_layout_template2, _input_layout4, _firstData_delta_increasing, _firstData_delta1;
|
|
707
743
|
sublabel = `\u25B2 ${diff}`;
|
|
708
|
-
|
|
709
|
-
|
|
744
|
+
const extractedIncreasingDeltaColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_template2 = _input_layout4.template) === null || _input_layout_template2 === void 0 ? void 0 : (_input_layout_template_layout2 = _input_layout_template2.layout) === null || _input_layout_template_layout2 === void 0 ? void 0 : _input_layout_template_layout2.colorway, colorwayType, (_firstData_delta1 = firstData.delta) === null || _firstData_delta1 === void 0 ? void 0 : (_firstData_delta_increasing = _firstData_delta1.increasing) === null || _firstData_delta_increasing === void 0 ? void 0 : _firstData_delta_increasing.color, colorMap, isDarkTheme);
|
|
745
|
+
const color = (0, _PlotlyColorAdapter.resolveColor)(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
|
|
746
|
+
sublabelColor = color;
|
|
710
747
|
} else {
|
|
748
|
+
var _input_layout_template_layout3, _input_layout_template3, _input_layout5, _firstData_delta_decreasing, _firstData_delta2;
|
|
711
749
|
sublabel = `\u25BC ${Math.abs(diff)}`;
|
|
712
|
-
|
|
713
|
-
|
|
750
|
+
const extractedDecreasingDeltaColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template3 = _input_layout5.template) === null || _input_layout_template3 === void 0 ? void 0 : (_input_layout_template_layout3 = _input_layout_template3.layout) === null || _input_layout_template_layout3 === void 0 ? void 0 : _input_layout_template_layout3.colorway, colorwayType, (_firstData_delta2 = firstData.delta) === null || _firstData_delta2 === void 0 ? void 0 : (_firstData_delta_decreasing = _firstData_delta2.decreasing) === null || _firstData_delta_decreasing === void 0 ? void 0 : _firstData_delta_decreasing.color, colorMap, isDarkTheme);
|
|
751
|
+
const color = (0, _PlotlyColorAdapter.resolveColor)(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
|
|
752
|
+
sublabelColor = color;
|
|
714
753
|
}
|
|
715
754
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
// },
|
|
720
|
-
// };
|
|
755
|
+
const styles = {
|
|
756
|
+
sublabel: sublabelColor
|
|
757
|
+
};
|
|
721
758
|
const { chartTitle } = getTitles(input.layout);
|
|
722
759
|
var _firstData_value2, _input_layout_height;
|
|
723
760
|
return {
|
|
@@ -726,18 +763,60 @@ const transformPlotlyJsonToGaugeProps = (input, colorMap, isDarkTheme)=>{
|
|
|
726
763
|
chartTitle,
|
|
727
764
|
sublabel,
|
|
728
765
|
// range values can be null
|
|
729
|
-
minValue: typeof ((
|
|
730
|
-
maxValue: typeof ((
|
|
766
|
+
minValue: typeof ((_firstData_gauge5 = firstData.gauge) === null || _firstData_gauge5 === void 0 ? void 0 : (_firstData_gauge_axis3 = _firstData_gauge5.axis) === null || _firstData_gauge_axis3 === void 0 ? void 0 : (_firstData_gauge_axis_range2 = _firstData_gauge_axis3.range) === null || _firstData_gauge_axis_range2 === void 0 ? void 0 : _firstData_gauge_axis_range2[0]) === 'number' ? (_firstData_gauge6 = firstData.gauge) === null || _firstData_gauge6 === void 0 ? void 0 : (_firstData_gauge_axis4 = _firstData_gauge6.axis) === null || _firstData_gauge_axis4 === void 0 ? void 0 : (_firstData_gauge_axis_range3 = _firstData_gauge_axis4.range) === null || _firstData_gauge_axis_range3 === void 0 ? void 0 : _firstData_gauge_axis_range3[0] : undefined,
|
|
767
|
+
maxValue: typeof ((_firstData_gauge7 = firstData.gauge) === null || _firstData_gauge7 === void 0 ? void 0 : (_firstData_gauge_axis5 = _firstData_gauge7.axis) === null || _firstData_gauge_axis5 === void 0 ? void 0 : (_firstData_gauge_axis_range4 = _firstData_gauge_axis5.range) === null || _firstData_gauge_axis_range4 === void 0 ? void 0 : _firstData_gauge_axis_range4[1]) === 'number' ? (_firstData_gauge8 = firstData.gauge) === null || _firstData_gauge8 === void 0 ? void 0 : (_firstData_gauge_axis6 = _firstData_gauge8.axis) === null || _firstData_gauge_axis6 === void 0 ? void 0 : (_firstData_gauge_axis_range5 = _firstData_gauge_axis6.range) === null || _firstData_gauge_axis_range5 === void 0 ? void 0 : _firstData_gauge_axis_range5[1] : undefined,
|
|
731
768
|
chartValueFormat: ()=>{
|
|
732
769
|
var _firstData_value;
|
|
733
770
|
var _firstData_value_toString;
|
|
734
771
|
return (_firstData_value_toString = (_firstData_value = firstData.value) === null || _firstData_value === void 0 ? void 0 : _firstData_value.toString()) !== null && _firstData_value_toString !== void 0 ? _firstData_value_toString : '';
|
|
735
772
|
},
|
|
736
|
-
width: (
|
|
737
|
-
height: (_input_layout_height = (
|
|
773
|
+
width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
|
|
774
|
+
height: (_input_layout_height = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 220,
|
|
738
775
|
// TODO
|
|
739
776
|
// styles,
|
|
740
|
-
variant: ((
|
|
777
|
+
variant: ((_firstData_gauge9 = firstData.gauge) === null || _firstData_gauge9 === void 0 ? void 0 : (_firstData_gauge_steps1 = _firstData_gauge9.steps) === null || _firstData_gauge_steps1 === void 0 ? void 0 : _firstData_gauge_steps1.length) ? 'multiple-segments' : 'single-segment',
|
|
778
|
+
styles,
|
|
779
|
+
roundCorners: true
|
|
780
|
+
};
|
|
781
|
+
};
|
|
782
|
+
const cleanText = (text)=>{
|
|
783
|
+
return text.replace(/<[^&]*?>/g, '').replace(/<[^>]*>/g, '').replace(/<br>|\\u003cbr\\u003e|<br>/gi, '').replace(/\$[^$]*\$/g, '$').trim();
|
|
784
|
+
};
|
|
785
|
+
const transformPlotlyJsonToChartTableProps = (input, colorMap, isDarkTheme)=>{
|
|
786
|
+
var _tableData_cells, _input_layout_font, _input_layout, _tableData_header, _input_layout1, _input_layout2;
|
|
787
|
+
const tableData = input.data[0];
|
|
788
|
+
const normalizeHeaders = (values)=>{
|
|
789
|
+
// Case: values is array of arrays
|
|
790
|
+
if (Array.isArray(values[0])) {
|
|
791
|
+
return values.map((row)=>row.map((cell)=>cleanText(cell)).filter(Boolean).join(' '));
|
|
792
|
+
}
|
|
793
|
+
// Case: values is 1d array
|
|
794
|
+
return values.map((cell)=>cleanText(cell));
|
|
795
|
+
};
|
|
796
|
+
var _tableData_cells_values;
|
|
797
|
+
const columns = (_tableData_cells_values = (_tableData_cells = tableData.cells) === null || _tableData_cells === void 0 ? void 0 : _tableData_cells.values) !== null && _tableData_cells_values !== void 0 ? _tableData_cells_values : [];
|
|
798
|
+
const rows = columns[0].map((_, rowIndex)=>columns.map((col)=>{
|
|
799
|
+
const cell = col[rowIndex];
|
|
800
|
+
return {
|
|
801
|
+
value: typeof cell === 'string' ? cleanText(cell) : cell
|
|
802
|
+
};
|
|
803
|
+
}));
|
|
804
|
+
const styles = {
|
|
805
|
+
root: {
|
|
806
|
+
...((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_font = _input_layout.font) === null || _input_layout_font === void 0 ? void 0 : _input_layout_font.size) ? {
|
|
807
|
+
fontSize: input.layout.font.size
|
|
808
|
+
} : {}
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
var _tableData_header_values;
|
|
812
|
+
return {
|
|
813
|
+
headers: normalizeHeaders((_tableData_header_values = (_tableData_header = tableData.header) === null || _tableData_header === void 0 ? void 0 : _tableData_header.values) !== null && _tableData_header_values !== void 0 ? _tableData_header_values : []).map((value)=>({
|
|
814
|
+
value
|
|
815
|
+
})),
|
|
816
|
+
rows,
|
|
817
|
+
width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
|
|
818
|
+
height: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.height,
|
|
819
|
+
styles
|
|
741
820
|
};
|
|
742
821
|
};
|
|
743
822
|
const projectPolarToCartesian = (input)=>{
|
|
@@ -758,17 +837,23 @@ const projectPolarToCartesian = (input)=>{
|
|
|
758
837
|
}
|
|
759
838
|
return projection;
|
|
760
839
|
};
|
|
840
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
761
841
|
function isPlainObject(obj) {
|
|
762
842
|
return Object.prototype.toString.call(obj) === '[object Object]' && Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty');
|
|
763
843
|
}
|
|
844
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
764
845
|
var arrayAttributes = [];
|
|
846
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
765
847
|
var stack = [];
|
|
848
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
766
849
|
var isArrayStack = [];
|
|
850
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
767
851
|
var baseContainer, baseAttrName;
|
|
768
852
|
function findArrayAttributes(trace) {
|
|
769
853
|
// Init basecontainer and baseAttrName
|
|
770
854
|
crawlIntoTrace(baseContainer, 0, '');
|
|
771
855
|
}
|
|
856
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
772
857
|
function crawlIntoTrace(container, i, astrPartial) {
|
|
773
858
|
var item = container[stack[i]];
|
|
774
859
|
var newAstrPartial = astrPartial + stack[i];
|
|
@@ -820,7 +905,9 @@ function getLineOptions(line) {
|
|
|
820
905
|
}
|
|
821
906
|
return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
|
|
822
907
|
}
|
|
908
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
823
909
|
const isStringArray = (arr)=>{
|
|
910
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
824
911
|
return (0, _chartutilities.isArrayOfType)(arr, (value)=>typeof value === 'string');
|
|
825
912
|
};
|
|
826
913
|
// TODO: Use binary search to find the appropriate bin for numeric value.
|