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.
64 lines
1.6 KiB
64 lines
1.6 KiB
var myCharts1 = echarts.init(document.getElementById("main1"));
|
|
|
|
var option1 = {
|
|
title: {
|
|
text: '现有确诊人数最多的五个省份',
|
|
subtext: '',
|
|
left: 'center',
|
|
textStyle:{
|
|
fontFamily:'微软雅黑'
|
|
}
|
|
},
|
|
tooltip: {
|
|
trigger: 'item',
|
|
formatter: '{a} <br/>{b} : {c} ({d}%)'
|
|
},
|
|
legend: {
|
|
type: 'scroll',
|
|
orient: 'vertical',
|
|
right: 10,
|
|
top: 20,
|
|
bottom: 20,
|
|
data: []
|
|
},
|
|
series: [
|
|
{
|
|
name: '省份',
|
|
type: 'pie',
|
|
radius: '55%',
|
|
center: ['40%', '50%'],
|
|
data: [],
|
|
emphasis: {
|
|
itemStyle: {
|
|
shadowBlur: 10,
|
|
shadowOffsetX: 0,
|
|
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
}
|
|
}
|
|
}
|
|
]
|
|
};
|
|
|
|
// 向后台发起请求,获取数据
|
|
$.ajax({
|
|
cache: false,
|
|
type:"GET",
|
|
url:"/province_topn_curconfirm",
|
|
data: null,
|
|
dataType : "json",
|
|
async: false,
|
|
error: function(request) {
|
|
alert("发送请求失败!");
|
|
},
|
|
success: function(result) {
|
|
// pub_date, privinces, curConfirms
|
|
option1.title.subtext = "数据更新时间: " + result.pub_date
|
|
for(i=0; i<result.privinces.length; ++i) {
|
|
option1.legend.data.push(result.privinces[i])
|
|
option1.series[0].data.push({name:result.privinces[i], value:result.curConfirms[i]})
|
|
}
|
|
console.info(result)
|
|
}
|
|
});
|
|
|
|
myCharts1.setOption(option1); |