nice() for beginning values of domain

8 views
Skip to first unread message

Jeff

unread,
Apr 30, 2015, 4:07:38 PM4/30/15
to d3...@googlegroups.com
I'm trying to round off values for the d3 scale() function. The nice() function works well for the ending domain value. However, I'm trying to find a way to round off the beginning domain value.

For example,

Say my y values are the following: [-80, 20, 197]

d3.scale() -> [-50, 0, 50, 100, 150]
d3.scale().nice() -> [-50, 0, 50, 100, 150, 200]

However what I would like it to be would be this:
[-100, -50, 0, 50, 100, 150, 200]

Does anyone know if there is an implementation for this? None of the examples I see for d3 really deal with negative numbers.

Thanks

- Jeff
Capture.JPG
Reply all
Reply to author
Forward
0 new messages