Javascript examples for highcharts:Chart Creation
Create chart from javascript function
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> function createGraph(ip,ip2,catdata,seriesdata) { $(function () {/*from w w w.j av a 2 s.c o m*/ var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: ip2, type: 'line', marginRight: 130, marginBottom: 25 }, title: { text: ip, x: -20 //center }, subtitle: { text: 'Source: A.org', x: -20 }, xAxis: { categories: catdata }, yAxis: { title: { text: 'A' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y +'?C'; } }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -10, y: 100, borderWidth: 0 }, series: [{ name: 'Rate', data: seriesdata }], }); }); }); } $(document).ready(function() { createGraph("3333","123123",['04/10/2012','05/10/2012','06/10/2012','07/10/2012','08/10/2012','09/10/2012'],[98,98,97,96,96,94]); }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <div id="123123" style="width: 600px; height: 300px;"></div> </body> </html>