Sha256: d3c721f02ede5df2a779550ff899eb15346ffa34d0fcfa9744048ebe130f2a3f

Contents?: true

Size: 1.82 KB

Versions: 18

Compression:

Stored size: 1.82 KB

Contents

# -*- encoding : utf-8 -*-
module GitStats
  module StatsView
    module Charts
      class ActivityCharts
        def initialize(repo)
          @repo = repo
          @activity = repo.activity
        end

        def activity_by_date(author)
          Chart.new do |f|
            f.date_column_chart(
                data: author.activity.by_date,
                title: :commits_by_date.t,
                y_text: :commits.t
            )
          end
        end

        def activity_by_hour(author)
          Chart.new do |f|
            f.simple_column_chart(
                title: :commits_by_hour.t,
                y_text: :commits.t,
                x_text: :hour.t,
                data_x: (0..23),
                data_y: author.activity.by_hour_array
            )
          end
        end

        def activity_by_wday(author)
          Chart.new do |f|
            f.simple_column_chart(
                title: :commits_by_wday.t,
                y_text: :commits.t,
                x_text: :day.t,
                data_x: I18n.t('date.abbr_day_names'),
                data_y: author.activity.by_wday_array
            )
          end
        end

        def activity_by_month(author)
          Chart.new do |f|
            f.simple_column_chart(
                title: :commits_by_month.t,
                y_text: :commits.t,
                x_text: :month.t,
                data_x: I18n.t('date.abbr_month_names')[1..-1],
                data_y: author.activity.by_month_array
            )
          end
        end

        def activity_by_year(author)
          Chart.new do |f|
            f.column_hash_chart(
                title: :commits_by_year.t,
                y_text: :commits.t,
                x_text: :year.t,
                data: author.activity.by_year
            )
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
git_stats-1.0.17 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.16 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.15 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.14 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.13 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.12 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.11 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.10 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.9 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.8 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.7 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.6 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.5 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.4 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.3 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.2 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.1 lib/git_stats/stats_view/charts/activity_charts.rb
git_stats-1.0.0 lib/git_stats/stats_view/charts/activity_charts.rb