mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-08 16:00:26 +08:00
商业版首页增加地图/调低各个图表的高度,以便同时可以显示更多的图表
This commit is contained in:
@@ -4,27 +4,27 @@ Tea.context(function () {
|
||||
|
||||
this.reloadRequestsChart("minutely-requests-chart", "请求数统计", this.minutelyStats, function (args) {
|
||||
if (args.seriesIndex == 0) {
|
||||
return that.minutelyStats[args.dataIndex].day + " " + that.minutelyStats[args.dataIndex].minute + " 请求数: " + teaweb.formatNumber(that.minutelyStats[args.dataIndex].countRequests)
|
||||
return that.minutelyStats[args.dataIndex].day + " " + that.minutelyStats[args.dataIndex].minute + "<br/>请求数: " + teaweb.formatNumber(that.minutelyStats[args.dataIndex].countRequests)
|
||||
}
|
||||
if (args.seriesIndex == 1) {
|
||||
let ratio = 0
|
||||
if (that.minutelyStats[args.dataIndex].countRequests > 0) {
|
||||
ratio = Math.round(that.minutelyStats[args.dataIndex].countCachedRequests * 10000 / that.minutelyStats[args.dataIndex].countRequests) / 100
|
||||
}
|
||||
return that.minutelyStats[args.dataIndex].day + " " + that.minutelyStats[args.dataIndex].minute + " 缓存请求数: " + teaweb.formatNumber(that.minutelyStats[args.dataIndex].countCachedRequests) + ", 命中率:" + ratio + "%"
|
||||
return that.minutelyStats[args.dataIndex].day + " " + that.minutelyStats[args.dataIndex].minute + "<br/>缓存请求数: " + teaweb.formatNumber(that.minutelyStats[args.dataIndex].countCachedRequests) + "<br/>命中率:" + ratio + "%"
|
||||
}
|
||||
return ""
|
||||
})
|
||||
this.reloadTrafficChart("minutely-traffic-chart", "流量统计", this.minutelyStats, function (args) {
|
||||
if (args.seriesIndex == 0) {
|
||||
return that.minutelyStats[args.dataIndex].day + " " + that.minutelyStats[args.dataIndex].minute + " 流量: " + teaweb.formatBytes(that.minutelyStats[args.dataIndex].bytes)
|
||||
return that.minutelyStats[args.dataIndex].day + " " + that.minutelyStats[args.dataIndex].minute + "<br/>流量: " + teaweb.formatBytes(that.minutelyStats[args.dataIndex].bytes)
|
||||
}
|
||||
if (args.seriesIndex == 1) {
|
||||
let ratio = 0
|
||||
if (that.minutelyStats[args.dataIndex].bytes > 0) {
|
||||
ratio = Math.round(that.minutelyStats[args.dataIndex].cachedBytes * 10000 / that.minutelyStats[args.dataIndex].bytes) / 100
|
||||
}
|
||||
return that.minutelyStats[args.dataIndex].day + " " + that.minutelyStats[args.dataIndex].minute + " 缓存流量: " + teaweb.formatBytes(that.minutelyStats[args.dataIndex].cachedBytes) + ", 命中率:" + ratio + "%"
|
||||
return that.minutelyStats[args.dataIndex].day + " " + that.minutelyStats[args.dataIndex].minute + "<br/>缓存流量: " + teaweb.formatBytes(that.minutelyStats[args.dataIndex].cachedBytes) + "<br/>命中率:" + ratio + "%"
|
||||
}
|
||||
return ""
|
||||
})
|
||||
@@ -36,6 +36,15 @@ Tea.context(function () {
|
||||
return
|
||||
}
|
||||
|
||||
// 每N分钟取一次
|
||||
let newStats = []
|
||||
for (let i = 0; i < stats.length; i++) {
|
||||
if (i % 5 == 0) {
|
||||
newStats.push(stats[i])
|
||||
}
|
||||
}
|
||||
stats = newStats
|
||||
|
||||
let axis = teaweb.countAxis(stats, function (v) {
|
||||
return Math.max(v.countRequests, v.countCachedRequests)
|
||||
})
|
||||
@@ -72,9 +81,7 @@ Tea.context(function () {
|
||||
data: stats.map(function (v) {
|
||||
return v.countRequests / axis.divider
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#9DD3E8"
|
||||
},
|
||||
|
||||
areaStyle: {
|
||||
color: "#9DD3E8"
|
||||
},
|
||||
@@ -110,6 +117,15 @@ Tea.context(function () {
|
||||
return
|
||||
}
|
||||
|
||||
// 每N分钟取一次
|
||||
let newStats = []
|
||||
for (let i = 0; i < stats.length; i++) {
|
||||
if (i % 5 == 0) {
|
||||
newStats.push(stats[i])
|
||||
}
|
||||
}
|
||||
stats = newStats
|
||||
|
||||
let axis = teaweb.bytesAxis(stats, function (v) {
|
||||
return Math.max(v.bytes, v.cachedBytes)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user