Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

d3 unevenly distributed scaling

Tags:

axes

d3.js

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

like image 912
Gaurav Avatar asked Nov 23 '25 03:11

Gaurav


1 Answers

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.

like image 191
Adam Pearce Avatar answered Nov 25 '25 19:11

Adam Pearce