@fluentui/react-charts 0.0.0-nightly-20251020-1611.1 → 0.0.0-nightly-20251021-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/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +71 -9
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +71 -9
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/package.json +12 -12
|
@@ -580,7 +580,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
580
580
|
((_input_layout_shapes = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.shapes) !== null && _input_layout_shapes !== void 0 ? _input_layout_shapes : []).filter((shape)=>shape.type === 'line').forEach((shape, shapeIdx)=>{
|
|
581
581
|
var _shape_line;
|
|
582
582
|
const lineColor = (_shape_line = shape.line) === null || _shape_line === void 0 ? void 0 : _shape_line.color;
|
|
583
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
584
583
|
const resolveX = (val)=>{
|
|
585
584
|
if (typeof val === 'number' && Array.isArray(xCategories) && xCategories[val] !== undefined) {
|
|
586
585
|
return xCategories[val];
|
|
@@ -589,7 +588,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
589
588
|
};
|
|
590
589
|
const x0Key = resolveX(shape.x0);
|
|
591
590
|
const x1Key = resolveX(shape.x1);
|
|
592
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
593
591
|
const resolveY = (val)=>{
|
|
594
592
|
if (shape.yref === 'paper') {
|
|
595
593
|
if (val === 0) {
|
|
@@ -598,7 +596,10 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
598
596
|
if (val === 1) {
|
|
599
597
|
return yMaxValue;
|
|
600
598
|
}
|
|
601
|
-
|
|
599
|
+
if (typeof val === 'number') {
|
|
600
|
+
return yMinValue + val * (yMaxValue - yMinValue);
|
|
601
|
+
}
|
|
602
|
+
return val;
|
|
602
603
|
}
|
|
603
604
|
return val;
|
|
604
605
|
};
|
|
@@ -861,8 +862,29 @@ const transformPlotlyJsonToLineChartProps = (input, isMultiPlot, colorMap, color
|
|
|
861
862
|
const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
862
863
|
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
|
|
863
864
|
};
|
|
865
|
+
const mapColorFillBars = (layout)=>{
|
|
866
|
+
if (!Array.isArray(layout === null || layout === void 0 ? void 0 : layout.shapes)) {
|
|
867
|
+
return [];
|
|
868
|
+
}
|
|
869
|
+
return layout.shapes.filter((shape)=>shape.type === 'rect').map((shape)=>{
|
|
870
|
+
//colorFillbars doesn't support string dates or categories
|
|
871
|
+
if (typeof shape.x0 === 'string' || typeof shape.x1 === 'string') {
|
|
872
|
+
return null;
|
|
873
|
+
}
|
|
874
|
+
return {
|
|
875
|
+
color: shape.fillcolor,
|
|
876
|
+
data: [
|
|
877
|
+
{
|
|
878
|
+
startX: shape.x0,
|
|
879
|
+
endX: shape.x1
|
|
880
|
+
}
|
|
881
|
+
],
|
|
882
|
+
applyPattern: false
|
|
883
|
+
};
|
|
884
|
+
});
|
|
885
|
+
};
|
|
864
886
|
const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
|
|
865
|
-
var _input_data_, _input_layout, _input_layout1, _input_layout2;
|
|
887
|
+
var _input_data_, _chartData__data_, _chartData_, _chartData__data_1, _chartData_1, _chartData__data_2, _chartData_2, _chartData__data_3, _chartData_3, _input_layout, _input_layout1, _input_layout2;
|
|
866
888
|
const isScatterMarkers = [
|
|
867
889
|
'text',
|
|
868
890
|
'markers',
|
|
@@ -946,21 +968,55 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
946
968
|
};
|
|
947
969
|
});
|
|
948
970
|
}).flat();
|
|
971
|
+
const xMinValue = (_chartData_ = chartData[0]) === null || _chartData_ === void 0 ? void 0 : (_chartData__data_ = _chartData_.data[0]) === null || _chartData__data_ === void 0 ? void 0 : _chartData__data_.x;
|
|
972
|
+
const xMaxValue = (_chartData_1 = chartData[0]) === null || _chartData_1 === void 0 ? void 0 : (_chartData__data_1 = _chartData_1.data[chartData[0].data.length - 1]) === null || _chartData__data_1 === void 0 ? void 0 : _chartData__data_1.x;
|
|
973
|
+
const yMinValue = (_chartData_2 = chartData[0]) === null || _chartData_2 === void 0 ? void 0 : (_chartData__data_2 = _chartData_2.data[0]) === null || _chartData__data_2 === void 0 ? void 0 : _chartData__data_2.y;
|
|
974
|
+
const yMaxValue = (_chartData_3 = chartData[0]) === null || _chartData_3 === void 0 ? void 0 : (_chartData__data_3 = _chartData_3.data[chartData[0].data.length - 1]) === null || _chartData__data_3 === void 0 ? void 0 : _chartData__data_3.y;
|
|
949
975
|
var _input_layout_shapes;
|
|
950
976
|
const lineShape = ((_input_layout_shapes = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.shapes) !== null && _input_layout_shapes !== void 0 ? _input_layout_shapes : []).filter((shape)=>shape.type === 'line').map((shape, shapeIdx)=>{
|
|
951
977
|
var _shape_line;
|
|
952
978
|
const lineColor = (_shape_line = shape.line) === null || _shape_line === void 0 ? void 0 : _shape_line.color;
|
|
979
|
+
const resolveX = (val)=>{
|
|
980
|
+
if (shape.xref === 'paper') {
|
|
981
|
+
if (val === 0) {
|
|
982
|
+
return xMinValue;
|
|
983
|
+
}
|
|
984
|
+
if (val === 1) {
|
|
985
|
+
return xMaxValue;
|
|
986
|
+
}
|
|
987
|
+
if (typeof val === 'number' && typeof xMinValue === 'number' && typeof xMaxValue === 'number') {
|
|
988
|
+
return xMinValue + val * (xMaxValue - xMinValue);
|
|
989
|
+
}
|
|
990
|
+
return val;
|
|
991
|
+
}
|
|
992
|
+
return val;
|
|
993
|
+
};
|
|
994
|
+
const resolveY = (val)=>{
|
|
995
|
+
if (shape.yref === 'paper') {
|
|
996
|
+
if (val === 0) {
|
|
997
|
+
return yMinValue;
|
|
998
|
+
}
|
|
999
|
+
if (val === 1) {
|
|
1000
|
+
return yMaxValue;
|
|
1001
|
+
}
|
|
1002
|
+
if (typeof val === 'number') {
|
|
1003
|
+
return yMinValue + val * (yMaxValue - yMinValue);
|
|
1004
|
+
}
|
|
1005
|
+
return val;
|
|
1006
|
+
}
|
|
1007
|
+
return val;
|
|
1008
|
+
};
|
|
953
1009
|
var _rgb_formatHex8;
|
|
954
1010
|
return {
|
|
955
1011
|
legend: `Reference_${shapeIdx}`,
|
|
956
1012
|
data: [
|
|
957
1013
|
{
|
|
958
|
-
x: shape.x0,
|
|
959
|
-
y: shape.y0
|
|
1014
|
+
x: resolveX(shape.x0),
|
|
1015
|
+
y: resolveY(shape.y0)
|
|
960
1016
|
},
|
|
961
1017
|
{
|
|
962
|
-
x: shape.x1,
|
|
963
|
-
y: shape.y1
|
|
1018
|
+
x: resolveX(shape.x1),
|
|
1019
|
+
y: resolveY(shape.y1)
|
|
964
1020
|
}
|
|
965
1021
|
],
|
|
966
1022
|
color: (_rgb_formatHex8 = (0, _d3color.rgb)(lineColor).formatHex8()) !== null && _rgb_formatHex8 !== void 0 ? _rgb_formatHex8 : lineColor,
|
|
@@ -1016,7 +1072,13 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
1016
1072
|
...isScatterChart ? {
|
|
1017
1073
|
showYAxisLablesTooltip: true,
|
|
1018
1074
|
...getAxisCategoryOrderProps(input.data, input.layout)
|
|
1019
|
-
} : {}
|
|
1075
|
+
} : {},
|
|
1076
|
+
...!isScatterChart && (()=>{
|
|
1077
|
+
const bars = mapColorFillBars(input.layout);
|
|
1078
|
+
return bars && !bars.includes(null) ? {
|
|
1079
|
+
colorFillBars: bars
|
|
1080
|
+
} : {};
|
|
1081
|
+
})()
|
|
1020
1082
|
};
|
|
1021
1083
|
}
|
|
1022
1084
|
};
|