javascript - Update HighCharts every 5 seconds -
i using code render highchart:
<script> var chart = new highcharts.chart({ chart: { renderto: 'container1', title: '', type: 'column' }, xaxis: { categories: ["<?php echo join($data0, '","') ?>"], title: { text: 'month' } }, yaxis: { title: { text: 'orders' } }, series: [{ name: '<?php echo date("y",strtotime("-1 year")); ?>', color: '#666666', data: [<?php echo join($data1, ',') ?>] }, { name: '<?php echo date("y"); ?>', color: '#2196f3', data: [<?php echo join($data2, ',') ?>] }], credits: { enabled: false }, title: { text: '' } }); </script>
how can update every 5 seconds , show indication on chart if changes?
try
setinterval(function(){ chart.series[0].update({ data: [<?php echo join($data1, ',') ?>] }, true); chart.series[1].update({ data: [<?php echo join($data2, ',') ?>] }, true); }, 5000);
Comments
Post a Comment