highcharts ajax读取数据范例

<div id="container"  style="width:98%; height:85%;"></div>
   <script type="text/javascript">
       $(function() {

           var a = [];
           var b = [];

           a.push(parseFloat("1"));
           b.push(parseFloat("2"));
           
           a.push(parseFloat("5"));
           b.push(parseFloat("7"));
           
           
           $('#container').highcharts({
               title: {
                   text: '近',
                   x: -20 //center
               },
               subtitle: {
                   text: 'Source: WorldClimate.com',
                   x: -20
               },
               xAxis: {
                   categories: ['Jan', 'Feb']
               },
               yAxis: {
                   title: {
                       text: 'Temperature (°C)'
                   },
                   plotLines: [{
                       value: 0,
                       width: 1,
                       color: '#808080'
}]
                   },
                   tooltip: {
                       valueSuffix: '°C'
                   },
                   legend: {
                       layout: 'vertical',
                       align: 'right',
                       verticalAlign: 'middle',
                       borderWidth: 0
                   },
                   series: [{
                       name: 'Tokyo',
                       data: a
                   }, {
                       name: 'New York',
                       data: b
                   }

                   ]
               });

           });
    </script>

相关文章: