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.

56 lines
1.6 KiB

var myCharts8 = echarts.init(document.getElementById("main8"));
var option8 = {
title: {
text: '全国各省现有确诊人数top5具体数据比较',
subtext: '',
left: 'center',
textStyle:{
color:'rgba(255, 0, 0, 0)',
fontFamily:'微软雅黑'
}
},
legend: {},
tooltip: {},
dataset: {
source: [['省份', '现存确诊', '累计确诊', '累计治愈'],
['Matcha Latte', 43.3, 85.8, 93.7],
['Milk Tea', 83.1, 73.4, 55.1],
['Cheese Cocoa', 86.4, 65.2, 82.5],
['Walnut Brownie', 72.4, 53.9, 39.1],
['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:"/province_top5",
data: null,
dataType : "json",
async: false,
error: function(request) {
alert("发送请求失败!");
},
success: function(result) {
option8.title.subtext = "数据更新时间: " + result.pub_date
for(i=0; i<5; ++i) {
option8.dataset.source[i+1][0]=result.privinces[i]
option8.dataset.source[i+1][1]=result.curConfirms[i]
option8.dataset.source[i+1][2]=result.confirmcount[i]
option8.dataset.source[i+1][3]=result.curecount[i]
}
console.info(result)
}
});
myCharts8.setOption(option8);