Using ViewBox To Resize Svg Depending On The Window Size
I'm attempting to use ViewBox & preserveAspectRatio to automatically adjust my d3.svg.arc when the window size has changed ... var svg = d3.select('#chart').append('svg') .
Solution 1:
You are applying viewBox
and preserveAspectRatio
to the g
element, they need to be applied to the svg
element:
var svg = d3.select("#chart").append("svg")
.attr("viewBox", "0 0 700 500")
.attr("preserveAspectRatio", "xMinYMin meet")
.append("g")
.attr("transform", "translate(" + r + "," + r +") rotate(180) scale(-1, -1)");
Post a Comment for "Using ViewBox To Resize Svg Depending On The Window Size"