Sha256: e3b0567b16215bad0eeb2cd9a221336b212ba5edba74e8052d0bfe9742ecfe63

Contents?: true

Size: 1.4 KB

Versions: 4

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

module GitStats
  module StatsView
    module Charts
      class RepoCharts
        def initialize(repo)
          @repo = repo
        end

        def files_by_extension
          Chart.new do |f|
            f.column_hash_chart(
              data: @repo.files_by_extension_count,
              title: :files_by_extension.t,
              y_text: :files.t
            )
          end
        end

        def lines_by_extension
          Chart.new do |f|
            f.column_hash_chart(
              data: @repo.lines_by_extension,
              title: :lines_by_extension.t,
              y_text: :lines.t
            )
          end
        end

        def files_by_date
          Chart.new do |f|
            f.date_chart(
              data: @repo.files_count_by_date,
              title: :files_by_date.t,
              y_text: :files.t
            )
          end
        end

        def lines_by_date
          Chart.new do |f|
            f.date_chart(
              data: @repo.lines_count_by_date,
              title: :lines_by_date.t,
              y_text: :lines.t
            )
          end
        end

        def comments_by_date
          Chart.new do |f|
            f.date_chart(
              data: @repo.comments_count_by_date,
              title: :comments_by_date.t,
              y_text: :comments.t
            )
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nova_git_stats-2.4.2 lib/git_stats/stats_view/charts/repo_charts.rb
nova_git_stats-2.4.1 lib/git_stats/stats_view/charts/repo_charts.rb
nova_git_stats-2.4.0 lib/git_stats/stats_view/charts/repo_charts.rb
nova_git_stats-2.3.0 lib/git_stats/stats_view/charts/repo_charts.rb