Database Reference
In-Depth Information
var yg = svg.append("g")
.attr("class","y axis")
.attr("transform","translate(60,0)");
var yaxis = d3.svg.axis()
.ticks(5).orient("left")
.scale(y);
Whenever the domain is updated, the y-axis is redrawn to reflect these
changes:
if(data > y.domain()[1]) {
y.domain([0,data]);
yg.call(yaxis);
}
After applying a little bit of CSS styling, the bar chart should look like the
one in Figure 7.8 , implemented in dashboard/views/d3_ex2.jade :
.axis text { font: 10px sans-serif; }
.axis path, .axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
Figure 7.8
 
 
Search WWH ::




Custom Search