Reputation: 177
I'm using the Lazy HighCharts gem in my rails application and I have an array set up for my categories on my xAxis. I want to show just the first and last array, having the first appear on the left hand side and the last appear on the far right. Is this possible?
dates = [10,11,12,13,14,15,16]
@graph = LazyHighCharts::HighChart.new('graph') do |f|
f.xAxis(:categories => dates)
f.series(:type => 'spline', :name => 'Average', :data => [1,2,3,4,5,6,7], :color => '#b20838', marker: {enabled: false})
f.legend({:align => 'right', :y => 10, :verticalAlign => 'top', :floating => "true", :borderWidth => 0})
end
So instead of showing all dates on x-axis :
I would like the first and last array to show.
Upvotes: 0
Views: 417
Reputation: 45079
Try to use :tickPositions => [0, lengthOfCategories-1]
for xAxis.
Upvotes: 1
Reputation: 4776
If you can find out the first and last values of the labels and store them in variables before itself, then you can do some thing like this http://jsfiddle.net/E7GBd/ using
formatter: function(){}
Hope this will help you.
Upvotes: 0