Browse Source

寿命预警横轴展示

master
CODE 2 years ago
parent
commit
2fa47cd11b
  1. 31
      weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.js

31
weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.js

@ -20,7 +20,10 @@ function setOption(chart, seriesData, xData) {
},
xAxis: {
type: 'category',
data: xData
data: xData,
// axisLabel: {
// formatter: '{value}'
// }
},
yAxis: {
type: 'value',
@ -140,10 +143,28 @@ Page({
// const label = `${year}-${month}`;
// xAxisLabels.push(label);
const nextMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + i, 1);
const month = nextMonth.toLocaleDateString('en-US', {
month: 'short'
}); // 获取月份的缩写
xAxisLabels.push(month);
const month = nextMonth
.getMonth()
// .toLocaleDateString('en-US', {
// month: 'short'
// }); // 获取月份的缩写
const month_ = {
"0": "Jan",
"1": "Feb",
"2": "Mar",
"3": "Apr",
"4": "May",
"5": "Jun",
"6": "Jul",
"7": "Aug",
"8": "Sep",
"9": "Oct",
"10": "Nov",
"11": "Dec"
}[month]
console.log('月', month_);
xAxisLabels.push(month_);
}
//过期的
const guaranteedRate = res.filter(item => moment(item.dateGuarantee).isBefore(moment()))?.length || 0

Loading…
Cancel
Save