var MyChart4 = echarts.init(document.getElementById('main4')) // 画无症状感染者top10省份柱状图代码 var option4 = { title:{ text: '全国 无症状感染者分布', subtext: '' }, tooltip : { show:true, trigger:'axis', axisPointer:{type:'shadow'} }, xAxis: { type: 'category', data: [] //top10省份名称 }, yAxis: { type: 'value' }, series: [ { data: [], //top10省份数据 type: 'bar', showBackground: true, backgroundStyle: { color: 'rgba(220, 220, 220, 0.8)' }, color:'rgba(72, 221, 119, 1)', barWidth : 20 }, ], legend:{}, }; $.ajax({ cache:false, type:"GET", url:"/ProvinceAsymptomatic_top10", data:null, dataType:"json", async:false, error:function(request){ alert("发送请求失败!1"); }, success:function(result){ console.info(result) option4.title.subtext = "数据更新时间:"+result.pub_date option4.xAxis.data=result.provinces option4.series[0].data = result.asymptomatic } }); MyChart4.setOption(option4);