OSDN Git Service

show commits count when hover chart on stats page
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Wed, 3 Apr 2013 20:32:36 +0000 (23:32 +0300)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Wed, 3 Apr 2013 20:32:36 +0000 (23:32 +0300)
app/assets/javascripts/chart.js.coffee
app/assets/stylesheets/common.scss
app/views/repositories/stats.html.haml

index 7040ebc..989f48e 100644 (file)
@@ -4,9 +4,18 @@
 
   init: (labels, values, title) ->
     r = Raphael('activity-chart')
+
+    fin = ->
+      @flag = r.popup(@bar.x, @bar.y, @bar.value or "0").insertBefore(this)
+
+    fout = ->
+      @flag.animate
+        opacity: 0, 300, -> @remove()
+
     r.text(160, 10, title).attr font: "13px sans-serif"
     r.barchart(
-      10, 10, 400, 160,
+      10, 20, 560, 200,
       [values],
       {colors:["#456"]}
     ).label(labels, true)
+      .hover(fin, fout)
index 4e7aa96..0f66536 100644 (file)
@@ -555,3 +555,8 @@ img.emoji {
   text-shadow: 0 1px 1px #111;
   font-weight: normal;
 }
+
+.chart {
+  overflow: hidden;
+  height: 220px;
+}
index e8cf5eb..d448c66 100644 (file)
@@ -1,8 +1,8 @@
 = render "commits/head"
 .row
-  .span5
-    %h4
-      Stats:
+  .span6
+    %div#activity-chart.chart
+    %hr
     %p
       %b Total commits:
       %span= @stats.commits_count
@@ -13,9 +13,8 @@
       %b Authors:
       %span= @stats.authors_count
 
-    %br
-    %div#activity-chart
-  .span7
+
+  .span6
     %h4 Top 50 Committers:
     %ol.styled
       - @stats.authors[0...50].each do |author|