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.
78 lines
1.8 KiB
78 lines
1.8 KiB
4 years ago
|
var MyChart1 = echarts.init(document.getElementById("main1"));
|
||
|
|
||
|
//画国外疫情概况柱状图代码
|
||
|
|
||
|
var option1 = {
|
||
|
title:{
|
||
|
text: '国外疫情概况',
|
||
|
subtext: ''
|
||
|
},
|
||
|
|
||
|
tooltip : {
|
||
|
show:true,
|
||
|
trigger:'axis',
|
||
|
axisPointer:{type:'shadow'}
|
||
|
},
|
||
|
xAxis: {
|
||
|
type: 'category',
|
||
|
data: ['确诊总数','死亡总数', '当前总数', '治愈总数']
|
||
|
},
|
||
|
yAxis: {
|
||
|
type: 'value'
|
||
|
},
|
||
|
series: [
|
||
|
{
|
||
|
name:'当前总数',
|
||
|
data: [],
|
||
|
type: 'bar',
|
||
|
showBackground: true,
|
||
|
backgroundStyle: {
|
||
|
color: 'rgba(220, 220, 220, 0.8)'
|
||
|
},
|
||
|
color:'rgba(227, 105, 61, 1)',
|
||
|
barWidth : 100
|
||
|
},
|
||
|
|
||
|
{
|
||
|
name:'相对昨日',
|
||
|
data: [],
|
||
|
type: 'bar',
|
||
|
showBackground: true,
|
||
|
backgroundStyle: {
|
||
|
color: 'rgba(220, 220, 220, 0.8)'
|
||
|
},
|
||
|
color:'rgba(72, 221, 119, 1)',
|
||
|
barWidth : 70
|
||
|
}
|
||
|
],
|
||
|
legend:{
|
||
|
type:'plain',
|
||
|
show:true,
|
||
|
top : 'top',
|
||
|
data:['当前总数','相对昨日']
|
||
|
},
|
||
|
};
|
||
|
|
||
|
|
||
|
//向后台发送请求
|
||
|
$.ajax({
|
||
|
cache:false,
|
||
|
type:"GET",
|
||
|
url:"/SummaryDataOut",
|
||
|
data:null,
|
||
|
dataType:"json",
|
||
|
async:false,
|
||
|
error:function(request){
|
||
|
alert("发送请求失败!14");
|
||
|
},
|
||
|
success:function(result){
|
||
|
//要显示:数据更新时间,各个数据;
|
||
|
console.info(result)
|
||
|
option1.title.subtext = "数据更新时间:"+result.pub_date
|
||
|
option1.series[0].data = result.datas.slice(0,4)
|
||
|
option1.series[1].data = result.datas.slice(4,8)
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
MyChart1.setOption(option1);
|