<script type="text/javascript"> var legendDate=""; var series=""; var ser=""; var legend=""; var option={}; function opSeries(){ option ={ title: { text: ‘性能数据采集到入库关键节点处理效率报表‘ }, xAxis: { categories: legendDate }, yAxis: { title: { text: ‘关键节点处理时间 (分钟)‘ } }, tooltip: { enabled: false, formatter: function() { return ‘<b>‘+ this.series.name +‘</b><br/>‘+this.x +‘: ‘+ this.y +‘°C‘; } }, plotOptions: { line: { dataLabels: { enabled: true }, enableMouseTracking: false } }, tooltip: { enabled: false, formatter: function() { return ‘<b>‘+ this.series.name +‘</b><br/>‘+this.x +‘: ‘+ this.y +‘°C‘; } }, series: [] } } $(function () { $.ajax({ type: "post", async: false, //同步执行 url: "", dataType: "json", //返回数据形式为json success: function (result) { }, error: function (errorMsg) { legendDate = ["2014","2015","2016"]; series = [ { "name":"2014", "type":"bar", "data":[51, 2, 43],"len":"中国"} ,{ "name":"2015", "type":"bar", "data":[55, 36, 4] ,"len":"美国"},{ "name":"2016", "type":"bar", "data":[5, 20, 40],"len":"英国"}]; ser = [ { "name":"2014", "type":"bar", "data":[51, 2, 43]} ,{ "name":"2015", "type":"bar", "data":[55, 36, 4]},{ "name":"2016", "type":"bar", "data":[5, 20, 40]}]; legend = ["中国","美国","德国"]; //showChart(); opSeries(); for(i=0;series.length>i;i++){ console.log("highchart循环内i的值:"+i); option.series[i]=series[i]; console.log("option2.series["+i+"]--------"+"series["+i+"]:"+series[i]); } } }); $("#container").highcharts(option); }); </script>
时间: 2024-11-10 07:31:10