添加切换按钮

This commit is contained in:
zhiyang7 2021-12-27 18:00:04 +08:00
parent 6241de87ef
commit b5ab089fb3
1 changed files with 15 additions and 7 deletions

View File

@ -4,6 +4,11 @@
<script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/highcharts.js"></script>
</head> </head>
<body> <body>
<select id='model_type'>
<option value ="lite_resnet">lite_resnet</option>
<option value ="lite_vanilla">lite_vanilla</option>
<option value ="legacy_vanilla">legacy_vanilla</option>
</select>
<div id="container_0" style="width: 80%; height: 400px; margin: 0 auto"></div> <div id="container_0" style="width: 80%; height: 400px; margin: 0 auto"></div>
<div id="container_1" style="width: 80%; height: 400px; margin: 0 auto"></div> <div id="container_1" style="width: 80%; height: 400px; margin: 0 auto"></div>
<div id="container_2" style="width: 80%; height: 400px; margin: 0 auto"></div> <div id="container_2" style="width: 80%; height: 400px; margin: 0 auto"></div>
@ -14,9 +19,9 @@
'landlord_front': '地主对家', 'landlord_front': '地主对家',
'landlord_up': '地主上家', 'landlord_up': '地主上家',
} }
$(document).ready(function () { function load_charts(model_type){
$.ajax({ $.ajax({
url: "metrics?type=lite_resnet", url: "metrics?type=" + model_type,
success: function (result) { success: function (result) {
result = result.result result = result.result
var i = 0 var i = 0
@ -62,7 +67,7 @@
if (result[rank][position].hasOwnProperty(frame)) { if (result[rank][position].hasOwnProperty(frame)) {
return [[frame, (parseFloat(result[rank][position][frame].wp) * 100)]] return [[frame, (parseFloat(result[rank][position][frame].wp) * 100)]]
} else { } else {
return [[frame, '-']] return [[frame, null]]
} }
}) })
}, { }, {
@ -78,7 +83,7 @@
if (result[rank][position].hasOwnProperty(frame)) { if (result[rank][position].hasOwnProperty(frame)) {
return [[frame, parseFloat(result[rank][position][frame].adp)]] return [[frame, parseFloat(result[rank][position][frame].adp)]]
} else { } else {
return [[frame, '-']] return [[frame, null]]
} }
}) })
}] }]
@ -96,9 +101,6 @@
}, },
opposite: true opposite: true
}]; }];
json.tooltip = {
shared: true
};
json.legend = { json.legend = {
layout: 'vertical', layout: 'vertical',
align: 'right', align: 'right',
@ -110,6 +112,12 @@
} }
} }
}); });
}
$(document).ready(function () {
load_charts("lite_resnet");
$("#model_type").on('change', function(){
load_charts($("#model_type").val())
})
}); });
</script> </script>
</body> </body>