highchars多Y轴实现(Jquery post请求)

来源:互联网 发布:linux切换到指定目录 编辑:程序博客网 时间:2024/06/05 18:28
// 产品销售量,PV 转化率$.post("shopgoods.view", {'sdate' : sdate,'edate' : edate}, function(result, resultState) {var sumSuc = 0;var date_value = [];// X轴 存储日期var suc_value = new Array();//Y轴var pv_value = new Array();//Y轴var zhl_value = new Array();//Y轴if (resultState == "success") {var resultJson = eval(result);// 循环处理json返回的数据$.each(result, function(index, val) {date_value.push(val['dateTime']);pv_value.push(val['pageViews']);suc_value.push(val['market']);zhl_value.push(val['zhl']);sumSuc += val['market'];//得到一个总合});// alert(sumSuc);// $("#tableContent").html($("#TemplateData_date").html($("#td1")).append(sumSuc));$("#td1").html(sumSuc);// 设置销量值$('#container_bar').highcharts({exporting : {enabled : false},chart : {zoomType : 'xy'},legend : {layout : 'vertical',align : 'left',x : 120,verticalAlign : 'top',y : 100,floating : true,backgroundColor : '#FFFFFF'},title : {text : ''},xAxis : {categories : date_value,labels : {rotation : 75}},yAxis : [ { // Primary yAxislabels : {format : '{value}',style : {color : '#89A54E'}},title : {text : '销量',style : {color : '#89A54E'}}}, { // Secondary yAxistitle : {text : 'PV',style : {color : '#4572A7'}},labels : {format : '{value}',style : {color : '#4572A7'}},opposite : true} ],tooltip : {shared : true},credits : {enabled : false},series : [ {name : 'PV',color : '#4572A7',type : 'column',yAxis : 1,data : pv_value,tooltip : {valueSuffix : ''}}, {name : '销量',color : '#89A54E',type : 'column',data : suc_value,tooltip : {valueSuffix : ''}}, {name : '转化率',color : '#AA4643',type : 'spline',data : zhl_value,tooltip : {valueSuffix : ''}}, ]});}});

0 0
原创粉丝点击