Javascript examples for highcharts:Line Chart
Add point to line chart
<html> <head> <title>Highcharts Demo</title> <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"> var series;//from w ww. j a va 2 s. c o m $(function drawCharts(numberOfPoint) { $(document).ready(function() { Highcharts.setOptions({ global: { useUTC: false } }); $('#container').highcharts({ chart: { type: 'line', animation: Highcharts.svg, // don't animate in old IE marginRight: 10, events: { load: function() { series = this.series[0]; }, } }, title: { text: '' }, xAxis: { title: { text: 'Jahre' }, startOnTick: true, tickPixelInterval: 40, min: 0, max: 10, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, yAxis: { title: { text: 'Verm?gen(in EUR)' }, labels: { enabled: true }, min: 0, max: 100, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { enabled: false, formatter: function() { return '<b>' + this.series.name + '</b><br/>' + Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' + Highcharts.numberFormat(this.y, 2); } }, legend: { enabled: false }, exporting: { enabled: false }, series: [{ name: 'Random data', data: [] }] }); }); $("#b").click(function() { var chart = $('#container').highcharts(); chart.series[0].addPoint([3, 3]); }) }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> <button id="b" href="#">AddPoints</button> </body> </html>