Reputation: 489
As you can see , I'm using HighStock of HighCharts now in order to have scroll bar.
I want to set max number of xAxis. It works if I code like this:
xAxis: {
max: 8
categories: data.categories
}
Here is the rendering:
But when it concern to some data that hasn't so many xAxis data , it will show like this :
What I want to realize is that when the data is less than a certain number,for example, 8, It will occupy the chart instead of leaving so many blank.
Here is the pic:
Upvotes: 0
Views: 58
Reputation: 37588
The solution is check if categories array is bigger than 8, if not then set maximum value as categories length
xAxis: {
max: categories.length < 8 ? categories.length - 1: 8,
categories: categories
},
Example:
Upvotes: 1