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.

60 lines
1.4 KiB

var myCharts7 = echarts.init(document.getElementById("main7"));
var option7 = {
title: {
text: '全国各地区现有确诊人数',
subtext: '',
left: 'center',
textStyle:{
fontFamily:'微软雅黑'
}
},
tooltip: {},
xAxis: {
type: 'category',
data: [],
axisLabel:{
interval:0,//横轴信息全部显示
}
},
yAxis: {
type: 'value'
},
series: [{
name:'现有确诊病例:',
data: [],
type: 'bar',
label: { //每个柱子顶端显示数值
normal: {
show: true,
position: 'top'
}
}
}]
};
// 向后台发起请求,获取数据
$.ajax({
cache: false,
type:"GET",
url:"/province_curconfirm",
data: null,
dataType : "json",
async: false,
error: function(request) {
alert("发送请求失败!");
},
success: function(result) {
// pub_date, privinces, curConfirms
option7.title.subtext = "数据更新时间: " + result.pub_date
for(i=0; i<result.provinces.length; ++i) {
option7.xAxis.data.push(result.provinces[i])
option7.series[0].data.push(result.curConfirms[i])
}
print(result)
console.info(result)
}
});
myCharts7.setOption(option7);