Commit 69ba2fa4 authored by wangqinghua's avatar wangqinghua

趋势图修改

parent 84083a66
......@@ -67,13 +67,9 @@ export class FlowTrendComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.obj.startTime = this.commonSer.getTimeByType('4').startTime;
this.obj.endTime = this.commonSer.getTimeByType('4').endTime;
this.obj.startTime = this.commonSer.getTimeByType('1').startTime;
this.obj.endTime = this.commonSer.getTimeByType('1').endTime;
this.getHost();
this.time_ = setInterval(() => {
}, 1000 * 60 * 4);
}
//获取流量
......@@ -152,9 +148,9 @@ export class FlowTrendComponent implements OnInit, OnDestroy {
this.inEchartData = res.data.map(e => {
const a = {
clock: this.datePipe.transform(e.clock * 1000, 'yyyy/MM/dd HH:mm'),
avg: e.avg
value: e.avg,
unit: e.unit
};
console.log(a)
return a;
});
this.setEacharts();
......@@ -186,27 +182,14 @@ export class FlowTrendComponent implements OnInit, OnDestroy {
text: this.obj.itemKey,
left: 'center',
},
legend: {
data: ['进口流量', '出口流量'],
align: 'left',
left: 10
},
backgroundColor: '#eee',
tooltip: {
// trigger: 'axis',
formatter: (params) => {
let res = params.seriesName;
let res = '';
res += '<br/>时间:' + params.name;
let Mbps = 1000 * 1000;
let kbps = 1000;
let size = Math.abs(params.data);
if (size / Mbps > 1) {
res += '<br/>流量:' + (size / Mbps).toFixed(2) + 'Mbps';
} else if (size / kbps > 1) {
res += '<br/>流量:' + (size / kbps).toFixed(2) + 'kbps';
} else {
res += '<br/>流量:' + (size) + 'bps';
}
params.unit = params.data.unit ? params.data.unit : '';
res += '<br/>数值:' + params.value + '' + params.unit;
return res;
}
},
......@@ -239,9 +222,7 @@ export class FlowTrendComponent implements OnInit, OnDestroy {
{
type: 'line',
itemStyle: itemStyle,
data: this.inEchartData.map(e => {
return e.avg;
})
data: this.inEchartData
}
]
};
......@@ -268,8 +249,8 @@ export class FlowTrendComponent implements OnInit, OnDestroy {
//搜索
search() {
if (this.timeType == '99') {
this.obj.startTime = this.datePipe.transform(this.timeBegin, 'yyyy/MM/dd HH:mm:ss');
this.obj.endTime = this.datePipe.transform(this.timeEnd, 'yyyy/MM/dd HH:mm:ss');
this.obj.startTime = this.datePipe.transform(this.timeBegin, 'yyyy/MM/dd') + ' 00:00:00';
this.obj.endTime = this.datePipe.transform(this.timeEnd, 'yyyy/MM/dd') + ' 29:59:59';
}
this.getEcharts();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment