如何使用jquery的Highcharts

1,在首页导入其js

 

2,在需要显示的页面添加一个div:<div id="chart-container-1" style="margin:5px 10px;width: 888px; height: 500px"></div>

 

3,在需要显示的页面添加js代码:

 

<script type="text/javascript">

        var chart1; // globally available

        $(document).ready(function() {

              chart1 = new Highcharts.Chart({

                 chart: {

                    renderTo: 'chart-container-1',

                    defaultSeriesType: 'bar'

                 },

                 title: {

                    text: '图表'

                 },

                 xAxis: {

                    categories: ['Apples', 'Bananas', 'Oranges']

                 },

                 yAxis: {

                    title: {

                       text: '图标列名'

                    }

                 },

                 series: [{

                    name: 'Jane',

                    data: [5,6,7]

                 }]

              });

              $("tspan:last").hide();//注意,这个可以把广告删除掉,哈哈

        });

    </script>

posted @ 2012-04-06 22:33  永哥  阅读(354)  评论(0编辑  收藏  举报