Commit 69ba2fa4 authored by wangqinghua's avatar wangqinghua

趋势图修改

parent 84083a66
...@@ -67,13 +67,9 @@ export class FlowTrendComponent implements OnInit, OnDestroy { ...@@ -67,13 +67,9 @@ export class FlowTrendComponent implements OnInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.obj.startTime = this.commonSer.getTimeByType('4').startTime; this.obj.startTime = this.commonSer.getTimeByType('1').startTime;
this.obj.endTime = this.commonSer.getTimeByType('4').endTime; this.obj.endTime = this.commonSer.getTimeByType('1').endTime;
this.getHost(); this.getHost();
this.time_ = setInterval(() => {
}, 1000 * 60 * 4);
} }
//获取流量 //获取流量
...@@ -152,9 +148,9 @@ export class FlowTrendComponent implements OnInit, OnDestroy { ...@@ -152,9 +148,9 @@ export class FlowTrendComponent implements OnInit, OnDestroy {
this.inEchartData = res.data.map(e => { this.inEchartData = res.data.map(e => {
const a = { const a = {
clock: this.datePipe.transform(e.clock * 1000, 'yyyy/MM/dd HH:mm'), 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; return a;
}); });
this.setEacharts(); this.setEacharts();
...@@ -186,27 +182,14 @@ export class FlowTrendComponent implements OnInit, OnDestroy { ...@@ -186,27 +182,14 @@ export class FlowTrendComponent implements OnInit, OnDestroy {
text: this.obj.itemKey, text: this.obj.itemKey,
left: 'center', left: 'center',
}, },
legend: {
data: ['进口流量', '出口流量'],
align: 'left',
left: 10
},
backgroundColor: '#eee', backgroundColor: '#eee',
tooltip: { tooltip: {
// trigger: 'axis', // trigger: 'axis',
formatter: (params) => { formatter: (params) => {
let res = params.seriesName; let res = '';
res += '<br/>时间:' + params.name; res += '<br/>时间:' + params.name;
let Mbps = 1000 * 1000; params.unit = params.data.unit ? params.data.unit : '';
let kbps = 1000; res += '<br/>数值:' + params.value + '' + params.unit;
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';
}
return res; return res;
} }
}, },
...@@ -239,9 +222,7 @@ export class FlowTrendComponent implements OnInit, OnDestroy { ...@@ -239,9 +222,7 @@ export class FlowTrendComponent implements OnInit, OnDestroy {
{ {
type: 'line', type: 'line',
itemStyle: itemStyle, itemStyle: itemStyle,
data: this.inEchartData.map(e => { data: this.inEchartData
return e.avg;
})
} }
] ]
}; };
...@@ -268,8 +249,8 @@ export class FlowTrendComponent implements OnInit, OnDestroy { ...@@ -268,8 +249,8 @@ export class FlowTrendComponent implements OnInit, OnDestroy {
//搜索 //搜索
search() { search() {
if (this.timeType == '99') { if (this.timeType == '99') {
this.obj.startTime = this.datePipe.transform(this.timeBegin, '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 HH:mm:ss'); this.obj.endTime = this.datePipe.transform(this.timeEnd, 'yyyy/MM/dd') + ' 29:59:59';
} }
this.getEcharts(); 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