添加y轴,调整样式

This commit is contained in:
zhiyang7 2021-12-27 16:56:45 +08:00
parent d68d39718c
commit 93a668d93e
1 changed files with 40 additions and 13 deletions

View File

@ -8,6 +8,12 @@
<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>
<script> <script>
position_map = {
'landlord': '地主',
'landlord_down': '地主下家',
'landlord_front': '地主对家',
'landlord_up': '地主上家',
}
$(document).ready(function () { $(document).ready(function () {
$.ajax({ $.ajax({
url: "metrics?type=lite_resnet", url: "metrics?type=lite_resnet",
@ -25,7 +31,8 @@
text: 'Baseline: ' + rank text: 'Baseline: ' + rank
}, },
subtitle: { subtitle: {
text: 'WP: ' + result[rank]['baseline'].landlord_wp + '\t/\t' + result[rank]['baseline'].farmer_wp + '<br/>' + text: 'WP: ' + result[rank]['baseline'].landlord_wp + '\t/\t' + result[rank]['baseline'].farmer_wp + '&nbsp;&nbsp;&nbsp;&nbsp;' +
'ADP: ' + result[rank]['baseline'].landlord_adp + '\t/\t' + result[rank]['baseline'].farmer_adp + '<br/>' +
result[rank]['baseline'].landlord_path + '\t/\t' + result[rank]['baseline'].landlord_path + '\t/\t' +
result[rank]['baseline'].landlord_down_path + '\t/\t' + result[rank]['baseline'].landlord_down_path + '\t/\t' +
result[rank]['baseline'].landlord_front_path + '\t/\t' + result[rank]['baseline'].landlord_front_path + '\t/\t' +
@ -43,34 +50,54 @@
if (!result[rank].hasOwnProperty(position)) { if (!result[rank].hasOwnProperty(position)) {
return null; return null;
} }
return { return [{
name: position, name: position_map[position] + " WP",
type: 'spline', type: 'spline',
connectNulls: true, connectNulls: true,
yAxis: 0,
tooltip: {
pointFormat: position_map[position] + ": WP: {point.y:.2f}%<br>"
},
data: $.map(categories, function (frame) { data: $.map(categories, function (frame) {
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, '-']]
} }
}) })
}, {
name: position_map[position] + " ADP",
type: 'spline',
connectNulls: true,
yAxis: 1,
visible: false,
tooltip: {
pointFormat: position_map[position] + "ADP: {point.y:.2f}<br>"
},
data: $.map(categories, function (frame) {
if (result[rank][position].hasOwnProperty(frame)) {
return [[frame, parseFloat(result[rank][position][frame].adp)]]
} else {
return [[frame, '-']]
} }
}) })
}]
})
json.xAxis = { json.xAxis = {
categories: categories categories: categories
} }
json.yAxis = { json.yAxis = [{
title: { title: {
text: 'Win Rate (%)' text: 'Win Rate (%)'
}
}, {
title: {
text: 'ADP'
}, },
plotLines: [{ opposite: true
value: 0, }];
width: 1,
color: '#808080'
}]
};
json.tooltip = { json.tooltip = {
valueSuffix: '%' shared: true
}; };
json.legend = { json.legend = {
layout: 'vertical', layout: 'vertical',