简体   繁体   中英

How to load the highchart in my aspx page

I want to implement this highchart in my aspx page. I have those two js files with me and added the reference like

 <script src="../UserInfo/Charts/highcharts.js" type="text/javascript"></script>
 <script src="../UserInfo/Charts/highcharts.js" type="text/javascript"></script>

And pasted the code in a function like

<script language="javascript" type="text/javascript">    
window.onload = function () {
    var oContainer = document.getElementById("container");

    //        $(function () {
  $('#container').highcharts({
        chart: {
            type: 'line'
        },
        title: {
            text: 'Yearly In/Out Transaction Chart'
        },
        subtitle: {
            text: ' Financial Year 12-13'
        },
        xAxis: {
            categories: ['Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar']
        },
        yAxis: {
            title: {
                text: 'Transaction Amount'
            }
        },
        tooltip: {
            enabled: true,
            formatter: function () {
                return '<b></b><br/> In Out';
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true,
                    style: {
                        textShadow: '0 0 3px white, 0 0 3px white'
                    }
                },
                enableMouseTracking: false
            }
        },
        series: [{
            name: 'Receipt',
            data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
        }, {
            name: 'Payment',
            data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
        }, {
            name: 'Balance',
            data: [3.1, 4.0, 5.1, 8.1, 11.1, 15.1, 17.2, 16.8, 14.0, 10.3, 6.6, 40.10]
        }]
    });
    //        });

}

</script>

even the graph is not loading. I have tried with

<script src="http://code.highcharts.com/highcharts.js"></script>

these references also. If I keep the alert inside the function, it is not firing. It is working fine in jsFiddler. Why not in my page. Am I missing any refernces. ???

You missed this two lines in your code

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>

<div id=container></div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM