Gaurav
Gaurav

Reputation: 627

d3 unevenly distributed scaling

any suggestions for drawing axes with unequal spacing between the values. For instance I am currently drawing axes using:

yScale = d3.scale.linear().domain([0, 60000]).range([height, 0])

I need more spacing between 0 and 5000 than distributing all the data points equally

Upvotes: 3

Views: 1948

Answers (1)

Adam Pearce
Adam Pearce

Reputation: 9293

Try using a polylinear scale:

yScale = d3.scale.linear().domain([0, 5000, 60000]).range([height, height/2, 0])

The range (0, 5000) and (5000, 60000) will both be given the same amount of space.

Upvotes: 9

Related Questions