nvd3: remove y-axis tick labels from discrete bar chart

1,218 views
Skip to first unread message

Jonas Heyden

unread,
Jun 21, 2013, 5:30:41 AM6/21/13
to d3...@googlegroups.com
I am trying to remove y-axis tick labels from a discrete bar chart in nvd3.

I already looked into the nvd3 source, but can't find an obvious function I could change. Can anyone point me to the solution?

Blake Dietz

unread,
Jun 21, 2013, 10:56:57 AM6/21/13
to d3...@googlegroups.com
I'm not sure if you're referring to the actual ticks or to the associated tick text.  I'm assuming that you want to remove the associated tick text.  I would modify the associated css in order to get the effect that you want.  

Assuming you've created your svg component that you wish to draw, create a group and give the group the class labels of y and axis.  This will give you refined control over both axes.  

// Add the yAxis to the graph 
svg.append("g")
    .attr("class","y axis")
.attr("transform", "translate(" + margin.left + ", 0 )")
    .call(yAxis);


Associated CSS
.y.axis text{
    display:none;
}

Check out this fiddle to see an example:
Reply all
Reply to author
Forward
0 new messages