Skip to content

Commit

Permalink
Merge pull request #434 from stomar/fix_chart_time_labels
Browse files Browse the repository at this point in the history
Fix chart time labels
  • Loading branch information
sferik committed Jun 24, 2012
2 parents 5dd5c4d + eea22e1 commit 28dd56f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/helpers/chart_helper.rb
Expand Up @@ -26,17 +26,17 @@ 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,
:length_blank => 5
end
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)
Expand All @@ -49,9 +49,9 @@ def downloads_over_time(versions, days_ago = 90)
counts << count
end
{
:slug => version.slug,
:counts => counts.reverse,
:color => color_from_cycle(idx, versions.size)
:slug => version.slug,
:counts => counts.reverse,
:color => color_from_cycle(idx, versions.size)
}
end
end
Expand Down

0 comments on commit 28dd56f

Please sign in to comment.