@fluentui/react-charts 0.0.0-nightly-20250820-0406.1 → 0.0.0-nightly-20250822-0407.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 +48 -15
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +144 -65
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +23 -4
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +4 -2
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +27 -4
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +61 -44
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +143 -64
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -3
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +4 -2
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +26 -3
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +60 -43
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/package.json +12 -12
|
@@ -132,6 +132,47 @@ function getTitles(layout) {
|
|
|
132
132
|
};
|
|
133
133
|
return titles;
|
|
134
134
|
}
|
|
135
|
+
const getXAxisTickFormat = (series, layout)=>{
|
|
136
|
+
const xAxis = getXAxisProperties(series, layout);
|
|
137
|
+
if (xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat) {
|
|
138
|
+
return {
|
|
139
|
+
tickFormat: xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return {};
|
|
143
|
+
};
|
|
144
|
+
const getYAxisTickFormat = (series, layout)=>{
|
|
145
|
+
const yAxis = getYAxisProperties(series, layout);
|
|
146
|
+
if (yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat) {
|
|
147
|
+
return {
|
|
148
|
+
yAxisTickFormat: (0, _d3format.format)(yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return {};
|
|
152
|
+
};
|
|
153
|
+
const getYMinMaxValues = (series, layout)=>{
|
|
154
|
+
var _getYAxisProperties;
|
|
155
|
+
const range = (_getYAxisProperties = getYAxisProperties(series, layout)) === null || _getYAxisProperties === void 0 ? void 0 : _getYAxisProperties.range;
|
|
156
|
+
if (range && range.length === 2) {
|
|
157
|
+
return {
|
|
158
|
+
yMinValue: range[0],
|
|
159
|
+
yMaxValue: range[1]
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return {};
|
|
163
|
+
};
|
|
164
|
+
const getYAxisProperties = (series, layout)=>{
|
|
165
|
+
return layout === null || layout === void 0 ? void 0 : layout.yaxis;
|
|
166
|
+
};
|
|
167
|
+
const getXAxisProperties = (series, layout)=>{
|
|
168
|
+
return layout === null || layout === void 0 ? void 0 : layout.xaxis;
|
|
169
|
+
};
|
|
170
|
+
const getFormattedCalloutYData = (yVal, yAxisFormat)=>{
|
|
171
|
+
if (typeof (yAxisFormat === null || yAxisFormat === void 0 ? void 0 : yAxisFormat.yAxisTickFormat) === 'function' && typeof yVal === 'number') {
|
|
172
|
+
return yAxisFormat.yAxisTickFormat(yVal);
|
|
173
|
+
}
|
|
174
|
+
return (0, _chartutilities.formatToLocaleString)(yVal);
|
|
175
|
+
};
|
|
135
176
|
const correctYearMonth = (xValues)=>{
|
|
136
177
|
const presentYear = new Date().getFullYear();
|
|
137
178
|
if (xValues.length > 0 && Array.isArray(xValues[0])) {
|
|
@@ -294,6 +335,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
294
335
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
295
336
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
296
337
|
let colorScale = undefined;
|
|
338
|
+
const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
297
339
|
let yMinValue = 0;
|
|
298
340
|
input.data.forEach((series, index1)=>{
|
|
299
341
|
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, _input_layout_template_layout1, _input_layout_template1, _input_layout2, _series_line;
|
|
@@ -327,6 +369,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
327
369
|
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
370
|
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
|
|
329
371
|
const yVal = rangeYValues[index2];
|
|
372
|
+
const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
|
|
330
373
|
if (series.type === 'bar') {
|
|
331
374
|
var _rgb_copy_formatHex8;
|
|
332
375
|
mapXToDataPoints[x].chartData.push({
|
|
@@ -334,7 +377,8 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
334
377
|
data: yVal,
|
|
335
378
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
336
379
|
opacity
|
|
337
|
-
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
380
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
381
|
+
yAxisCalloutData
|
|
338
382
|
});
|
|
339
383
|
if (typeof yVal === 'number') {
|
|
340
384
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
@@ -356,7 +400,8 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
356
400
|
...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
|
|
357
401
|
mode: series.mode
|
|
358
402
|
},
|
|
359
|
-
useSecondaryYScale: usesSecondaryYScale(series, input.layout)
|
|
403
|
+
useSecondaryYScale: usesSecondaryYScale(series, input.layout),
|
|
404
|
+
yAxisCalloutData
|
|
360
405
|
});
|
|
361
406
|
if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
|
|
362
407
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
@@ -367,7 +412,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
367
412
|
});
|
|
368
413
|
});
|
|
369
414
|
});
|
|
370
|
-
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
371
415
|
const vsbcData = Object.values(mapXToDataPoints);
|
|
372
416
|
var _input_layout_height;
|
|
373
417
|
return {
|
|
@@ -377,9 +421,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
377
421
|
barWidth: 'auto',
|
|
378
422
|
yMaxValue,
|
|
379
423
|
yMinValue,
|
|
380
|
-
chartTitle,
|
|
381
|
-
xAxisTitle,
|
|
382
|
-
yAxisTitle,
|
|
383
424
|
mode: 'plotly',
|
|
384
425
|
...secondaryYAxisValues,
|
|
385
426
|
wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
|
|
@@ -389,7 +430,11 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
389
430
|
roundCorners: true,
|
|
390
431
|
showYAxisLables: true,
|
|
391
432
|
noOfCharsToTruncate: 20,
|
|
392
|
-
showYAxisLablesTooltip: true
|
|
433
|
+
showYAxisLablesTooltip: true,
|
|
434
|
+
...getTitles(input.layout),
|
|
435
|
+
...getXAxisTickFormat(input.data[0], input.layout),
|
|
436
|
+
...yAxisTickFormat,
|
|
437
|
+
...getAxisCategoryOrderProps(input.data, input.layout)
|
|
393
438
|
};
|
|
394
439
|
};
|
|
395
440
|
const createColorScale = (layout, series)=>{
|
|
@@ -412,6 +457,7 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
412
457
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
|
|
413
458
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
414
459
|
let colorScale = undefined;
|
|
460
|
+
const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
415
461
|
input.data.forEach((series, index1)=>{
|
|
416
462
|
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
463
|
if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_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[0]) === 'number') {
|
|
@@ -434,23 +480,24 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
434
480
|
var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
|
|
435
481
|
const legend = legends[index1];
|
|
436
482
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
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,
|
|
483
|
+
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, index2, legend, colorMap, isDarkTheme);
|
|
438
484
|
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
|
|
485
|
+
const yVal = series.y[index2];
|
|
439
486
|
var _rgb_copy_formatHex8;
|
|
440
487
|
mapXToDataPoints[x].series.push({
|
|
441
488
|
key: legend,
|
|
442
|
-
data:
|
|
489
|
+
data: yVal,
|
|
443
490
|
xAxisCalloutData: x,
|
|
444
491
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
445
492
|
opacity
|
|
446
493
|
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
447
494
|
legend,
|
|
448
|
-
useSecondaryYScale: usesSecondaryYScale(series, input.layout)
|
|
495
|
+
useSecondaryYScale: usesSecondaryYScale(series, input.layout),
|
|
496
|
+
yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
|
|
449
497
|
});
|
|
450
498
|
}
|
|
451
499
|
});
|
|
452
500
|
});
|
|
453
|
-
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
454
501
|
const gvbcData = Object.values(mapXToDataPoints);
|
|
455
502
|
var _input_layout_height;
|
|
456
503
|
return {
|
|
@@ -458,15 +505,17 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
458
505
|
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
459
506
|
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,
|
|
460
507
|
barWidth: 'auto',
|
|
461
|
-
chartTitle,
|
|
462
|
-
xAxisTitle,
|
|
463
|
-
yAxisTitle,
|
|
464
508
|
mode: 'plotly',
|
|
465
509
|
...secondaryYAxisValues,
|
|
466
510
|
hideTickOverlap: true,
|
|
467
511
|
wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
|
|
468
512
|
hideLegend,
|
|
469
|
-
roundCorners: true
|
|
513
|
+
roundCorners: true,
|
|
514
|
+
...getTitles(input.layout),
|
|
515
|
+
...getYMinMaxValues(input.data[0], input.layout),
|
|
516
|
+
...getXAxisTickFormat(input.data[0], input.layout),
|
|
517
|
+
...yAxisTickFormat,
|
|
518
|
+
...getAxisCategoryOrderProps(input.data, input.layout)
|
|
470
519
|
};
|
|
471
520
|
};
|
|
472
521
|
const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -532,21 +581,20 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
|
|
|
532
581
|
});
|
|
533
582
|
});
|
|
534
583
|
});
|
|
535
|
-
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
536
584
|
var _input_layout_height;
|
|
537
585
|
return {
|
|
538
586
|
data: vbcData,
|
|
539
587
|
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
540
588
|
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,
|
|
541
|
-
chartTitle,
|
|
542
|
-
xAxisTitle,
|
|
543
|
-
yAxisTitle,
|
|
544
589
|
mode: 'histogram',
|
|
545
590
|
hideTickOverlap: true,
|
|
546
591
|
wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
|
|
547
592
|
maxBarWidth: 50,
|
|
548
593
|
hideLegend,
|
|
549
|
-
roundCorners: true
|
|
594
|
+
roundCorners: true,
|
|
595
|
+
...getTitles(input.layout),
|
|
596
|
+
...getYMinMaxValues(input.data[0], input.layout),
|
|
597
|
+
...getAxisCategoryOrderProps(input.data, input.layout)
|
|
550
598
|
};
|
|
551
599
|
};
|
|
552
600
|
const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -559,7 +607,7 @@ const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, co
|
|
|
559
607
|
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
|
|
560
608
|
};
|
|
561
609
|
const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
|
|
562
|
-
var _input_data_;
|
|
610
|
+
var _input_data_, _input_layout, _input_layout1;
|
|
563
611
|
const isScatterMarkers = [
|
|
564
612
|
'markers',
|
|
565
613
|
'text+markers',
|
|
@@ -573,6 +621,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
573
621
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
|
|
574
622
|
let mode = 'tonexty';
|
|
575
623
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
624
|
+
const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
576
625
|
const chartData = input.data.map((series, index)=>{
|
|
577
626
|
var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
|
|
578
627
|
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;
|
|
@@ -613,7 +662,8 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
613
662
|
} : {},
|
|
614
663
|
...textValues ? {
|
|
615
664
|
text: textValues[i]
|
|
616
|
-
} : {}
|
|
665
|
+
} : {},
|
|
666
|
+
yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat)
|
|
617
667
|
};
|
|
618
668
|
}),
|
|
619
669
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(seriesColor).copy({
|
|
@@ -627,52 +677,45 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
627
677
|
};
|
|
628
678
|
});
|
|
629
679
|
}).flat();
|
|
630
|
-
const
|
|
631
|
-
|
|
680
|
+
const yMinMax = getYMinMaxValues(input.data[0], input.layout);
|
|
681
|
+
if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
|
|
682
|
+
const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
|
|
683
|
+
yMinMax.yMinValue = yMinMaxValues.startValue;
|
|
684
|
+
yMinMax.yMaxValue = yMinMaxValues.endValue;
|
|
685
|
+
}
|
|
632
686
|
const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
|
|
633
687
|
const chartProps = {
|
|
634
|
-
chartTitle,
|
|
635
688
|
lineChartData: chartData
|
|
636
689
|
};
|
|
637
690
|
const scatterChartProps = {
|
|
638
|
-
chartTitle,
|
|
639
691
|
scatterChartData: chartData
|
|
640
692
|
};
|
|
693
|
+
var _input_layout_height;
|
|
694
|
+
const commonProps = {
|
|
695
|
+
supportNegativeData: true,
|
|
696
|
+
...secondaryYAxisValues,
|
|
697
|
+
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
698
|
+
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,
|
|
699
|
+
hideTickOverlap: true,
|
|
700
|
+
hideLegend,
|
|
701
|
+
useUTC: false,
|
|
702
|
+
optimizeLargeData: numDataPoints > 1000,
|
|
703
|
+
...getTitles(input.layout),
|
|
704
|
+
...getXAxisTickFormat(input.data[0], input.layout),
|
|
705
|
+
...yAxisTickFormat
|
|
706
|
+
};
|
|
641
707
|
if (isAreaChart) {
|
|
642
|
-
var _input_layout, _input_layout1;
|
|
643
|
-
var _input_layout_height;
|
|
644
708
|
return {
|
|
645
709
|
data: chartProps,
|
|
646
|
-
supportNegativeData: true,
|
|
647
|
-
xAxisTitle,
|
|
648
|
-
yAxisTitle,
|
|
649
|
-
...secondaryYAxisValues,
|
|
650
710
|
mode,
|
|
651
|
-
|
|
652
|
-
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,
|
|
653
|
-
hideTickOverlap: true,
|
|
654
|
-
useUTC: false,
|
|
655
|
-
hideLegend,
|
|
656
|
-
optimizeLargeData: numDataPoints > 1000
|
|
711
|
+
...commonProps
|
|
657
712
|
};
|
|
658
713
|
} else {
|
|
659
|
-
var _input_layout2, _input_layout3;
|
|
660
|
-
var _input_layout_height1;
|
|
661
714
|
return {
|
|
662
715
|
data: isScatterChart ? scatterChartProps : chartProps,
|
|
663
|
-
supportNegativeData: true,
|
|
664
|
-
xAxisTitle,
|
|
665
|
-
yAxisTitle,
|
|
666
|
-
...secondaryYAxisValues,
|
|
667
716
|
roundedTicks: true,
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
|
|
671
|
-
height: (_input_layout_height1 = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height1 !== void 0 ? _input_layout_height1 : 350,
|
|
672
|
-
hideTickOverlap: true,
|
|
673
|
-
useUTC: false,
|
|
674
|
-
hideLegend,
|
|
675
|
-
optimizeLargeData: numDataPoints > 1000
|
|
717
|
+
...commonProps,
|
|
718
|
+
...yMinMax
|
|
676
719
|
};
|
|
677
720
|
}
|
|
678
721
|
};
|
|
@@ -706,8 +749,7 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
|
|
|
706
749
|
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
707
750
|
};
|
|
708
751
|
}).filter((point)=>point !== null);
|
|
709
|
-
}).
|
|
710
|
-
.reverse();
|
|
752
|
+
}).flat();
|
|
711
753
|
var _input_layout_height;
|
|
712
754
|
const chartHeight = (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 450;
|
|
713
755
|
var _input_layout_margin_l;
|
|
@@ -719,12 +761,8 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
|
|
|
719
761
|
const scalingFactor = 0.01;
|
|
720
762
|
const gapFactor = 1 / (1 + scalingFactor * numberOfRows);
|
|
721
763
|
const barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
|
|
722
|
-
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
723
764
|
return {
|
|
724
765
|
data: chartData,
|
|
725
|
-
chartTitle,
|
|
726
|
-
xAxisTitle,
|
|
727
|
-
yAxisTitle,
|
|
728
766
|
secondaryYAxistitle: typeof ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_yaxis2 = _input_layout3.yaxis2) === null || _input_layout_yaxis2 === void 0 ? void 0 : _input_layout_yaxis2.title) === 'string' ? (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_yaxis21 = _input_layout4.yaxis2) === null || _input_layout_yaxis21 === void 0 ? void 0 : _input_layout_yaxis21.title : ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_yaxis22 = _input_layout5.yaxis2) === null || _input_layout_yaxis22 === void 0 ? void 0 : (_input_layout_yaxis2_title = _input_layout_yaxis22.title) === null || _input_layout_yaxis2_title === void 0 ? void 0 : _input_layout_yaxis2_title.text) || '',
|
|
729
767
|
barHeight,
|
|
730
768
|
showYAxisLables: true,
|
|
@@ -734,7 +772,9 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
|
|
|
734
772
|
noOfCharsToTruncate: 20,
|
|
735
773
|
showYAxisLablesTooltip: true,
|
|
736
774
|
hideLegend,
|
|
737
|
-
roundCorners: true
|
|
775
|
+
roundCorners: true,
|
|
776
|
+
...getTitles(input.layout),
|
|
777
|
+
...getAxisCategoryOrderProps(input.data, input.layout)
|
|
738
778
|
};
|
|
739
779
|
};
|
|
740
780
|
const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -847,7 +887,6 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
847
887
|
}
|
|
848
888
|
const domainValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
|
|
849
889
|
const rangeValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[1]) : defaultRange;
|
|
850
|
-
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
851
890
|
var _input_layout_height;
|
|
852
891
|
return {
|
|
853
892
|
data: [
|
|
@@ -857,16 +896,17 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
857
896
|
rangeValuesForColorScale,
|
|
858
897
|
hideLegend: true,
|
|
859
898
|
showYAxisLables: true,
|
|
860
|
-
chartTitle,
|
|
861
|
-
xAxisTitle,
|
|
862
|
-
yAxisTitle,
|
|
863
899
|
sortOrder: 'none',
|
|
864
900
|
width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
|
|
865
901
|
height: (_input_layout_height = (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
866
902
|
hideTickOverlap: true,
|
|
867
903
|
noOfCharsToTruncate: 20,
|
|
868
904
|
showYAxisLablesTooltip: true,
|
|
869
|
-
wrapXAxisLables: true
|
|
905
|
+
wrapXAxisLables: true,
|
|
906
|
+
...getTitles(input.layout),
|
|
907
|
+
...getAxisCategoryOrderProps([
|
|
908
|
+
firstData
|
|
909
|
+
], input.layout)
|
|
870
910
|
};
|
|
871
911
|
};
|
|
872
912
|
const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -1587,3 +1627,42 @@ const getGridProperties = (layout, isMultiPlot)=>{
|
|
|
1587
1627
|
layout: reversedGridLayout
|
|
1588
1628
|
};
|
|
1589
1629
|
};
|
|
1630
|
+
/**
|
|
1631
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
|
|
1632
|
+
*/ const getAxisCategoryOrderProps = (data, layout)=>{
|
|
1633
|
+
const result = {};
|
|
1634
|
+
const axesById = {
|
|
1635
|
+
x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
|
|
1636
|
+
y: layout === null || layout === void 0 ? void 0 : layout.yaxis
|
|
1637
|
+
};
|
|
1638
|
+
Object.keys(axesById).forEach((axId)=>{
|
|
1639
|
+
const ax = axesById[axId];
|
|
1640
|
+
const axLetter = axId[0];
|
|
1641
|
+
const propName = `${axLetter}AxisCategoryOrder`;
|
|
1642
|
+
const values = [];
|
|
1643
|
+
data.forEach((series)=>{
|
|
1644
|
+
var _series_axLetter;
|
|
1645
|
+
(_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
|
|
1646
|
+
if (!(0, _chartutilities.isInvalidValue)(val)) {
|
|
1647
|
+
values.push(val);
|
|
1648
|
+
}
|
|
1649
|
+
});
|
|
1650
|
+
});
|
|
1651
|
+
const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || (0, _chartutilities.isStringArray)(values) && !(0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isDateArray)(values);
|
|
1652
|
+
if (!isAxisTypeCategory) {
|
|
1653
|
+
return;
|
|
1654
|
+
}
|
|
1655
|
+
const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
|
|
1656
|
+
if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
|
|
1657
|
+
result[propName] = ax.categoryarray;
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
|
|
1661
|
+
const categoriesInTraceOrder = Array.from(new Set(values));
|
|
1662
|
+
result[propName] = categoriesInTraceOrder;
|
|
1663
|
+
return;
|
|
1664
|
+
}
|
|
1665
|
+
result[propName] = ax.categoryorder;
|
|
1666
|
+
});
|
|
1667
|
+
return result;
|
|
1668
|
+
};
|