@fluentui/react-charting 5.24.33 → 5.24.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +51 -1
- package/CHANGELOG.md +21 -2
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +70 -7
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +70 -7
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +70 -7
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/package.json +2 -5
- package/project.json +1 -155
|
@@ -409,12 +409,12 @@ export var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, color
|
|
|
409
409
|
};
|
|
410
410
|
};
|
|
411
411
|
export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
|
|
412
|
-
var _a, _b, _c, _d;
|
|
412
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
413
413
|
var mapXToDataPoints = {};
|
|
414
414
|
var yMaxValue = 0;
|
|
415
415
|
var yMinValue = 0;
|
|
416
416
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
417
|
-
var
|
|
417
|
+
var _j = getLegendProps(input.data, input.layout, isMultiPlot), legends = _j.legends, hideLegend = _j.hideLegend;
|
|
418
418
|
var colorScale = undefined;
|
|
419
419
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
420
420
|
input.data.forEach(function (series, index1) {
|
|
@@ -485,8 +485,53 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
|
|
|
485
485
|
});
|
|
486
486
|
});
|
|
487
487
|
});
|
|
488
|
+
var xCategories = (_b = (_a = input.data[0]) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : [];
|
|
489
|
+
((_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.shapes) !== null && _d !== void 0 ? _d : [])
|
|
490
|
+
.filter(function (shape) { return shape.type === 'line'; })
|
|
491
|
+
.forEach(function (shape, shapeIdx) {
|
|
492
|
+
var _a, _b, _c;
|
|
493
|
+
var lineColor = (_a = shape.line) === null || _a === void 0 ? void 0 : _a.color;
|
|
494
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
495
|
+
var resolveX = function (val) {
|
|
496
|
+
if (typeof val === 'number' && Array.isArray(xCategories) && xCategories[val] !== undefined) {
|
|
497
|
+
return xCategories[val];
|
|
498
|
+
}
|
|
499
|
+
return val;
|
|
500
|
+
};
|
|
501
|
+
var x0Key = resolveX(shape.x0);
|
|
502
|
+
var x1Key = resolveX(shape.x1);
|
|
503
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
504
|
+
var resolveY = function (val) {
|
|
505
|
+
if (shape.yref === 'paper') {
|
|
506
|
+
if (val === 0) {
|
|
507
|
+
return yMinValue;
|
|
508
|
+
}
|
|
509
|
+
if (val === 1) {
|
|
510
|
+
return yMaxValue;
|
|
511
|
+
}
|
|
512
|
+
return yMinValue + val * (yMaxValue - yMinValue);
|
|
513
|
+
}
|
|
514
|
+
return val;
|
|
515
|
+
};
|
|
516
|
+
var y0Val = resolveY(shape.y0);
|
|
517
|
+
var y1Val = resolveY(shape.y1);
|
|
518
|
+
mapXToDataPoints[x0Key].lineData.push({
|
|
519
|
+
legend: "Reference_".concat(shapeIdx),
|
|
520
|
+
y: y0Val,
|
|
521
|
+
color: (_b = rgb(lineColor).formatHex8()) !== null && _b !== void 0 ? _b : lineColor,
|
|
522
|
+
lineOptions: getLineOptions(shape.line),
|
|
523
|
+
useSecondaryYScale: false,
|
|
524
|
+
});
|
|
525
|
+
mapXToDataPoints[x1Key].lineData.push({
|
|
526
|
+
legend: "Reference_".concat(shapeIdx),
|
|
527
|
+
y: y1Val,
|
|
528
|
+
color: (_c = rgb(lineColor).formatHex8()) !== null && _c !== void 0 ? _c : lineColor,
|
|
529
|
+
lineOptions: getLineOptions(shape.line),
|
|
530
|
+
useSecondaryYScale: false,
|
|
531
|
+
});
|
|
532
|
+
});
|
|
488
533
|
var vsbcData = Object.values(mapXToDataPoints);
|
|
489
|
-
return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ data: vsbcData, width: (
|
|
534
|
+
return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ data: vsbcData, width: (_e = input.layout) === null || _e === void 0 ? void 0 : _e.width, height: (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_h = vsbcData[0]) === null || _h === void 0 ? void 0 : _h.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getBarProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout));
|
|
490
535
|
};
|
|
491
536
|
export var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
492
537
|
var _a, _b, _c;
|
|
@@ -654,7 +699,7 @@ export var transformPlotlyJsonToScatterChartProps = function (input, isMultiPlot
|
|
|
654
699
|
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
|
|
655
700
|
};
|
|
656
701
|
var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
|
|
657
|
-
var _a, _b, _c, _d;
|
|
702
|
+
var _a, _b, _c, _d, _e, _f;
|
|
658
703
|
var isScatterMarkers = [
|
|
659
704
|
'text',
|
|
660
705
|
'markers',
|
|
@@ -669,8 +714,9 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
669
714
|
var isScatterChart = chartType === 'scatter';
|
|
670
715
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
671
716
|
var mode = 'tonexty';
|
|
672
|
-
var
|
|
717
|
+
var _g = getLegendProps(input.data, input.layout, isMultiPlot), legends = _g.legends, hideLegend = _g.hideLegend;
|
|
673
718
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
719
|
+
var shouldWrapLabels = false;
|
|
674
720
|
var chartData = input.data
|
|
675
721
|
.map(function (series, index) {
|
|
676
722
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
@@ -686,6 +732,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
686
732
|
var isXDate = isDateArray(xValues);
|
|
687
733
|
var isXNumber = isNumberArray(xValues);
|
|
688
734
|
var isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
|
|
735
|
+
shouldWrapLabels = shouldWrapLabels || (isXString && !isXDate);
|
|
689
736
|
var legend = legends[index];
|
|
690
737
|
// resolve color for each legend's lines from the extracted colors
|
|
691
738
|
var seriesColor = resolveColor(extractedColors, index, legend, colorMap, (_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, isDarkTheme);
|
|
@@ -737,6 +784,22 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
737
784
|
});
|
|
738
785
|
})
|
|
739
786
|
.flat();
|
|
787
|
+
var lineShape = ((_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.shapes) !== null && _c !== void 0 ? _c : [])
|
|
788
|
+
.filter(function (shape) { return shape.type === 'line'; })
|
|
789
|
+
.map(function (shape, shapeIdx) {
|
|
790
|
+
var _a, _b;
|
|
791
|
+
var lineColor = (_a = shape.line) === null || _a === void 0 ? void 0 : _a.color;
|
|
792
|
+
return {
|
|
793
|
+
legend: "Reference_".concat(shapeIdx),
|
|
794
|
+
data: [
|
|
795
|
+
{ x: shape.x0, y: shape.y0 },
|
|
796
|
+
{ x: shape.x1, y: shape.y1 },
|
|
797
|
+
],
|
|
798
|
+
color: (_b = rgb(lineColor).formatHex8()) !== null && _b !== void 0 ? _b : lineColor,
|
|
799
|
+
lineOptions: getLineOptions(shape.line),
|
|
800
|
+
useSecondaryYScale: false,
|
|
801
|
+
};
|
|
802
|
+
});
|
|
740
803
|
var yMinMax = getYMinMaxValues(input.data[0], input.layout);
|
|
741
804
|
if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
|
|
742
805
|
var yMinMaxValues = findNumericMinMaxOfY(chartData);
|
|
@@ -745,12 +808,12 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
745
808
|
}
|
|
746
809
|
var numDataPoints = chartData.reduce(function (total, lineChartPoints) { return total + lineChartPoints.data.length; }, 0);
|
|
747
810
|
var chartProps = {
|
|
748
|
-
lineChartData: chartData,
|
|
811
|
+
lineChartData: __spreadArray(__spreadArray([], chartData, true), lineShape, true),
|
|
749
812
|
};
|
|
750
813
|
var scatterChartProps = {
|
|
751
814
|
scatterChartData: chartData,
|
|
752
815
|
};
|
|
753
|
-
var commonProps = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ supportNegativeData: true }, secondaryYAxisValues), { width: (
|
|
816
|
+
var commonProps = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ supportNegativeData: true }, secondaryYAxisValues), { width: (_d = input.layout) === null || _d === void 0 ? void 0 : _d.width, height: (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : 350, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000, shouldWrapLabels: shouldWrapLabels }), getTitles(input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getAxisScaleTypeProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout));
|
|
754
817
|
if (isAreaChart) {
|
|
755
818
|
return __assign({ data: chartProps, mode: mode }, commonProps);
|
|
756
819
|
}
|