Javascript examples for highcharts:Line Chart
update series if previous array only had null values in line chart
<html> <head> <title>update after null-values in series</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.highcharts.com/highcharts.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> </head> <body> <button onclick="firstData()">1st Data</button> <button onclick="secondData()">2nd Data</button> <button onclick="firstData()">Again 1st Data (without Series1)</button> <div id="chart1" style="height: 300px"></div> <script type="text/javascript"> var chart1;/* ww w . j a v a 2 s. c o m*/ chart1 = Highcharts.chart('chart1', { series: [{ data: [], },{ data: [], }] }); function firstData() { var series1 = [65.4, 72.7, 70, 60.6, 42.9]; var series2 = [26, 33, 10, 33, 7]; updateChart(series1, series2); } function secondData() { var series1 = [null, null, null, null]; var series2 = [0, 0, 0, 0, 0]; updateChart(series1, series2); } function updateChart(series1, series2){ chart1.update({ series: [{ data: series1 },{ data: series2, }] }); } </script> </body> </html>