@fluentui/react-charts 0.0.0-nightly-20250818-0407.1 → 0.0.0-nightly-20250820-0406.1
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 +15 -15
- package/dist/index.d.ts +65 -1
- package/lib/components/AreaChart/AreaChart.js +4 -1
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +48 -3
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +175 -112
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +6 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +315 -55
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +30 -9
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +10 -3
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +54 -37
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +21 -4
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +16 -3
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/utilities.js +4 -1
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +4 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +48 -3
- 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/useCartesianChartStyles.styles.js +13 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +171 -110
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +9 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +331 -61
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +30 -9
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +12 -3
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +54 -37
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +30 -3
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +15 -2
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +1 -0
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +12 -12
|
@@ -18,21 +18,27 @@ _export(exports, {
|
|
|
18
18
|
findArrayAttributes: function() {
|
|
19
19
|
return findArrayAttributes;
|
|
20
20
|
},
|
|
21
|
+
getAllupLegendsProps: function() {
|
|
22
|
+
return getAllupLegendsProps;
|
|
23
|
+
},
|
|
24
|
+
getGridProperties: function() {
|
|
25
|
+
return getGridProperties;
|
|
26
|
+
},
|
|
21
27
|
getNumberAtIndexOrDefault: function() {
|
|
22
28
|
return getNumberAtIndexOrDefault;
|
|
23
29
|
},
|
|
24
30
|
getValidXYRanges: function() {
|
|
25
31
|
return getValidXYRanges;
|
|
26
32
|
},
|
|
27
|
-
isStringArray: function() {
|
|
28
|
-
return isStringArray;
|
|
29
|
-
},
|
|
30
33
|
projectPolarToCartesian: function() {
|
|
31
34
|
return projectPolarToCartesian;
|
|
32
35
|
},
|
|
33
36
|
resolveXAxisPoint: function() {
|
|
34
37
|
return resolveXAxisPoint;
|
|
35
38
|
},
|
|
39
|
+
transformPlotlyJsonToAreaChartProps: function() {
|
|
40
|
+
return transformPlotlyJsonToAreaChartProps;
|
|
41
|
+
},
|
|
36
42
|
transformPlotlyJsonToChartTableProps: function() {
|
|
37
43
|
return transformPlotlyJsonToChartTableProps;
|
|
38
44
|
},
|
|
@@ -51,6 +57,9 @@ _export(exports, {
|
|
|
51
57
|
transformPlotlyJsonToHorizontalBarWithAxisProps: function() {
|
|
52
58
|
return transformPlotlyJsonToHorizontalBarWithAxisProps;
|
|
53
59
|
},
|
|
60
|
+
transformPlotlyJsonToLineChartProps: function() {
|
|
61
|
+
return transformPlotlyJsonToLineChartProps;
|
|
62
|
+
},
|
|
54
63
|
transformPlotlyJsonToSankeyProps: function() {
|
|
55
64
|
return transformPlotlyJsonToSankeyProps;
|
|
56
65
|
},
|
|
@@ -74,6 +83,7 @@ const _utilities = require("../../utilities/utilities");
|
|
|
74
83
|
const _chartutilities = require("@fluentui/chart-utilities");
|
|
75
84
|
const _d3shape = require("d3-shape");
|
|
76
85
|
const _PlotlyColorAdapter = require("./PlotlyColorAdapter");
|
|
86
|
+
const _d3color = require("d3-color");
|
|
77
87
|
const dashOptions = {
|
|
78
88
|
dot: {
|
|
79
89
|
strokeDasharray: '1, 5',
|
|
@@ -157,8 +167,9 @@ const correctYearMonth = (xValues)=>{
|
|
|
157
167
|
});
|
|
158
168
|
return xValues;
|
|
159
169
|
};
|
|
160
|
-
const usesSecondaryYScale = (series)=>{
|
|
161
|
-
|
|
170
|
+
const usesSecondaryYScale = (series, layout)=>{
|
|
171
|
+
var _layout_yaxis2, _layout_yaxis21;
|
|
172
|
+
return series.yaxis === 'y2' && ((layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.anchor) === 'x' || (layout === null || layout === void 0 ? void 0 : (_layout_yaxis21 = layout.yaxis2) === null || _layout_yaxis21 === void 0 ? void 0 : _layout_yaxis21.side) === 'right');
|
|
162
173
|
};
|
|
163
174
|
const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>{
|
|
164
175
|
var _layout_yaxis2, _layout_yaxis21, _layout_yaxis2_title, _layout_yaxis22;
|
|
@@ -166,7 +177,7 @@ const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>
|
|
|
166
177
|
let yMinValue;
|
|
167
178
|
let yMaxValue;
|
|
168
179
|
data.forEach((series)=>{
|
|
169
|
-
if (usesSecondaryYScale(series)) {
|
|
180
|
+
if (usesSecondaryYScale(series, layout)) {
|
|
170
181
|
containsSecondaryYAxis = true;
|
|
171
182
|
const yValues = series.y;
|
|
172
183
|
if (yValues) {
|
|
@@ -219,7 +230,7 @@ const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
|
|
|
219
230
|
}
|
|
220
231
|
return x;
|
|
221
232
|
};
|
|
222
|
-
const transformPlotlyJsonToDonutProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
233
|
+
const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
223
234
|
var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _firstData_marker, _firstData_labels, _input_layout3, _input_layout4, _input_layout5, _input_layout6;
|
|
224
235
|
const firstData = input.data[0];
|
|
225
236
|
var _input_layout_piecolorway, _input_layout_piecolorway1;
|
|
@@ -276,12 +287,12 @@ const transformPlotlyJsonToDonutProps = (input, colorMap, colorwayType, isDarkTh
|
|
|
276
287
|
roundCorners: true
|
|
277
288
|
};
|
|
278
289
|
};
|
|
279
|
-
const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
|
|
290
|
+
const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
|
|
280
291
|
var _input_layout, _input_layout1, _vsbcData_;
|
|
281
292
|
const mapXToDataPoints = {};
|
|
282
293
|
let yMaxValue = 0;
|
|
283
294
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
284
|
-
const { legends, hideLegend } = getLegendProps(input.data, input.layout);
|
|
295
|
+
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
285
296
|
let colorScale = undefined;
|
|
286
297
|
let yMinValue = 0;
|
|
287
298
|
input.data.forEach((series, index1)=>{
|
|
@@ -296,7 +307,7 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkThe
|
|
|
296
307
|
const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template1 = _input_layout2.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);
|
|
297
308
|
const xValues = series.x;
|
|
298
309
|
const isXDate = (0, _chartutilities.isDateArray)(xValues);
|
|
299
|
-
const isXString = isStringArray(xValues);
|
|
310
|
+
const isXString = (0, _chartutilities.isStringArray)(xValues);
|
|
300
311
|
const isXNumber = (0, _chartutilities.isNumberArray)(xValues);
|
|
301
312
|
const validXYRanges = getValidXYRanges(series);
|
|
302
313
|
validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
|
|
@@ -314,33 +325,40 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkThe
|
|
|
314
325
|
const legend = legends[index1];
|
|
315
326
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
316
327
|
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
|
|
328
|
+
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
|
|
317
329
|
const yVal = rangeYValues[index2];
|
|
318
330
|
if (series.type === 'bar') {
|
|
331
|
+
var _rgb_copy_formatHex8;
|
|
319
332
|
mapXToDataPoints[x].chartData.push({
|
|
320
333
|
legend,
|
|
321
334
|
data: yVal,
|
|
322
|
-
color
|
|
335
|
+
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
336
|
+
opacity
|
|
337
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
323
338
|
});
|
|
324
339
|
if (typeof yVal === 'number') {
|
|
325
340
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
326
341
|
}
|
|
327
342
|
} else if (series.type === 'scatter' || !!fallbackVSBC) {
|
|
328
|
-
var
|
|
343
|
+
var _series_mode;
|
|
329
344
|
const lineColor = (0, _PlotlyColorAdapter.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
|
|
330
|
-
const lineOptions = getLineOptions(series.line);
|
|
331
|
-
const
|
|
332
|
-
|
|
345
|
+
const lineOptions = !((_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('text')) ? getLineOptions(series.line) : undefined;
|
|
346
|
+
const legendShape = getLegendShape(series);
|
|
347
|
+
var _rgb_copy_formatHex81;
|
|
333
348
|
mapXToDataPoints[x].lineData.push({
|
|
334
349
|
legend: legend + (validXYRanges.length > 1 ? `.${rangeIdx + 1}` : ''),
|
|
335
350
|
legendShape,
|
|
336
351
|
y: yVal,
|
|
337
|
-
color: lineColor
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
352
|
+
color: (_rgb_copy_formatHex81 = (0, _d3color.rgb)(lineColor).copy({
|
|
353
|
+
opacity
|
|
354
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex81 !== void 0 ? _rgb_copy_formatHex81 : color,
|
|
355
|
+
lineOptions: {
|
|
356
|
+
...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
|
|
357
|
+
mode: series.mode
|
|
358
|
+
},
|
|
359
|
+
useSecondaryYScale: usesSecondaryYScale(series, input.layout)
|
|
342
360
|
});
|
|
343
|
-
if (!usesSecondaryYScale(series) && typeof yVal === 'number') {
|
|
361
|
+
if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
|
|
344
362
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
345
363
|
yMinValue = Math.min(yMinValue, yVal);
|
|
346
364
|
}
|
|
@@ -388,11 +406,11 @@ const createColorScale = (layout, series)=>{
|
|
|
388
406
|
const scaleColors = scale.map((item)=>item[1]);
|
|
389
407
|
return (0, _d3scale.scaleLinear)().domain(scaleDomain).range(scaleColors);
|
|
390
408
|
};
|
|
391
|
-
const transformPlotlyJsonToGVBCProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
409
|
+
const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
392
410
|
var _input_layout, _input_layout1, _gvbcData_;
|
|
393
411
|
const mapXToDataPoints = {};
|
|
394
412
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
|
|
395
|
-
const { legends, hideLegend } = getLegendProps(input.data, input.layout);
|
|
413
|
+
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
396
414
|
let colorScale = undefined;
|
|
397
415
|
input.data.forEach((series, index1)=>{
|
|
398
416
|
var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _series_x;
|
|
@@ -417,13 +435,17 @@ const transformPlotlyJsonToGVBCProps = (input, colorMap, colorwayType, isDarkThe
|
|
|
417
435
|
const legend = legends[index1];
|
|
418
436
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
419
437
|
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
|
|
438
|
+
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
|
|
439
|
+
var _rgb_copy_formatHex8;
|
|
420
440
|
mapXToDataPoints[x].series.push({
|
|
421
441
|
key: legend,
|
|
422
442
|
data: series.y[index2],
|
|
423
443
|
xAxisCalloutData: x,
|
|
424
|
-
color,
|
|
444
|
+
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
445
|
+
opacity
|
|
446
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
425
447
|
legend,
|
|
426
|
-
useSecondaryYScale: usesSecondaryYScale(series)
|
|
448
|
+
useSecondaryYScale: usesSecondaryYScale(series, input.layout)
|
|
427
449
|
});
|
|
428
450
|
}
|
|
429
451
|
});
|
|
@@ -447,10 +469,10 @@ const transformPlotlyJsonToGVBCProps = (input, colorMap, colorwayType, isDarkThe
|
|
|
447
469
|
roundCorners: true
|
|
448
470
|
};
|
|
449
471
|
};
|
|
450
|
-
const transformPlotlyJsonToVBCProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
472
|
+
const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
451
473
|
var _input_layout, _input_layout1, _vbcData_;
|
|
452
474
|
const vbcData = [];
|
|
453
|
-
const { legends, hideLegend } = getLegendProps(input.data, input.layout);
|
|
475
|
+
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
454
476
|
let colorScale = undefined;
|
|
455
477
|
input.data.forEach((series, seriesIdx)=>{
|
|
456
478
|
var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _series_xbins, _series_xbins1, _series_xbins2;
|
|
@@ -472,7 +494,7 @@ const transformPlotlyJsonToVBCProps = (input, colorMap, colorwayType, isDarkThem
|
|
|
472
494
|
xValues.push(xVal);
|
|
473
495
|
yValues.push(yVal);
|
|
474
496
|
});
|
|
475
|
-
const isXString = isStringArray(xValues);
|
|
497
|
+
const isXString = (0, _chartutilities.isStringArray)(xValues);
|
|
476
498
|
// TODO: In case of a single bin, add an empty bin of the same size to prevent the
|
|
477
499
|
// default bar width from being used and ensure the bar spans the full intended range.
|
|
478
500
|
const xBins = createBins(xValues, (_series_xbins = series.xbins) === null || _series_xbins === void 0 ? void 0 : _series_xbins.start, (_series_xbins1 = series.xbins) === null || _series_xbins1 === void 0 ? void 0 : _series_xbins1.end, (_series_xbins2 = series.xbins) === null || _series_xbins2 === void 0 ? void 0 : _series_xbins2.size);
|
|
@@ -494,12 +516,16 @@ const transformPlotlyJsonToVBCProps = (input, colorMap, colorwayType, isDarkThem
|
|
|
494
516
|
const legend = legends[seriesIdx];
|
|
495
517
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
496
518
|
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
519
|
+
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
|
|
497
520
|
const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
521
|
+
var _rgb_copy_formatHex8;
|
|
498
522
|
vbcData.push({
|
|
499
523
|
x: isXString ? bin.join(', ') : getBinCenter(bin),
|
|
500
524
|
y: yVal,
|
|
501
525
|
legend,
|
|
502
|
-
color,
|
|
526
|
+
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
527
|
+
opacity
|
|
528
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
503
529
|
...isXString ? {} : {
|
|
504
530
|
xAxisCalloutData: `[${bin.x0} - ${bin.x1})`
|
|
505
531
|
}
|
|
@@ -523,34 +549,55 @@ const transformPlotlyJsonToVBCProps = (input, colorMap, colorwayType, isDarkThem
|
|
|
523
549
|
roundCorners: true
|
|
524
550
|
};
|
|
525
551
|
};
|
|
526
|
-
const
|
|
552
|
+
const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
553
|
+
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'area', colorMap, colorwayType, isDarkTheme);
|
|
554
|
+
};
|
|
555
|
+
const transformPlotlyJsonToLineChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
556
|
+
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'line', colorMap, colorwayType, isDarkTheme);
|
|
557
|
+
};
|
|
558
|
+
const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
559
|
+
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
|
|
560
|
+
};
|
|
561
|
+
const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
|
|
562
|
+
var _input_data_;
|
|
563
|
+
const isScatterMarkers = [
|
|
564
|
+
'markers',
|
|
565
|
+
'text+markers',
|
|
566
|
+
'markers+text',
|
|
567
|
+
'lines+markers',
|
|
568
|
+
'markers+line',
|
|
569
|
+
'text+lines+markers'
|
|
570
|
+
].includes((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.mode);
|
|
571
|
+
const isAreaChart = chartType === 'area';
|
|
572
|
+
const isScatterChart = chartType === 'scatter';
|
|
527
573
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
|
|
528
574
|
let mode = 'tonexty';
|
|
529
|
-
const { legends, hideLegend } = getLegendProps(input.data, input.layout);
|
|
575
|
+
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
530
576
|
const chartData = input.data.map((series, index)=>{
|
|
531
|
-
var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout,
|
|
577
|
+
var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
|
|
532
578
|
const colors = isScatterMarkers ? (series === null || series === void 0 ? void 0 : (_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('line')) ? (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color : (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color : (_series_line1 = series.line) === null || _series_line1 === void 0 ? void 0 : _series_line1.color;
|
|
533
579
|
// extract colors for each series only once
|
|
534
580
|
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, colors, colorMap, isDarkTheme);
|
|
535
581
|
const xValues = series.x;
|
|
536
|
-
const isXString = isStringArray(xValues);
|
|
582
|
+
const isXString = (0, _chartutilities.isStringArray)(xValues);
|
|
537
583
|
const isXDate = (0, _chartutilities.isDateArray)(xValues);
|
|
538
584
|
const isXNumber = (0, _chartutilities.isNumberArray)(xValues);
|
|
539
|
-
|
|
540
|
-
const isXYearCategory = false;
|
|
585
|
+
const isXYearCategory = (0, _chartutilities.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
|
|
541
586
|
const legend = legends[index];
|
|
542
587
|
// resolve color for each legend's lines from the extracted colors
|
|
543
588
|
const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
589
|
+
const seriesOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
|
|
544
590
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
545
|
-
const lineOptions = getLineOptions(series.line);
|
|
546
|
-
const
|
|
547
|
-
const legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
|
|
591
|
+
const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) ? getLineOptions(series.line) : undefined;
|
|
592
|
+
const legendShape = getLegendShape(series);
|
|
548
593
|
const validXYRanges = getValidXYRanges(series);
|
|
549
594
|
return validXYRanges.map(([rangeStart, rangeEnd], rangeIdx)=>{
|
|
550
595
|
var _series_marker;
|
|
551
596
|
const rangeXValues = xValues.slice(rangeStart, rangeEnd);
|
|
552
597
|
const rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
553
598
|
const markerSizes = (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? series.marker.size.slice(rangeStart, rangeEnd) : [];
|
|
599
|
+
const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : undefined;
|
|
600
|
+
var _rgb_copy_formatHex8;
|
|
554
601
|
return {
|
|
555
602
|
legend,
|
|
556
603
|
legendShape,
|
|
@@ -563,14 +610,20 @@ const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, isScatterMar
|
|
|
563
610
|
markerSize: markerSizes[i]
|
|
564
611
|
} : typeof ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.size) === 'number' ? {
|
|
565
612
|
markerSize: series.marker.size
|
|
613
|
+
} : {},
|
|
614
|
+
...textValues ? {
|
|
615
|
+
text: textValues[i]
|
|
566
616
|
} : {}
|
|
567
617
|
};
|
|
568
618
|
}),
|
|
569
|
-
color: seriesColor
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
619
|
+
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(seriesColor).copy({
|
|
620
|
+
opacity: seriesOpacity
|
|
621
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : seriesColor,
|
|
622
|
+
lineOptions: {
|
|
623
|
+
...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
|
|
624
|
+
mode: series.mode
|
|
625
|
+
},
|
|
626
|
+
useSecondaryYScale: usesSecondaryYScale(series, input.layout)
|
|
574
627
|
};
|
|
575
628
|
});
|
|
576
629
|
}).flat();
|
|
@@ -581,6 +634,10 @@ const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, isScatterMar
|
|
|
581
634
|
chartTitle,
|
|
582
635
|
lineChartData: chartData
|
|
583
636
|
};
|
|
637
|
+
const scatterChartProps = {
|
|
638
|
+
chartTitle,
|
|
639
|
+
scatterChartData: chartData
|
|
640
|
+
};
|
|
584
641
|
if (isAreaChart) {
|
|
585
642
|
var _input_layout, _input_layout1;
|
|
586
643
|
var _input_layout_height;
|
|
@@ -602,7 +659,7 @@ const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, isScatterMar
|
|
|
602
659
|
var _input_layout2, _input_layout3;
|
|
603
660
|
var _input_layout_height1;
|
|
604
661
|
return {
|
|
605
|
-
data: chartProps,
|
|
662
|
+
data: isScatterChart ? scatterChartProps : chartProps,
|
|
606
663
|
supportNegativeData: true,
|
|
607
664
|
xAxisTitle,
|
|
608
665
|
yAxisTitle,
|
|
@@ -619,9 +676,9 @@ const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, isScatterMar
|
|
|
619
676
|
};
|
|
620
677
|
}
|
|
621
678
|
};
|
|
622
|
-
const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
679
|
+
const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
623
680
|
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;
|
|
624
|
-
const { legends, hideLegend } = getLegendProps(input.data, input.layout);
|
|
681
|
+
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
625
682
|
let colorScale = undefined;
|
|
626
683
|
const chartData = input.data.map((series, index)=>{
|
|
627
684
|
var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3;
|
|
@@ -638,11 +695,15 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, colorw
|
|
|
638
695
|
}
|
|
639
696
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
640
697
|
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
|
|
698
|
+
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, i);
|
|
699
|
+
var _rgb_copy_formatHex8;
|
|
641
700
|
return {
|
|
642
701
|
x: series.x[i],
|
|
643
702
|
y: yValue,
|
|
644
703
|
legend,
|
|
645
|
-
color
|
|
704
|
+
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
705
|
+
opacity
|
|
706
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
646
707
|
};
|
|
647
708
|
}).filter((point)=>point !== null);
|
|
648
709
|
}).reverse().flat() //reversing the order to invert the Y bars order as required by plotly.
|
|
@@ -676,7 +737,7 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, colorw
|
|
|
676
737
|
roundCorners: true
|
|
677
738
|
};
|
|
678
739
|
};
|
|
679
|
-
const transformPlotlyJsonToHeatmapProps = (input)=>{
|
|
740
|
+
const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
680
741
|
var _input_layout, _input_layout_coloraxis, _input_layout1, _input_layout_template_layout, _input_layout_template, _input_layout2, _input_layout_template_data_histogram2d_, _input_layout_template_data_histogram2d, _input_layout_template_data, _input_layout_template1, _input_layout3, _input_layout_template_data_heatmap_, _input_layout_template_data_heatmap, _input_layout_template_data1, _input_layout_template2, _input_layout4, _input_layout5, _input_layout6;
|
|
681
742
|
const firstData = input.data[0];
|
|
682
743
|
const heatmapDataPoints = [];
|
|
@@ -697,8 +758,8 @@ const transformPlotlyJsonToHeatmapProps = (input)=>{
|
|
|
697
758
|
yValues.push(firstData.y[index]);
|
|
698
759
|
zValues.push(zVal);
|
|
699
760
|
});
|
|
700
|
-
const isXString = isStringArray(xValues);
|
|
701
|
-
const isYString = isStringArray(yValues);
|
|
761
|
+
const isXString = (0, _chartutilities.isStringArray)(xValues);
|
|
762
|
+
const isYString = (0, _chartutilities.isStringArray)(yValues);
|
|
702
763
|
const xBins = createBins(xValues, (_firstData_xbins = firstData.xbins) === null || _firstData_xbins === void 0 ? void 0 : _firstData_xbins.start, (_firstData_xbins1 = firstData.xbins) === null || _firstData_xbins1 === void 0 ? void 0 : _firstData_xbins1.end, (_firstData_xbins2 = firstData.xbins) === null || _firstData_xbins2 === void 0 ? void 0 : _firstData_xbins2.size);
|
|
703
764
|
const yBins = createBins(yValues, (_firstData_ybins = firstData.ybins) === null || _firstData_ybins === void 0 ? void 0 : _firstData_ybins.start, (_firstData_ybins1 = firstData.ybins) === null || _firstData_ybins1 === void 0 ? void 0 : _firstData_ybins1.end, (_firstData_ybins2 = firstData.ybins) === null || _firstData_ybins2 === void 0 ? void 0 : _firstData_ybins2.size);
|
|
704
765
|
const zBins = yBins.map(()=>xBins.map(()=>[]));
|
|
@@ -808,7 +869,7 @@ const transformPlotlyJsonToHeatmapProps = (input)=>{
|
|
|
808
869
|
wrapXAxisLables: true
|
|
809
870
|
};
|
|
810
871
|
};
|
|
811
|
-
const transformPlotlyJsonToSankeyProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
872
|
+
const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
812
873
|
var _input_layout_template_layout, _input_layout_template, _input_layout, _node_label, _input_layout1, _input_layout2;
|
|
813
874
|
const { link, node } = input.data[0];
|
|
814
875
|
var _link_value;
|
|
@@ -857,7 +918,7 @@ const transformPlotlyJsonToSankeyProps = (input, colorMap, colorwayType, isDarkT
|
|
|
857
918
|
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
|
|
858
919
|
};
|
|
859
920
|
};
|
|
860
|
-
const transformPlotlyJsonToGaugeProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
921
|
+
const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
861
922
|
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;
|
|
862
923
|
const firstData = input.data[0];
|
|
863
924
|
const stepsColors = ((_firstData_gauge = firstData.gauge) === null || _firstData_gauge === void 0 ? void 0 : _firstData_gauge.steps) ? firstData.gauge.steps.map((step)=>step.color) : undefined;
|
|
@@ -953,7 +1014,7 @@ const formatValue = (value, colIndex, cells)=>{
|
|
|
953
1014
|
}
|
|
954
1015
|
return `${prefix !== null && prefix !== void 0 ? prefix : ''}${formatted}${suffix !== null && suffix !== void 0 ? suffix : ''}`;
|
|
955
1016
|
};
|
|
956
|
-
const transformPlotlyJsonToChartTableProps = (input, colorMap, isDarkTheme)=>{
|
|
1017
|
+
const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
957
1018
|
var _tableData_cells, _input_layout_template_data, _input_layout_template, _input_layout, _input_layout_font, _input_layout1, _tableData_header, _tableData_header1, _input_layout_template_data1, _input_layout_template1, _input_layout2, _input_layout3, _input_layout4;
|
|
958
1019
|
const tableData = input.data[0];
|
|
959
1020
|
const normalizeHeaders = (values, header)=>{
|
|
@@ -1169,10 +1230,6 @@ function getLineOptions(line) {
|
|
|
1169
1230
|
}
|
|
1170
1231
|
return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
|
|
1171
1232
|
}
|
|
1172
|
-
const isStringArray = (arr)=>{
|
|
1173
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1174
|
-
return (0, _chartutilities.isArrayOfType)(arr, (value)=>typeof value === 'string' || value === null);
|
|
1175
|
-
};
|
|
1176
1233
|
// TODO: Use binary search to find the appropriate bin for numeric value.
|
|
1177
1234
|
const findBinIndex = (bins, value, isString)=>{
|
|
1178
1235
|
if (typeof value === 'undefined' || value === null) {
|
|
@@ -1191,7 +1248,7 @@ const createBins = (data, binStart, binEnd, binSize)=>{
|
|
|
1191
1248
|
if (!data || data.length === 0) {
|
|
1192
1249
|
return [];
|
|
1193
1250
|
}
|
|
1194
|
-
if (isStringArray(data)) {
|
|
1251
|
+
if ((0, _chartutilities.isStringArray)(data)) {
|
|
1195
1252
|
const categories = Array.from(new Set(data));
|
|
1196
1253
|
const start = typeof binStart === 'number' ? Math.ceil(binStart) : 0;
|
|
1197
1254
|
const stop = typeof binEnd === 'number' ? Math.floor(binEnd) + 1 : categories.length;
|
|
@@ -1267,7 +1324,46 @@ const precisionRound = (value, precision)=>{
|
|
|
1267
1324
|
const factor = Math.pow(10, precision);
|
|
1268
1325
|
return Math.round(value * factor) / factor;
|
|
1269
1326
|
};
|
|
1270
|
-
const
|
|
1327
|
+
const getLegendShape = (series)=>{
|
|
1328
|
+
var _series_line, _series_mode;
|
|
1329
|
+
const dashType = ((_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.dash) || 'solid';
|
|
1330
|
+
if (dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot') {
|
|
1331
|
+
return 'dottedLine';
|
|
1332
|
+
} else if ((_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('markers')) {
|
|
1333
|
+
return 'circle';
|
|
1334
|
+
}
|
|
1335
|
+
return 'default';
|
|
1336
|
+
};
|
|
1337
|
+
const getAllupLegendsProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
1338
|
+
const allupLegends = [];
|
|
1339
|
+
// reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
|
|
1340
|
+
const toShowLegend = input.data.reduce((acc, series)=>{
|
|
1341
|
+
return acc || series.showlegend === true;
|
|
1342
|
+
}, false);
|
|
1343
|
+
if (toShowLegend) {
|
|
1344
|
+
input.data.forEach((series, index)=>{
|
|
1345
|
+
var _series_line, _series_marker, _input_layout_template_layout, _input_layout_template, _input_layout;
|
|
1346
|
+
const name = series.legendgroup;
|
|
1347
|
+
const color = ((_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color) || ((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color);
|
|
1348
|
+
const legendShape = getLegendShape(series);
|
|
1349
|
+
const resolvedColor = (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, color, colorMap, isDarkTheme);
|
|
1350
|
+
if (name !== undefined && allupLegends.some((group)=>group.title === name) === false) {
|
|
1351
|
+
allupLegends.push({
|
|
1352
|
+
title: name,
|
|
1353
|
+
color: resolvedColor,
|
|
1354
|
+
shape: legendShape
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
return {
|
|
1360
|
+
legends: allupLegends,
|
|
1361
|
+
centerLegends: true,
|
|
1362
|
+
enabledWrapLines: true,
|
|
1363
|
+
canSelectMultipleLegends: true
|
|
1364
|
+
};
|
|
1365
|
+
};
|
|
1366
|
+
const getLegendProps = (data, layout, isMultiPlot)=>{
|
|
1271
1367
|
const legends = [];
|
|
1272
1368
|
if (data.length === 1) {
|
|
1273
1369
|
legends.push(data[0].name || '');
|
|
@@ -1276,10 +1372,11 @@ const getLegendProps = (data, layout)=>{
|
|
|
1276
1372
|
legends.push(series.name || `Series ${index + 1}`);
|
|
1277
1373
|
});
|
|
1278
1374
|
}
|
|
1279
|
-
const
|
|
1375
|
+
const hideLegendsData = data.every((series)=>series.showlegend === false);
|
|
1376
|
+
const hideLegendsInferred = (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false || (layout === null || layout === void 0 ? void 0 : layout.showlegend) !== true && legends.length < 2;
|
|
1280
1377
|
return {
|
|
1281
1378
|
legends,
|
|
1282
|
-
hideLegend:
|
|
1379
|
+
hideLegend: isMultiPlot || hideLegendsInferred || hideLegendsData
|
|
1283
1380
|
};
|
|
1284
1381
|
};
|
|
1285
1382
|
const getNumberAtIndexOrDefault = (data, index)=>{
|
|
@@ -1317,3 +1414,176 @@ const getValidXYRanges = (series)=>{
|
|
|
1317
1414
|
}
|
|
1318
1415
|
return ranges;
|
|
1319
1416
|
};
|
|
1417
|
+
const getIndexFromKey = (key, pattern)=>{
|
|
1418
|
+
const normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
|
|
1419
|
+
return parseInt(normalizedKey, 10) - 1;
|
|
1420
|
+
};
|
|
1421
|
+
const getGridProperties = (layout, isMultiPlot)=>{
|
|
1422
|
+
var _layout_annotations;
|
|
1423
|
+
const gridX = [];
|
|
1424
|
+
const gridY = [];
|
|
1425
|
+
const annotations = {};
|
|
1426
|
+
let templateRows = '1fr';
|
|
1427
|
+
let templateColumns = '1fr';
|
|
1428
|
+
const gridLayout = {};
|
|
1429
|
+
if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
|
|
1430
|
+
return {
|
|
1431
|
+
templateRows,
|
|
1432
|
+
templateColumns,
|
|
1433
|
+
layout: gridLayout
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
if (!layout.xaxis || !layout.yaxis) {
|
|
1437
|
+
return {
|
|
1438
|
+
templateRows,
|
|
1439
|
+
templateColumns,
|
|
1440
|
+
layout: gridLayout
|
|
1441
|
+
};
|
|
1442
|
+
}
|
|
1443
|
+
if (!isMultiPlot) {
|
|
1444
|
+
return {
|
|
1445
|
+
templateRows,
|
|
1446
|
+
templateColumns,
|
|
1447
|
+
layout: gridLayout
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
Object.keys(layout).forEach((key)=>{
|
|
1451
|
+
if (key.startsWith('xaxis')) {
|
|
1452
|
+
var _layout_key, _layout_key1;
|
|
1453
|
+
const index = getIndexFromKey(key, 'xaxis');
|
|
1454
|
+
var _layout_key_anchor;
|
|
1455
|
+
const anchor = (_layout_key_anchor = (_layout_key = layout[key]) === null || _layout_key === void 0 ? void 0 : _layout_key.anchor) !== null && _layout_key_anchor !== void 0 ? _layout_key_anchor : 'y';
|
|
1456
|
+
const anchorIndex = getIndexFromKey(anchor, 'y');
|
|
1457
|
+
if (index !== anchorIndex) {
|
|
1458
|
+
throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
|
|
1459
|
+
}
|
|
1460
|
+
var _layout_key_domain;
|
|
1461
|
+
gridX[index] = (_layout_key_domain = (_layout_key1 = layout[key]) === null || _layout_key1 === void 0 ? void 0 : _layout_key1.domain) !== null && _layout_key_domain !== void 0 ? _layout_key_domain : [];
|
|
1462
|
+
} else if (key.startsWith('yaxis')) {
|
|
1463
|
+
var _layout_key2, _layout_key3;
|
|
1464
|
+
const index = getIndexFromKey(key, 'yaxis');
|
|
1465
|
+
var _layout_key_anchor1;
|
|
1466
|
+
const anchor = (_layout_key_anchor1 = (_layout_key2 = layout[key]) === null || _layout_key2 === void 0 ? void 0 : _layout_key2.anchor) !== null && _layout_key_anchor1 !== void 0 ? _layout_key_anchor1 : 'x';
|
|
1467
|
+
const anchorIndex = getIndexFromKey(anchor, 'x');
|
|
1468
|
+
if (index !== anchorIndex) {
|
|
1469
|
+
var _layout_yaxis2;
|
|
1470
|
+
if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
|
|
1471
|
+
// Special case for secondary y axis where yaxis2 can anchor to x1
|
|
1472
|
+
return {
|
|
1473
|
+
templateRows,
|
|
1474
|
+
templateColumns
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
|
|
1478
|
+
}
|
|
1479
|
+
var _layout_key_domain1;
|
|
1480
|
+
gridY[index] = (_layout_key_domain1 = (_layout_key3 = layout[key]) === null || _layout_key3 === void 0 ? void 0 : _layout_key3.domain) !== null && _layout_key_domain1 !== void 0 ? _layout_key_domain1 : [];
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
(_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
|
|
1484
|
+
const xMatches = gridX.flatMap((interval, idx)=>(annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval[1] ? [
|
|
1485
|
+
idx
|
|
1486
|
+
] : []);
|
|
1487
|
+
const yMatch = gridY.findIndex((interval, yIndex)=>xMatches.includes(yIndex) && (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval[1]);
|
|
1488
|
+
if (yMatch !== -1) {
|
|
1489
|
+
if (annotations[yMatch] === undefined) {
|
|
1490
|
+
annotations[yMatch] = {};
|
|
1491
|
+
}
|
|
1492
|
+
if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
|
|
1493
|
+
annotations[yMatch].yAnnotation = annotation.text;
|
|
1494
|
+
} else {
|
|
1495
|
+
annotations[yMatch].xAnnotation = annotation.text;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
});
|
|
1499
|
+
if (gridX.length > 0) {
|
|
1500
|
+
const uniqueXIntervals = new Map();
|
|
1501
|
+
gridX.forEach((interval)=>{
|
|
1502
|
+
const key = `${interval[0]}-${interval[1]}`;
|
|
1503
|
+
if (!uniqueXIntervals.has(key)) {
|
|
1504
|
+
uniqueXIntervals.set(key, interval);
|
|
1505
|
+
}
|
|
1506
|
+
});
|
|
1507
|
+
const minXInterval = Math.min(...Array.from(uniqueXIntervals.values()).map((interval)=>interval[1] - interval[0]));
|
|
1508
|
+
templateColumns = Array.from(uniqueXIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minXInterval}fr`).join(' ');
|
|
1509
|
+
let columnNumber = 1;
|
|
1510
|
+
let lastIntervalEnd = 0;
|
|
1511
|
+
gridX.forEach((interval, index)=>{
|
|
1512
|
+
if (interval.length === 0) {
|
|
1513
|
+
return;
|
|
1514
|
+
}
|
|
1515
|
+
const cellName = `x${index === 0 ? '' : index + 1}`;
|
|
1516
|
+
const annotationProps = annotations[index];
|
|
1517
|
+
const xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
|
|
1518
|
+
if (interval[0] < lastIntervalEnd) {
|
|
1519
|
+
columnNumber = 1;
|
|
1520
|
+
}
|
|
1521
|
+
lastIntervalEnd = interval[1];
|
|
1522
|
+
const row = {
|
|
1523
|
+
row: -1,
|
|
1524
|
+
column: columnNumber,
|
|
1525
|
+
xAnnotation
|
|
1526
|
+
};
|
|
1527
|
+
gridLayout[cellName] = row;
|
|
1528
|
+
columnNumber += 1;
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
const numColumns = Math.max(...Object.values(gridLayout).map((cell)=>{
|
|
1532
|
+
var _cell_column;
|
|
1533
|
+
return (_cell_column = cell.column) !== null && _cell_column !== void 0 ? _cell_column : 0;
|
|
1534
|
+
}));
|
|
1535
|
+
const columnFill = {};
|
|
1536
|
+
for(let i = 1; i <= numColumns; i++){
|
|
1537
|
+
columnFill[i] = {
|
|
1538
|
+
row: 1,
|
|
1539
|
+
fillDomain: 0
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
if (gridY.length > 0) {
|
|
1543
|
+
const uniqueYIntervals = new Map();
|
|
1544
|
+
gridY.forEach((interval)=>{
|
|
1545
|
+
const key = `${interval[0]}-${interval[1]}`;
|
|
1546
|
+
if (!uniqueYIntervals.has(key)) {
|
|
1547
|
+
uniqueYIntervals.set(key, interval);
|
|
1548
|
+
}
|
|
1549
|
+
});
|
|
1550
|
+
const minYInterval = Math.min(...Array.from(uniqueYIntervals.values()).map((interval)=>interval[1] - interval[0]));
|
|
1551
|
+
templateRows = Array.from(uniqueYIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minYInterval}fr`).join(' ');
|
|
1552
|
+
gridY.forEach((interval, index)=>{
|
|
1553
|
+
if (interval.length === 0) {
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
const cellName = `x${index === 0 ? '' : index + 1}`;
|
|
1557
|
+
const annotationProps = annotations[index];
|
|
1558
|
+
const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
|
|
1559
|
+
const cell = gridLayout[cellName];
|
|
1560
|
+
if (cell !== undefined) {
|
|
1561
|
+
cell.row = columnFill[cell.column].row;
|
|
1562
|
+
cell.yAnnotation = yAnnotation;
|
|
1563
|
+
}
|
|
1564
|
+
columnFill[cell.column].fillDomain = interval[1];
|
|
1565
|
+
columnFill[cell.column].row += 1;
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
// reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
|
|
1569
|
+
const reversedGridLayout = {};
|
|
1570
|
+
// find the maximum row number
|
|
1571
|
+
const maxRowNumber = Math.max(...Object.values(gridLayout).map((cell)=>{
|
|
1572
|
+
var _cell_row;
|
|
1573
|
+
return (_cell_row = cell.row) !== null && _cell_row !== void 0 ? _cell_row : 0;
|
|
1574
|
+
}));
|
|
1575
|
+
// iterate over the gridLayout and reverse the row numbers
|
|
1576
|
+
Object.keys(gridLayout).forEach((key)=>{
|
|
1577
|
+
const cell = gridLayout[key];
|
|
1578
|
+
if (cell.row !== undefined) {
|
|
1579
|
+
// reverse the row number
|
|
1580
|
+
cell.row = maxRowNumber - cell.row + 1;
|
|
1581
|
+
}
|
|
1582
|
+
reversedGridLayout[key] = cell;
|
|
1583
|
+
});
|
|
1584
|
+
return {
|
|
1585
|
+
templateRows,
|
|
1586
|
+
templateColumns,
|
|
1587
|
+
layout: reversedGridLayout
|
|
1588
|
+
};
|
|
1589
|
+
};
|