Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

d3.select.style not working on firefox

I just spent an embarrassing amount of time resolving this error and want to document the answer.

The following bit of code has the desired result on Chrome but not on Firefox:

svg=d3.select('svg').style({height : 100,width : 200})

Why?

like image 938
jdungan Avatar asked Dec 05 '15 15:12

jdungan


1 Answers

The answer

svg=d3.select('svg').style({height : 100 + "px", width : 200 + "px"})

Looks like Chrome decides to default to"px" while Firefox want you to be explicit.

Hope this helps anyone having the same issue.

like image 157
jdungan Avatar answered Sep 27 '22 21:09

jdungan