添加切换按钮

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>
</head>
<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_1" 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_up': '地主上家',
}
$(document).ready(function () {
function load_charts(model_type){
$.ajax({
url: "metrics?type=lite_resnet",
url: "metrics?type=" + model_type,
success: function (result) {
result = result.result
var i = 0
@ -62,7 +67,7 @@
if (result[rank][position].hasOwnProperty(frame)) {
return [[frame, (parseFloat(result[rank][position][frame].wp) * 100)]]
} else {
return [[frame, '-']]
return [[frame, null]]
}
})
}, {
@ -78,7 +83,7 @@
if (result[rank][position].hasOwnProperty(frame)) {
return [[frame, parseFloat(result[rank][position][frame].adp)]]
} else {
return [[frame, '-']]
return [[frame, null]]
}
})
}]
@ -96,9 +101,6 @@
},
opposite: true
}];
json.tooltip = {
shared: true
};
json.legend = {
layout: 'vertical',
align: 'right',
@ -110,6 +112,12 @@
}
}
});
}
$(document).ready(function () {
load_charts("lite_resnet");
$("#model_type").on('change', function(){
load_charts($("#model_type").val())
})
});
</script>
</body>