Javascript examples for highcharts:Chart Configuration
destroy chart before writing a new chart
<html> <head> <title>Highcharts Stock Demo</title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <div id="container" style="height: 400px; min-width: 600px"></div> <script src="https://code.highcharts.com/stock/highstock.js"></script> <script src="https://code.highcharts.com/stock/modules/exporting.js"></script> <script type="text/javascript" src="https://www.highcharts.com/samples/data/usdeur.js"></script> <script type="text/javascript"> function init_graph() {//from w w w . j a v a 2 s. c o m var hc_options = { chart: { renderTo: 'container' }, series: [{ name: 'USD to EUR', data: usdeur }] }; var chart=new Highcharts.Chart(hc_options); } var sint = setInterval(function(){ Highcharts.charts[0] && Highcharts.charts[0].destroy(); init_graph(); }, 4000); </script> </body> </html>