@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
|
@@ -407,12 +407,12 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
407
407
|
};
|
|
408
408
|
exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
|
|
409
409
|
var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
|
|
410
|
-
var _a, _b, _c, _d;
|
|
410
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
411
411
|
var mapXToDataPoints = {};
|
|
412
412
|
var yMaxValue = 0;
|
|
413
413
|
var yMinValue = 0;
|
|
414
414
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
415
|
-
var
|
|
415
|
+
var _j = getLegendProps(input.data, input.layout, isMultiPlot), legends = _j.legends, hideLegend = _j.hideLegend;
|
|
416
416
|
var colorScale = undefined;
|
|
417
417
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
418
418
|
input.data.forEach(function (series, index1) {
|
|
@@ -483,8 +483,53 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
483
483
|
});
|
|
484
484
|
});
|
|
485
485
|
});
|
|
486
|
+
var xCategories = (_b = (_a = input.data[0]) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : [];
|
|
487
|
+
((_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.shapes) !== null && _d !== void 0 ? _d : [])
|
|
488
|
+
.filter(function (shape) { return shape.type === 'line'; })
|
|
489
|
+
.forEach(function (shape, shapeIdx) {
|
|
490
|
+
var _a, _b, _c;
|
|
491
|
+
var lineColor = (_a = shape.line) === null || _a === void 0 ? void 0 : _a.color;
|
|
492
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
493
|
+
var resolveX = function (val) {
|
|
494
|
+
if (typeof val === 'number' && Array.isArray(xCategories) && xCategories[val] !== undefined) {
|
|
495
|
+
return xCategories[val];
|
|
496
|
+
}
|
|
497
|
+
return val;
|
|
498
|
+
};
|
|
499
|
+
var x0Key = resolveX(shape.x0);
|
|
500
|
+
var x1Key = resolveX(shape.x1);
|
|
501
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
502
|
+
var resolveY = function (val) {
|
|
503
|
+
if (shape.yref === 'paper') {
|
|
504
|
+
if (val === 0) {
|
|
505
|
+
return yMinValue;
|
|
506
|
+
}
|
|
507
|
+
if (val === 1) {
|
|
508
|
+
return yMaxValue;
|
|
509
|
+
}
|
|
510
|
+
return yMinValue + val * (yMaxValue - yMinValue);
|
|
511
|
+
}
|
|
512
|
+
return val;
|
|
513
|
+
};
|
|
514
|
+
var y0Val = resolveY(shape.y0);
|
|
515
|
+
var y1Val = resolveY(shape.y1);
|
|
516
|
+
mapXToDataPoints[x0Key].lineData.push({
|
|
517
|
+
legend: "Reference_".concat(shapeIdx),
|
|
518
|
+
y: y0Val,
|
|
519
|
+
color: (_b = (0, d3_color_1.rgb)(lineColor).formatHex8()) !== null && _b !== void 0 ? _b : lineColor,
|
|
520
|
+
lineOptions: getLineOptions(shape.line),
|
|
521
|
+
useSecondaryYScale: false,
|
|
522
|
+
});
|
|
523
|
+
mapXToDataPoints[x1Key].lineData.push({
|
|
524
|
+
legend: "Reference_".concat(shapeIdx),
|
|
525
|
+
y: y1Val,
|
|
526
|
+
color: (_c = (0, d3_color_1.rgb)(lineColor).formatHex8()) !== null && _c !== void 0 ? _c : lineColor,
|
|
527
|
+
lineOptions: getLineOptions(shape.line),
|
|
528
|
+
useSecondaryYScale: false,
|
|
529
|
+
});
|
|
530
|
+
});
|
|
486
531
|
var vsbcData = Object.values(mapXToDataPoints);
|
|
487
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vsbcData, width: (
|
|
532
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__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));
|
|
488
533
|
};
|
|
489
534
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
490
535
|
var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -658,7 +703,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
658
703
|
};
|
|
659
704
|
exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
|
|
660
705
|
var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
|
|
661
|
-
var _a, _b, _c, _d;
|
|
706
|
+
var _a, _b, _c, _d, _e, _f;
|
|
662
707
|
var isScatterMarkers = [
|
|
663
708
|
'text',
|
|
664
709
|
'markers',
|
|
@@ -673,8 +718,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
673
718
|
var isScatterChart = chartType === 'scatter';
|
|
674
719
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
675
720
|
var mode = 'tonexty';
|
|
676
|
-
var
|
|
721
|
+
var _g = getLegendProps(input.data, input.layout, isMultiPlot), legends = _g.legends, hideLegend = _g.hideLegend;
|
|
677
722
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
723
|
+
var shouldWrapLabels = false;
|
|
678
724
|
var chartData = input.data
|
|
679
725
|
.map(function (series, index) {
|
|
680
726
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
@@ -690,6 +736,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
690
736
|
var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
|
|
691
737
|
var isXNumber = (0, chart_utilities_1.isNumberArray)(xValues);
|
|
692
738
|
var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
|
|
739
|
+
shouldWrapLabels = shouldWrapLabels || (isXString && !isXDate);
|
|
693
740
|
var legend = legends[index];
|
|
694
741
|
// resolve color for each legend's lines from the extracted colors
|
|
695
742
|
var seriesColor = (0, PlotlyColorAdapter_1.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);
|
|
@@ -741,6 +788,22 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
741
788
|
});
|
|
742
789
|
})
|
|
743
790
|
.flat();
|
|
791
|
+
var lineShape = ((_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.shapes) !== null && _c !== void 0 ? _c : [])
|
|
792
|
+
.filter(function (shape) { return shape.type === 'line'; })
|
|
793
|
+
.map(function (shape, shapeIdx) {
|
|
794
|
+
var _a, _b;
|
|
795
|
+
var lineColor = (_a = shape.line) === null || _a === void 0 ? void 0 : _a.color;
|
|
796
|
+
return {
|
|
797
|
+
legend: "Reference_".concat(shapeIdx),
|
|
798
|
+
data: [
|
|
799
|
+
{ x: shape.x0, y: shape.y0 },
|
|
800
|
+
{ x: shape.x1, y: shape.y1 },
|
|
801
|
+
],
|
|
802
|
+
color: (_b = (0, d3_color_1.rgb)(lineColor).formatHex8()) !== null && _b !== void 0 ? _b : lineColor,
|
|
803
|
+
lineOptions: getLineOptions(shape.line),
|
|
804
|
+
useSecondaryYScale: false,
|
|
805
|
+
};
|
|
806
|
+
});
|
|
744
807
|
var yMinMax = getYMinMaxValues(input.data[0], input.layout);
|
|
745
808
|
if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
|
|
746
809
|
var yMinMaxValues = (0, utilities_1.findNumericMinMaxOfY)(chartData);
|
|
@@ -749,12 +812,12 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
749
812
|
}
|
|
750
813
|
var numDataPoints = chartData.reduce(function (total, lineChartPoints) { return total + lineChartPoints.data.length; }, 0);
|
|
751
814
|
var chartProps = {
|
|
752
|
-
lineChartData: chartData,
|
|
815
|
+
lineChartData: tslib_1.__spreadArray(tslib_1.__spreadArray([], chartData, true), lineShape, true),
|
|
753
816
|
};
|
|
754
817
|
var scatterChartProps = {
|
|
755
818
|
scatterChartData: chartData,
|
|
756
819
|
};
|
|
757
|
-
var commonProps = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ supportNegativeData: true }, secondaryYAxisValues), { width: (
|
|
820
|
+
var commonProps = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__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));
|
|
758
821
|
if (isAreaChart) {
|
|
759
822
|
return tslib_1.__assign({ data: chartProps, mode: mode }, commonProps);
|
|
760
823
|
}
|