var MyChart8 = echarts.init(document.getElementById('main8')) //画境外输入累计确诊省Top10柱状图 var option8 = { title:{ text: '境外输入累计确诊省Top10', 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:"/OverseasInput_top10", data:null, dataType:"json", async:false, error:function(request){ alert("发送请求失败!15"); }, success:function(result){ console.info(result) option8.title.subtext = "数据更新时间:"+result.pub_date option8.xAxis.data=result.provinces option8.series[0].data = result.data } }); MyChart8.setOption(option8);