mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-14 04:10:26 +08:00
数据看板使用字节代替比特
This commit is contained in:
@@ -35,19 +35,32 @@ Tea.context(function () {
|
||||
}
|
||||
|
||||
this.reloadHourlyTrafficChart = function () {
|
||||
let axis = teaweb.bytesAxis(this.hourlyTrafficStats, function (v) {
|
||||
return v.bytes
|
||||
})
|
||||
let chartBox = document.getElementById("hourly-traffic-chart-box")
|
||||
let chart = echarts.init(chartBox)
|
||||
let that = this
|
||||
let option = {
|
||||
xAxis: {
|
||||
data: this.hourlyTrafficStats.map(function (v) {
|
||||
return v.hour;
|
||||
})
|
||||
},
|
||||
yAxis: {},
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: function (v) {
|
||||
return v + axis.unit
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: "item",
|
||||
formatter: "{c} GB"
|
||||
formatter: function (args) {
|
||||
let index = args.dataIndex
|
||||
return that.hourlyTrafficStats[index].hour + "时:" + teaweb.formatBytes(that.hourlyTrafficStats[index].bytes)
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: 40,
|
||||
@@ -59,7 +72,7 @@ Tea.context(function () {
|
||||
name: "流量",
|
||||
type: "line",
|
||||
data: this.hourlyTrafficStats.map(function (v) {
|
||||
return v.count;
|
||||
return v.bytes / axis.divider;
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#9DD3E8"
|
||||
@@ -85,19 +98,32 @@ Tea.context(function () {
|
||||
}
|
||||
|
||||
this.reloadDailyTrafficChart = function () {
|
||||
let axis = teaweb.bytesAxis(this.dailyTrafficStats, function (v) {
|
||||
return v.bytes
|
||||
})
|
||||
let chartBox = document.getElementById("daily-traffic-chart-box")
|
||||
let chart = echarts.init(chartBox)
|
||||
let that = this
|
||||
let option = {
|
||||
xAxis: {
|
||||
data: this.dailyTrafficStats.map(function (v) {
|
||||
return v.day;
|
||||
})
|
||||
},
|
||||
yAxis: {},
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: function (v) {
|
||||
return v + axis.unit
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: "item",
|
||||
formatter: "{c} GB"
|
||||
formatter: function (args) {
|
||||
let index = args.dataIndex
|
||||
return that.dailyTrafficStats[index].day + ":" + teaweb.formatBytes(that.dailyTrafficStats[index].bytes)
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: 40,
|
||||
@@ -109,7 +135,7 @@ Tea.context(function () {
|
||||
name: "流量",
|
||||
type: "line",
|
||||
data: this.dailyTrafficStats.map(function (v) {
|
||||
return v.count;
|
||||
return v.bytes / axis.divider;
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#9DD3E8"
|
||||
|
||||
Reference in New Issue
Block a user