Commit 6d07a97462eed7a61316871b47f1e214e8553c7a
1 parent
3fba2114
Exists in
master
and in
4 other branches
move js code related to repo barchart to chart.js.coffee
Showing
2 changed files
with
14 additions
and
7 deletions
Show diff stats
... | ... | @@ -0,0 +1,12 @@ |
1 | +@Chart = | |
2 | + labels: [] | |
3 | + values: [] | |
4 | + | |
5 | + init: (labels, values, title) -> | |
6 | + r = Raphael('activity-chart') | |
7 | + r.text(160, 10, title).attr font: "13px sans-serif" | |
8 | + r.barchart( | |
9 | + 10, 10, 400, 160, | |
10 | + [values], | |
11 | + {colors:["#456"]} | |
12 | + ).label(labels, true) | ... | ... |
app/views/repositories/stats.html.haml
... | ... | @@ -31,11 +31,6 @@ |
31 | 31 | $(function(){ |
32 | 32 | var labels = [#{@graph.labels.to_json}]; |
33 | 33 | var commits = [#{@graph.commits.join(', ')}]; |
34 | - var r = Raphael('activity-chart'); | |
35 | - r.text(160, 10, "Commit activity for last #{@graph.weeks} weeks").attr({ font: "13px sans-serif" }); | |
36 | - r.barchart( | |
37 | - 10, 10, 400, 160, | |
38 | - [commits], | |
39 | - {colors:["#456"]} | |
40 | - ).label(labels, true); | |
34 | + var title = "Commit activity for last #{@graph.weeks} weeks"; | |
35 | + Chart.init(labels, commits, title); | |
41 | 36 | }) | ... | ... |