Varun Singh
Varun Singh

Reputation: 320

How ticksize arguments are defined in d3 js when the orientation is top?

I was going through the following code. Here ticksize is passed a negative argument. I was thinking that the positive argument should be okay but it is not since it should draw a line from the top. I want to know why? Is it due to some internal transformation which may have took place?

var xAxis = d3.svg.axis()
.scale(x)
.orient("top")
.tickSize(-height - margin.bottom)
.tickFormat(format);

The code is the part of link: Mike Bostocks' Object Constancy Explanation. Thanks in advance.

Upvotes: 0

Views: 1645

Answers (1)

Robert Longson
Robert Longson

Reputation: 124324

Things that have a negative scale in SVG are drawn upside down. Tick's are scaled in d3 so they work the same way so if you have a positive tickSize it draws outside the axis line and if it's negative it's drawn inside the line instead.

Upvotes: 4

Related Questions