fix:修复alert图表x轴时间未处理的问题 & 修复endpoint-query页面显示异常

This commit is contained in:
wangwenrui
2020-11-06 16:20:54 +08:00
parent f91e3f7180
commit 1ee556e11c
4 changed files with 15 additions and 20 deletions

View File

@@ -152,29 +152,13 @@
}
if(this.chartType == 'line' || this.chartType == 'overviewLine'){
let maxValueCopies = this.getMaxValue(this.series,{unit:this.unit});
let maxValue=maxValueCopies.maxValue;
let copies=maxValueCopies.copies;
let unit=maxValueCopies.unit;
// this.option.yAxis.minInterval=chartDataFormat.Interval(maxValue,copies,unit.type,'min');
this.option.xAxis.axisLabel.formatter=this.defaultXAxisFormatter;
if(this.yAxisFormatter){
this.option.yAxis.axisLabel.formatter=this.yAxisFormatter;
}else{
this.option.yAxis.axisLabel.formatter=this.defaultYAxisFormatter
}
}
if(this.chartType == 'overviewLine'){
this.option.xAxis.axisLabel.formatter=function(value,index){
value=bus.computeTimezone(value)
let t_date = new Date(value);
let month=t_date.getMonth()+1>9?t_date.getMonth()+1:'0'+(t_date.getMonth()+1);
let day = t_date.getDate()>9?t_date.getDate():'0'+t_date.getDate();
let hour = t_date.getHours()>9?t_date.getHours():'0'+t_date.getHours();
let minute=t_date.getMinutes()>9?t_date.getMinutes():'0'+t_date.getMinutes();
return [ month, day].join('-') + "\n"
+ [hour, minute].join(':');
}
}
if(this.series){
this.$set(this.option,'series',this.series);
this.noData=false;
@@ -328,6 +312,17 @@
return [x,y];
}
},
defaultXAxisFormatter:function(value,index){
value=bus.computeTimezone(value)
let t_date = new Date(value);
console.log(t_date)
let month=t_date.getMonth()+1>9?t_date.getMonth()+1:'0'+(t_date.getMonth()+1);
let day = t_date.getDate()>9?t_date.getDate():'0'+t_date.getDate();
let hour = t_date.getHours()>9?t_date.getHours():'0'+t_date.getHours();
let minute=t_date.getMinutes()>9?t_date.getMinutes():'0'+t_date.getMinutes();
return [ month, day].join('-') + "\n"
+ [hour, minute].join(':');
},
defaultTooltipFormatter:function(params){
let str = `<div>`;
params.forEach((item, i) => {