summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/chart.js.coffee12
-rw-r--r--app/views/repositories/stats.html.haml9
2 files changed, 14 insertions, 7 deletions
diff --git a/app/assets/javascripts/chart.js.coffee b/app/assets/javascripts/chart.js.coffee
new file mode 100644
index 00000000000..7040ebc6c65
--- /dev/null
+++ b/app/assets/javascripts/chart.js.coffee
@@ -0,0 +1,12 @@
+@Chart =
+ labels: []
+ values: []
+
+ init: (labels, values, title) ->
+ r = Raphael('activity-chart')
+ r.text(160, 10, title).attr font: "13px sans-serif"
+ r.barchart(
+ 10, 10, 400, 160,
+ [values],
+ {colors:["#456"]}
+ ).label(labels, true)
diff --git a/app/views/repositories/stats.html.haml b/app/views/repositories/stats.html.haml
index dde35ea38aa..e8cf5eb908d 100644
--- a/app/views/repositories/stats.html.haml
+++ b/app/views/repositories/stats.html.haml
@@ -31,11 +31,6 @@
$(function(){
var labels = [#{@graph.labels.to_json}];
var commits = [#{@graph.commits.join(', ')}];
- var r = Raphael('activity-chart');
- r.text(160, 10, "Commit activity for last #{@graph.weeks} weeks").attr({ font: "13px sans-serif" });
- r.barchart(
- 10, 10, 400, 160,
- [commits],
- {colors:["#456"]}
- ).label(labels, true);
+ var title = "Commit activity for last #{@graph.weeks} weeks";
+ Chart.init(labels, commits, title);
})