javascript - Highcharts X-axis labels on the side -
i'm using highcharts, , used able labels on side.. it's not working now, missing something? the red arrow want labels in following example
this code i'm using, add series in dynamic way.
credits: { enabled: false }, chart: { type: 'bar' }, xaxis: { categories: ['jan', 'feb'], labels: { enabled: true, } }, yaxis: { min: 0, max: 100, title: { text: 'score', align: 'high' } }, plotoptions: { bar: { datalabels: { enabled: true } } } }); // add series var detailchart = $('#chart-detail').highcharts(); var categories = new array; // set chart title detailchart.settitle({text: results[0].category}); $.each(results, function(i, data){ categories.push(data.name); detailchart.addseries({ name: data.name, data: [data.score] }); }); detailchart.xaxis[0].setcategories(["1", "2"]); $('#chart-detail').highcharts().reflow();
results array looks ( through ajax )
any appreciated! thank you
only need use 4 series, each of them single data point.
series: [{ name: 'year 1800', data: [107] }, { name: 'year 1900', data: [138] }, { name: 'year 2008', data: [973] },{ name: 'year 20098', data: [973] }]
example: http://jsfiddle.net/y9wzggc4/
Comments
Post a Comment