swaggyP
swaggyP

Reputation: 365

D3js Y axis not displaying correctly

I am trying to display the y values to the left of the y-axis line in the following fiddle:

yAxis = d3.svg.axis()
  .scale(y)
  .tickSize(5)
  .orient('left')
  .tickSubdivide(true);

http://jsfiddle.net/3rL1uds1/

My problem is when I "orient" the values to the left, the values disappear whereas if I orient them to the right, they show up fine.

I tried adjusting the margins to no avail. I think it is a css issue but not sure how to go about fixing this now.

Upvotes: 1

Views: 1906

Answers (1)

Elijah
Elijah

Reputation: 4639

Your margin gets passed to the x() scale, you don't want to do this, instead use a fixed value:

svg.append("g").attr("class", "axis y").attr("transform", "translate (" + 10 + " 0)").call(yAxis)

Here's the updated fiddle: http://jsfiddle.net/3rL1uds1/1/

Upvotes: 1

Related Questions