scaling

9 views
Skip to first unread message

Kasumi

unread,
Apr 19, 2014, 2:22:58 PM4/19/14
to d3...@googlegroups.com
Hi!
When I've got my

var h = 500;

then I have an array of numbers named "count", the biggest number is 627 (or something like that).
When I use scale.linear() on it like this:

var h1Scale = d3.scale.linear()
                            .domain([0,d3.max(count)])
                            .range([(h/5),0]);


It should scale from a domain of [0,627] to a range of [100, 0] right? With the height of the svg, which is 500, that shoud be the first fifth of my svg, right?

And how come, that when I use a font of size 20, with this:
var h6Scale = d3.scale.linear()
                            .domain([0,d3.max(count)])
                            .range([(4*h/5),h-20]);   


some of the words are cut off from the svg? I'm really at loss here, and I woul relly appreciate som help.
I can provide the whole code with sample of my data if needed.

Thank you :)
Reply all
Reply to author
Forward
0 new messages