Javascript examples for highcharts:Chart Configuration
Generate chart from html table
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> function x(){/*from w w w . j ava2s . c o m*/ $('#container').highcharts({ data: { table: document.getElementById('datatable') }, chart: { type: 'column' }, title: { text: 'Data extracted from a HTML table in the page' }, yAxis: { allowDecimals: false, title: { text: 'Units' } }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.point.y +' '+ this.point.name.toLowerCase(); } } }); } $(document).ready(function(){ x() $('#theform').submit(function(e){ e.preventDefault(); // make remove button and event var but = $('<button>remove</button>').click(function(){ $(this).parent().parent().remove(); }); // make button td var buttontd = $('<td></td>').append(but); // make row var tr = $('<tr><td>'+$('#1').val()+'</td><td>'+$('#2').val()+'</td><td>'+$('#3').val()+'</td></tr>')//.append(buttontd); // add row to table $('#datatable').append(tr); x(); // return false so form is not submitted return false; }); }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/data.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <form id="theform"> input something <input id="1" type="text"> <br> input something <input id="2" type="text"> <br> input something <input id="3" type="text"> <br> <input type="submit" value="Submit"> </form> <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> <table id="datatable"> <tbody> <tr> <th>heading 1</th> <th>heading 2</th> <th>heading 3</th> </tr> </tbody> </table> </body> </html>