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.
p9ew5o3q7/app/static/js/confirmed_top5.js

67 lines
1.7 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

var myChart3 = echarts.init(document.getElementById("main3"));
//画现有确诊人数top5省份饼图
var option3 = {
title: {
text: '现有确诊人数Top5的省份',
subtext: '',
left: 'center',
textStyle:{
color:'#FF0000',
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:"/ProvinceConfirmed_top5",
data: null,
dataType : "json",
async: false,
error: function(request) {
alert("发送请求失败4");
},
success: function(result) {
// pub_date, privinces, curConfirms
option3.title.subtext = "数据更新时间: " + result.pub_date
for(i=0; i<result.privinces.length; ++i) {
option3.legend.data.push(result.privinces[i])
option3.series[0].data.push({name:result.privinces[i], value:result.curConfirms[i]})
}
console.info(result)
}
});
myChart3.setOption(option3);