I use the following to set up responsive SVG
outerHeight = 400; outerWidth = 600; var margin = {top: 20, right: 20, bottom: 30, left: 40}, width = outerWidth - margin.left - margin.right, height = outerHeight - margin.top - margin.bottom; var svg = d3.select("div#simulation-1") .append("svg") .attr("preserveAspectRatio", "xMinYMin meet") .attr("viewBox", "0 0 "+outerWidth+" "+outerHeight) .attr("class","svg");
This works great in Chrome. However, in IE11 and Firefox, the whole diagram is reduced (the axis and font are tiny), and the value for viewBox is
viewbox="0 0 1936 1056"
For some reason, he does not accept the indicated height and s. However, he still remains unanswered.
Included script: https://jsfiddle.net/4p73n364/
Any idea? Regards, Jean
source share