I want to show all labels on highchart you can see http://jsfiddle.net/valrecx/fj6d2/3021 that the months are not complete, the code only shows jan, aprl, july etc I want to show all the labels including those months that are in the middle of the visible months, jan, february, march, april etc.
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type:'bar'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec','Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
min: 6
},
plotOptions: {
series: {
pointPadding: 0.4,groupPadding:0.1 ,pointWidth:5
}
},
legend: {
verticalAlign: 'top',
y: 100,
align: 'right'
},
scrollbar: {
enabled: true
},
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,9.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}
]
});
How can I achieve that on highchart?
The easiest way to do this is to change the height of the
#container
div to at least500px
. Highcharts will show the rest of the labels since there will be enough room.You can make the font smaller, though in this case you will probably still need to increase the height to keep it readable. Here's how:
Here is a way to adjust the height of a graph based on the amount of data in the series. It might not be the best solution but it works. You'll have to adjust the values to your needs.