var arr = []; var arrs = []; var re = []; $(msg.g1).each(function (index, ele1) { //x.push(ele.Year); //y.push(ele.Key); arr.push(ele1.Year); arr.push(ele1.Key); arrs.push(arr); arr = []; }); var zz = new Object(); zz.name=dateA; zz.data = arrs; zz.dataLabels={ enabled: true, color: '#666' }; re.push(zz); arr = []; arrs = []; $(msg.g2).each(function (index, ele1) { arr.push(ele1.Year); arr.push(ele1.Key); arrs.push(arr); arr = []; }); var cc = new Object(); cc.name = dateB; cc.data = arrs; cc.dataLabels = { enabled: true, color: '#666' }; re.push(cc); $('#as-left').highcharts({ chart: { type: 'column' }, title: { text: '' }, subtitle: { text: '' }, xAxis: { categories: [] }, yAxis: { min: 0, title: { text: foot_title } }, tooltip: { headerFormat: '<span style="font-size: 10px;">{point.key}</span>', pointFormat: '' + '', footerFormat: '</table>', shared: true, useHTML: true }, plotOptions: { column: { pointPadding: 0.2, borderWidth: 0 } }, exporting: { enabled: false //去除打印 }, series:re });
json数据:
猜测有个地方赋值赋错了。
是我json数据的问题。。。。不能出来两种x轴的数据。。。