You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.8 KiB

var myCharts9 = echarts.init(document.getElementById("main9"));
var option9 = {
title: {
text: '全球现有确诊人数top5具体数据比较',
subtext: '',
left: 'center',
textStyle:{
color:'rgba(255, 0, 0, 0)',
fontFamily:'微软雅黑'
}
},
legend: {},
tooltip: {},
dataset: {
source: [['国家', '现存确诊', '累计确诊', '累计治愈'],
['Matcha Late', 43.3, 85.8, 93.7],
['Milk Te2a', 83.1, 73.4, 55.1],
['Cheese C3ocoa', 86.4, 65.2, 82.5],
['Walnut Br4ownie', 72.4, 53.9, 39.1],
['Matcha La5tte', 43.3, 85.8, 93.7],
['Milk Te7a', 83.1, 73.4, 55.1],
['Cheese C9ocoa', 86.4, 65.2, 82.5],
['Walnut Br0ownie', 72.4, 53.9, 39.1],
['Cheese Coc-oa', 86.4, 65.2, 82.5],
['a', 72.4, 53.9, 39.1]]
},
xAxis: {type: 'category'},
yAxis: {
},
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
series: [
{type: 'bar'},
{type: 'bar'},
{type: 'bar'}
]
};
// 向后台发起请求,获取数据
$.ajax({
cache: false,
type:"GET",
url:"/country_top10",
data: null,
dataType : "json",
async: false,
error: function(request) {
alert("发送请求失败!");
},
success: function(result) {
option9.title.subtext = "数据更新时间: " + result.pub_date
for(i=0; i<10; ++i) {
option9.dataset.source[i+1][0]=result.privinces[i]
option9.dataset.source[i+1][1]=result.curConfirms[i]
option9.dataset.source[i+1][2]=result.confirmcount[i]
option9.dataset.source[i+1][3]=result.curecount[i]
}
console.info(result)
}
});
myCharts9.setOption(option9);