var MyChart2 = echarts.init(document.getElementById("main2")); //画 国外确诊总数7天走向 线型图 代码 var option2 = { title: { text: '国外疫情走向', subtext:'单位:例' }, tooltip: { trigger: 'axis' }, legend: { data: ['现有确诊总数'] }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, toolbox: { feature: { saveAsImage: {} } }, xAxis: { type: 'category', boundaryGap: false, data: [] }, yAxis: { type: 'value', min:6000000, max:7000000 }, series: [ { name: '现有确诊总数', type: 'line', data: [], smooth:true } ] }; //向后台发送请求 $.ajax({ cache:false, type:"GET", url:"/OutsideConfirmed_7days", data:null, dataType:"json", async:false, error:function(request){ alert("发送请求失败!12"); }, success:function(results){ console.info(results) option2.xAxis.data=results.time option2.series[0].data = results.curconfirmed } }); MyChart2.setOption(option2);