Javascript examples for highcharts:Column Chart
updating a series to have less categories than previously in column chart
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> $(window).load(function(){/*from w ww . j a va 2 s . c om*/ $(function() { var chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'column' }, xAxis: { categories: ['pizza', 'french fries'] }, series: [{ data: [55, 32] }] }); $('#update1').toggle(function() { chart.series[0].setData([55, 32, 17], false); chart.xAxis[0].setCategories(['pizza', 'french fries', 'nachos'], false); chart.redraw(); $(this).text('now, click again to switch back to 2 columns'); }, function () { try { chart.xAxis[0].setCategories(['pizza', 'french fries'], false); chart.series[0].setData([55, 32], false); chart.redraw(); } catch (e) { console.log(e); } $(this).text('update series, adding a new row'); }); }); }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.src.js"></script> <div id="container" style="height: 400px"></div> <button id="update1">update series, adding a new row</button> </body> </html>