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

@@ -1888,7 +1888,7 @@ li{
height: 100%; height: 100%;
} }
.ant-table-scroll .el-table { .ant-table-scroll .el-table {
height: 100% !important; //height: 100% !important;
} }
/*model侧滑中下拉框*/ /*model侧滑中下拉框*/
.autocomplete-dropdown { .autocomplete-dropdown {

View File

@@ -508,7 +508,7 @@
} }
this.legend.push(legend); this.legend.push(legend);
chartData.data = queryData.values.map((dpsItem, dpsIndex) => { chartData.data = queryData.values.map((dpsItem, dpsIndex) => {
return [bus.computeTimezone(dpsItem[0]) * 1000, parseFloat(dpsItem[1]).toFixed(2)]; return [dpsItem[0] * 1000, parseFloat(dpsItem[1]).toFixed(2)];
}); });
this.chartDatas.push(chartData); this.chartDatas.push(chartData);
} }

View File

@@ -152,29 +152,13 @@
} }
if(this.chartType == 'line' || this.chartType == 'overviewLine'){ if(this.chartType == 'line' || this.chartType == 'overviewLine'){
let maxValueCopies = this.getMaxValue(this.series,{unit:this.unit}); this.option.xAxis.axisLabel.formatter=this.defaultXAxisFormatter;
let maxValue=maxValueCopies.maxValue;
let copies=maxValueCopies.copies;
let unit=maxValueCopies.unit;
// this.option.yAxis.minInterval=chartDataFormat.Interval(maxValue,copies,unit.type,'min');
if(this.yAxisFormatter){ if(this.yAxisFormatter){
this.option.yAxis.axisLabel.formatter=this.yAxisFormatter; this.option.yAxis.axisLabel.formatter=this.yAxisFormatter;
}else{ }else{
this.option.yAxis.axisLabel.formatter=this.defaultYAxisFormatter 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){ if(this.series){
this.$set(this.option,'series',this.series); this.$set(this.option,'series',this.series);
this.noData=false; this.noData=false;
@@ -328,6 +312,17 @@
return [x,y]; 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){ defaultTooltipFormatter:function(params){
let str = `<div>`; let str = `<div>`;
params.forEach((item, i) => { params.forEach((item, i) => {

View File

@@ -90,7 +90,7 @@
axisLabel: { axisLabel: {
interval: 0, interval: 0,
rotate: 0, rotate: 0,
formatter: function (value) { formatter: function (value,index) {
value=value value=value
var t_date = new Date(value); var t_date = new Date(value);
return [t_date.getFullYear(), t_date.getMonth() + 1, t_date.getDate()].join('-') + "\n" return [t_date.getFullYear(), t_date.getMonth() + 1, t_date.getDate()].join('-') + "\n"