diff --git a/model/config.go b/model/config.go index fb4ad91..c18bb3f 100644 --- a/model/config.go +++ b/model/config.go @@ -147,7 +147,7 @@ func (c *Config) Read(path string) error { c.Location = "Asia/Shanghai" } if c.MaxTCPPingValue == 0 { - c.MaxTCPPingValue = 300 + c.MaxTCPPingValue = 1000 } if c.AvgPingCount == 0 { c.AvgPingCount = 2 diff --git a/resource/template/theme-default/network.html b/resource/template/theme-default/network.html index b321eee..77d4f4f 100644 --- a/resource/template/theme-default/network.html +++ b/resource/template/theme-default/network.html @@ -30,7 +30,7 @@ const initData = JSON.parse('{{.Servers}}').servers; let MaxTCPPingValue = {{.MaxTCPPingValue}}; if (MaxTCPPingValue == null) { - MaxTCPPingValue = 300; + MaxTCPPingValue = 1000; } new Vue({ el: '#app', @@ -77,7 +77,7 @@ }, dataZoom: [ { - start: 94, + start: 0, end: 100 } ], @@ -87,7 +87,7 @@ }, yAxis: { type: 'value', - boundaryGap: [0, '100%'] + boundaryGap: false }, series: [], }, @@ -178,11 +178,13 @@ let loss = 0; let data = []; for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) { - avgDelay = monitorInfo.result[i].avg_delay[j]; + avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]); if (avgDelay > 0.9 * MaxTCPPingValue) { loss += 1 } - data.push([monitorInfo.result[i].created_at[j], avgDelay]); + if (avgDelay > 0) { + data.push([monitorInfo.result[i].created_at[j], avgDelay]); + } } lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1); legendName = monitorInfo.result[i].monitor_name +" "+ lossRate + "%"; @@ -192,7 +194,13 @@ type: 'line', smooth: true, symbol: 'none', - data: data + data: data, + markPoint: { + data: [ + { type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: '#f00' } }, + { type: 'min', symbol: 'pin', name: 'Min', itemStyle: { color: '#0f0' } } + ] + } }); } this.option.title.text = monitorInfo.result[0].server_name;