$(function () { }); var myChart; // 基于准备好的dom,初始化echarts实例 var dChart = echarts.init(document.getElementById('main4')); // 指定图表的配置项和数据 function weChatFun(dateList, wechatFollowersList) { dChart.setOption({ tooltip: { trigger: 'axis', axisPointer: { type: 'shadow', crossStyle: { color: '#999' } } }, grid: { show: false, left: '3%', right: '4%', bottom: '10%' }, xAxis: { // splitLine: {     show: false   }, type: 'category', data: dateList, axisPointer: { type: 'shadow' }, // 改变x轴颜色 axisLine: { lineStyle: { color: '#00a2e2', width: 1, // 这里是为了突出显示加上的 } }, axisTick: { show: true, interval: 0 }, }, // 设置两个y轴,左边显示数量,右边显示概率 yAxis: { splitLine: {     show: false   }, type: 'value', name: '好友数量', // max: 10000, // min: 0, // show: true, // interval: 1000, // 改变y轴颜色 axisLine: { lineStyle: { color: '#00a2e2', width: 1, // 这里是为了突出显示加上的 } }, }, // 每个设备分数量、概率2个指标,只要让他们的name一致,即可通过,legeng进行统一的切换 series: [{ //折线 name: 'WechatFollowers', type: 'line', symbol: 'circle', // 折线点设置为实心点 symbolSize: 6, // 折线点的大小 yAxisIndex: 0, // 这里要设置哪个y轴,默认是最左边的是0,然后1,2顺序来。 data: wechatFollowersList, symbolSize: 10, itemStyle: { normal: { color: "#DDA0DD" } } } ] }); } function queryMonthly(){ var startMonth = document.getElementById("startMonth").value; var endMonth = document.getElementById("endMonth").value; var param = { startMonth:startMonth, endMonth:endMonth }; console.log(param); // 折线图 $.ajax({ url: "../monthly/queryMonthlyWechatFollowers", data: param, contentType:"application/x-www-form-urlencoded", type: 'POST', success: function(data) { console.log(data) weChatFun(data.dateList, data.wechatFollowersList); }, }); } function addWechatFollowers(){ var wechatFollowers = document.getElementById("wechatFollowers").value; var param = { wechatFollowers:wechatFollowers }; console.log(param); // 折线图 $.ajax({ url: "../monthly/addWechatFollowers", data: param, contentType:"application/x-www-form-urlencoded", type: 'POST', success: function(data) { alert(data.msg) }, }); } function exportMonthly(){ var startMonth = document.getElementById("startMonth").value; var endMonth = document.getElementById("endMonth").value; var params = { startMonth:startMonth, endMonth:endMonth }; console.log(params); exportFile('#rrapp', '../monthly/wechatFollowersGrowthExport', params); }