Browse files

Fix date label intervals on download charts. Closes #418

  • Loading branch information...
1 parent 4e4829c commit eea22e18c56fdf8edc1989b33dfb450d56190495 @stomar stomar committed Jun 24, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 app/helpers/chart_helper.rb
View
6 app/helpers/chart_helper.rb
@@ -26,7 +26,7 @@ def downloads_over_time_chart(versions, days_ago = 90)
range = [0, max]
lc.axis :y, :range => range
- lc.axis :x, :labels => downloads_over_time_labels
+ lc.axis :x, :labels => downloads_over_time_labels(days_ago)
lc.grid :x_step => 100.0 / 12.0,
:y_step => 100.0 / 15.0,
:length_segment => 1,
@@ -35,8 +35,8 @@ def downloads_over_time_chart(versions, days_ago = 90)
image_tag(chart.to_url(:chf => 'bg,s,FFFFFF00'), :alt => 'title')
end
- def downloads_over_time_labels
- [60, 40, 20, 0].map { |t| t.days.ago.to_date }
+ def downloads_over_time_labels(days_ago = 90)
+ [days_ago, days_ago*2/3, days_ago/3, 0].map { |t| t.days.ago.to_date }
end
def downloads_over_time(versions, days_ago = 90)

0 comments on commit eea22e1

Please sign in to comment.