baussman
baussman

Reputation: 65

d3.js width of graph

http://jsfiddle.net/BhrpA/1/embedded/result/

Why does the graph not extend the full 789px? (width of the black container div)

The SVG element is 789 but there is 100px or so of black space at the far right.

Thanks!

Upvotes: 3

Views: 301

Answers (1)

Bill
Bill

Reputation: 25565

Your x-domain isn't set up correctly. Since arrays are 0 based, your maximum index is length-1 not length. So if you change it to:

x=d3.scale.linear().domain([0,data.length-1]).range([0,w])

You'll see that it now goes the full length as expected.

Upvotes: 2

Related Questions