diff --git a/app/views/stats/index.html.erb b/app/views/stats/index.html.erb index 5f680b95..bbcbed1c 100644 --- a/app/views/stats/index.html.erb +++ b/app/views/stats/index.html.erb @@ -545,9 +545,10 @@
<% - # Use all-time stats - max_count = @all_time_stats.map(&:count).max - total_days = @all_time_stats.length + # Use last 6 months of stats to keep the chart readable and fitting width + chart_stats = @all_time_stats.last(185) + max_count = chart_stats.map(&:count).max + total_days = chart_stats.length # Fixed dimensions graph_height = 240 @@ -633,7 +634,7 @@ /> - <% @all_time_stats.each_with_index do |stat, index| %> + <% chart_stats.each_with_index do |stat, index| %> <% bar_height = (stat.count.to_f / max_count * (graph_height - bottom_margin - 10)).round x_pos = left_margin + (index * (bar_width + bar_spacing))