diff --git a/web_src/src/components/console/ConsoleNet.vue b/web_src/src/components/console/ConsoleNet.vue index 22d4f343..e0136807 100755 --- a/web_src/src/components/console/ConsoleNet.vue +++ b/web_src/src/components/console/ConsoleNet.vue @@ -1,6 +1,6 @@ @@ -59,12 +59,54 @@ export default { tooltip: { trigger: 'axis', formatter: (data)=>{ - return data[1].marker + "下载:" + parseFloat(data[1].data[1]).toFixed(2) + "Mbps" + "
"+ data[0].marker +" 上传:" + parseFloat(data[0].data[1]).toFixed(2) + "Mbps"; + let in_sel = true; + let out_sel = true; + for (let key in this.extend.legend.selected) { + if (key == "上传") { + out_sel = this.extend.legend.selected[key]; + } + if (key == "下载") { + in_sel = this.extend.legend.selected[key]; + } + } + if (out_sel && in_sel) { + return ( + data[1].marker + + "下载:" + + parseFloat(data[1].data[1]).toFixed(2) + + "Mbps" + + "
" + + data[0].marker + + "上传:" + + parseFloat(data[0].data[1]).toFixed(2) + + "Mbps" + ); + } else if (out_sel) + return ( + data[0].marker + + "上传:" + + parseFloat(data[0].data[1]).toFixed(2) + + "Mbps" + ); + else if (in_sel) + return ( + data[0].marker + + "下载:" + + parseFloat(data[0].data[1]).toFixed(2) + + "Mbps" + ); + return ""; } }, legend: { left: "center", bottom: "15px", + selected: {}, + } + } + chartEvents: { + legendselectchanged: (item) => { + this.extend.legend.selected = item.selected; } } };