javascript - Dynamically add xaxis to an highcharts -
i have problem highcharts add dynamically x-axis chart generated highcharts.
why want add x-axis dynamically ? because graph can have unlimited numbers of series don't regenerate completly each time add serie.
since highcharts 3.0, "we" can add dynamically x-axis chart without recreate it. here reduced test, doesn't works. add yaxis, can't found way add xaxis same function ( http://api.highcharts.com/highcharts#chart.addaxis() )
$(function() { var chart = new highcharts.chart({ chart: { renderto: 'container9' }, xaxis: [{ categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] },{},{}], series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); console.log("initial number of xaxis : " +chart.xaxis.length); console.log("initial number of yaxis : " +chart.yaxis.length); $('#addaxis').click(function () { // function use : http://api.highcharts.com/highcharts#chart.addaxis() // should works, can't found how chart.addaxis({ categories: ['mon', 'tue', 'thi', 'fri'] },false);//try false paramater boolean true means xaxis , false means yaxis //neither of these 2 posibilities work. chart.addaxis({ categories: ['i', 'you', 'he', 'she', 'we', 'you', 'they'] },true);//try true paramater console.log("number of xaxis : " + chart.xaxis.length); // nothing more console.log("number of yaxis : " + chart.yaxis.length); // 2 more yaxis, want 1 add of xaxis //add x-axis dynamically, it's looking for. thank in advance. }); });
hope can me.
Comments
Post a Comment