summaryrefslogtreecommitdiff
path: root/app/views/projects/graphs/commits.html.haml
blob: 78b4c1923dd4669f09be01b43727a22ef01c8e69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
= render 'head'

%p.lead
  Commit statistics for
  %strong #{@repository.root_ref}
  #{@commits_graph.start_date.strftime('%b %d')} - #{@commits_graph.end_date.strftime('%b %d')}

.row
  .col-md-6
    %ul
      %li
        %p.lead
          %strong #{@commits_graph.commits.size}
          commits during
          %strong #{@commits_graph.duration}
          days
      %li
        %p.lead
          Average
          %strong #{@commits_graph.commit_per_day}
          commits per day
      %li
        %p.lead
          Contributed by
          %strong #{@commits_graph.authors}
          authors
  .col-md-6
    %div
      %p.slead
        Commits per day of month
      %canvas#month-chart{width: 800, height: 400}
.row
  .col-md-6
    %div
      %p.slead
        Commits per day hour (UTC)
      %canvas#hour-chart{width: 800, height: 400}
  .col-md-6
    %div
      %p.slead
        Commits per weekday
      %canvas#weekday-chart{width: 800, height: 400}

:coffeescript
  data = {
    labels : #{@commits_per_time.keys.to_json},
    datasets : [{
      fillColor : "rgba(220,220,220,0.5)",
      strokeColor : "rgba(220,220,220,1)",
      pointColor : "rgba(220,220,220,1)",
      pointStrokeColor : "#EEE",
      data : #{@commits_per_time.values.to_json}
    }]
  }

  ctx = $("#hour-chart").get(0).getContext("2d");
  new Chart(ctx).Line(data,{"scaleOverlay": true, responsive: true, pointHitDetectionRadius: 2})

  data = {
    labels : #{@commits_per_week_days.keys.to_json},
    datasets : [{
      fillColor : "rgba(220,220,220,0.5)",
      strokeColor : "rgba(220,220,220,1)",
      pointColor : "rgba(220,220,220,1)",
      pointStrokeColor : "#EEE",
      data : #{@commits_per_week_days.values.to_json}
    }]
  }

  ctx = $("#weekday-chart").get(0).getContext("2d");
  new Chart(ctx).Line(data,{"scaleOverlay": true, responsive: true, pointHitDetectionRadius: 2})

  data = {
    labels : #{@commits_per_month.keys.to_json},
    datasets : [{
      fillColor : "rgba(220,220,220,0.5)",
      strokeColor : "rgba(220,220,220,1)",
      pointColor : "rgba(220,220,220,1)",
      pointStrokeColor : "#EEE",
      data : #{@commits_per_month.values.to_json}
    }]
  }

  ctx = $("#month-chart").get(0).getContext("2d");
  new Chart(ctx).Line(data, {"scaleOverlay": true, responsive: true, pointHitDetectionRadius: 2})