Recently, I've encountered an issue with the following code snippet:
d3.xml("https://crossorigin.me/https://svgshare.com/i/5w9.svg").mimeType("image/svg+xml").get(function(error, xml) {
if (error) throw error;
document.body.appendChild(xml.documentElement);
let test = document.querySelector('svg')
test.setAttribute("viewBox", "-100 -100 200000 60000");
});
You can also find the code on JSFiddle here.
My expectation was that setting the viewBox parameters to -100, -100, 200000, and 60000 respectively would scale the image properly. However, when I implemented it, the SVG appeared way too large to fit in the designated view box. It required a significant amount of scrolling before any content became visible. I suspect that my understanding of how the viewBox attribute functions is flawed. Can anyone provide guidance on what the correct values should be?