Commit 8fb84104e4c50c77d1ec66ebf207b057fa58f043

Authored by Dmitriy Zaporozhets
1 parent d40e6bc2

Use graph ticks to make axis more readable

app/assets/javascripts/stat_graph_contributors_graph.js.coffee
@@ -71,7 +71,7 @@ class window.ContributorsMasterGraph extends ContributorsGraph @@ -71,7 +71,7 @@ class window.ContributorsMasterGraph extends ContributorsGraph
71 super @width, @height 71 super @width, @height
72 create_axes: -> 72 create_axes: ->
73 @x_axis = d3.svg.axis().scale(@x).orient("bottom") 73 @x_axis = d3.svg.axis().scale(@x).orient("bottom")
74 - @y_axis = d3.svg.axis().scale(@y).orient("left") 74 + @y_axis = d3.svg.axis().scale(@y).orient("left").ticks(5)
75 create_svg: -> 75 create_svg: ->
76 @svg = d3.select("#contributors-master").append("svg") 76 @svg = d3.select("#contributors-master").append("svg")
77 .attr("width", @width + @MARGIN.left + @MARGIN.right) 77 .attr("width", @width + @MARGIN.left + @MARGIN.right)
@@ -130,8 +130,8 @@ class window.ContributorsAuthorGraph extends ContributorsGraph @@ -130,8 +130,8 @@ class window.ContributorsAuthorGraph extends ContributorsGraph
130 create_scale: -> 130 create_scale: ->
131 super @width, @height 131 super @width, @height
132 create_axes: -> 132 create_axes: ->
133 - @x_axis = d3.svg.axis().scale(@x).orient("bottom").tickFormat(d3.time.format("%m/%d"));  
134 - @y_axis = d3.svg.axis().scale(@y).orient("left") 133 + @x_axis = d3.svg.axis().scale(@x).orient("bottom").ticks(8)
  134 + @y_axis = d3.svg.axis().scale(@y).orient("left").ticks(5)
135 create_area: (x, y) -> 135 create_area: (x, y) ->
136 @area = d3.svg.area().x((d) -> 136 @area = d3.svg.area().x((d) ->
137 parseDate = d3.time.format("%Y-%m-%d").parse 137 parseDate = d3.time.format("%Y-%m-%d").parse
@@ -148,7 +148,7 @@ class window.ContributorsAuthorGraph extends ContributorsGraph @@ -148,7 +148,7 @@ class window.ContributorsAuthorGraph extends ContributorsGraph
148 .append("g") 148 .append("g")
149 .attr("transform", "translate(" + @MARGIN.left + "," + @MARGIN.top + ")") 149 .attr("transform", "translate(" + @MARGIN.left + "," + @MARGIN.top + ")")
150 draw_path: (data) -> 150 draw_path: (data) ->
151 - @svg.append("path").datum(data).attr("class", "area-contributor").attr("d", @area); 151 + @svg.append("path").datum(data).attr("class", "area-contributor").attr("d", @area)
152 draw: -> 152 draw: ->
153 @create_scale() 153 @create_scale()
154 @create_axes() 154 @create_axes()