Browse Source

fix(): 解决实时收入数据缺失时的问题

tags/PMS_V1.0.0_Alpha5
chenqiang 1 year ago
parent
commit
4ff665e1ef
  1. 131
      src/pages/DataAnalysisPrediction/ParkingOverview/loadable.jsx

131
src/pages/DataAnalysisPrediction/ParkingOverview/loadable.jsx

@ -60,6 +60,11 @@ const ParkingOverview = connect(function mapStateToProps(state) {
};
})((props) => {
const navigate = useNavigate();
let isSelected;
let isHovered;
let startRatio;
let endRatio;
let k;
let hoveredIndex = "";
//is
const MapS = [
@ -628,7 +633,7 @@ const ParkingOverview = connect(function mapStateToProps(state) {
return 0;
}
}
const getPie3D = (pieData, internalDiameterRatio) => {
const getPie3D = (pieData, bool) => {
//internalDiameterRatio:
let series = [];
let sumValue = 0;
@ -710,9 +715,43 @@ const ParkingOverview = connect(function mapStateToProps(state) {
legendData.push(series[i].name);
}
//
let boxHeight = getHeight3D(series, 25); //3d/2626px
// legendDataseries
// series.push({
// name: "mouseoutSeries",
// type: "surface",
// parametric: true,
// wireframe: {
// show: false,
// },
// itemStyle: {
// opacity: 0,
// },
// parametricEquation: {
// u: {
// min: 0,
// max: Math.PI * 2,
// step: Math.PI / 20,
// },
// v: {
// min: 0,
// max: Math.PI,
// step: Math.PI / 20,
// },
// x: function (u, v) {
// return Math.sin(v) * Math.sin(u) + Math.sin(u);
// },
// y: function (u, v) {
// return Math.sin(v) * Math.cos(u) + Math.cos(u);
// },
// z: function (u, v) {
// return Math.cos(v) > 0 ? 0.1 : -0.1;
// },
// },
// });
let option = {
// backgroundColor: "#203598",
// labelLine: {
@ -751,6 +790,26 @@ const ParkingOverview = connect(function mapStateToProps(state) {
},
tooltip: {
backgroundColor: "#fff",
// formatter: (params) => {
// if (
// params.seriesName !== "mouseoutSeries" &&
// params.seriesName !== "pie2d"
// ) {
// let bfb = (
// (option.series[params.seriesIndex].pieData.endRatio -
// option.series[params.seriesIndex].pieData.startRatio) *
// 100
// ).toFixed(2);
// if (bfb == "NaN") {
// bfb = 0;
// }
// return (
// `${params.seriesName}<br/>` +
// `<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${params.color};"></span>` +
// `${bfb}%`
// );
// }
// },
formatter: (params) => {
if (
params.seriesName !== "mouseoutSeries" &&
@ -761,13 +820,23 @@ const ParkingOverview = connect(function mapStateToProps(state) {
option.series[params.seriesIndex].pieData.startRatio) *
100
).toFixed(2);
return (
`${params.seriesName}<br/>` +
`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${params.color};"></span>` +
`${bfb}%`
);
if (bfb == "NaN") {
bfb = 0;
}
if (params.seriesName !== "mouseoutSeries") {
return `<div class="pojj">${params.seriesName}
<br/>${params.marker} ${
bool ? "0" : option.series[params.seriesIndex].pieData.value
} ${bfb}%
</div>`;
}
}
},
rich: {
a: {
color: "#FFF",
},
},
},
xAxis3D: {
min: -1,
@ -806,6 +875,12 @@ const ParkingOverview = connect(function mapStateToProps(state) {
series.sort((a, b) => {
return b.pieData.value - a.pieData.value;
});
if ((height * 25) / series[0].pieData.value > 30) {
return 30;
}
// if (!(height * 25) / series[0].pieData.value > 30) {
// return 20;
// }
return (height * 25) / series[0].pieData.value;
};
@ -888,17 +963,10 @@ const ParkingOverview = connect(function mapStateToProps(state) {
// option.series
//
let option = RightTwo;
console.log(option);
let isSelected;
let isHovered;
let startRatio;
let endRatio;
let k;
// mouseover
if (hoveredIndex === params.seriesIndex) {
return;
//
} else {
// option
@ -922,7 +990,7 @@ const ParkingOverview = connect(function mapStateToProps(state) {
);
option.series[hoveredIndex].pieStatus.hovered = isHovered;
// seriesIndex
// seriesIndex
hoveredIndex = "";
}
@ -952,8 +1020,8 @@ const ParkingOverview = connect(function mapStateToProps(state) {
}
// 使 option
setRightTwo(option);
}
setRightTwo(option);
},
globalout: (params) => {
// option.series
@ -961,11 +1029,11 @@ const ParkingOverview = connect(function mapStateToProps(state) {
let option = RightTwo;
if (hoveredIndex !== "") {
// option.series true
let isSelected = option.series[hoveredIndex].pieStatus.selected;
let isHovered = false;
let k = option.series[hoveredIndex].pieStatus.k;
let startRatio = option.series[hoveredIndex].pieData.startRatio;
let endRatio = option.series[hoveredIndex].pieData.endRatio;
isSelected = option.series[hoveredIndex].pieStatus.selected;
isHovered = false;
k = option.series[hoveredIndex].pieStatus.k;
startRatio = option.series[hoveredIndex].pieData.startRatio;
endRatio = option.series[hoveredIndex].pieData.endRatio;
// option
option.series[hoveredIndex].parametricEquation = getParametricEquation(
@ -978,7 +1046,7 @@ const ParkingOverview = connect(function mapStateToProps(state) {
);
option.series[hoveredIndex].pieStatus.hovered = isHovered;
// seriesIndex
// seriesIndex
hoveredIndex = "";
}
// 使 option
@ -995,8 +1063,12 @@ const ParkingOverview = connect(function mapStateToProps(state) {
]
) => {
//
let bfg = true;
const data =
datas.map((ele) => {
if (ele.value != 0) {
bfg = false;
}
return {
name: ele.key,
value: ele.value,
@ -1004,8 +1076,23 @@ const ParkingOverview = connect(function mapStateToProps(state) {
endRatio: 1,
};
}) || [];
let option;
if (bfg) {
//0
option = getPie3D(
data.map((ele) => {
return {
...ele,
value: 1,
};
}),
true
);
} else {
//0
option = getPie3D(data, false);
}
let option = getPie3D(data, 0.8);
// label线2d使labelLine3dsetOption
option.series.push({
// name: "pie2d",

Loading…
Cancel
Save