javascript - Strange behavior of Bootstrap Accordion Expand Height with D3 Graph -
I have a board packing layout of D3 within a bootstrap edition (where all tabs are expanded on load). I have tried to allow responsive layout using the following:
var vis = d3.select ("# Vis_container"). Insert ("svg: svg", "h2"). Etr ("width", '100%') .attr ("height", '100%') .attr ('View Box', '0' + + + + '+ H) .attr (' preserveAspectRatio ',' xMinYMin ') .append ("svg: g") .attr ("conversion", "translation (" + 0 "," + 0 + ")"); If you blur that tab in which there is a D3 layout and it is expanded again, then STVG's height is fine, but the container that is in it is not correctly Varies, that is not enough height. Full layout to show
Note: I used the width of the container as its height too, because the height is not available on the load.
var w = $ ('# vis_container') Width (), H = $ ('# widget container'). Width () can
I'm presenting it as an option here.
Actually, I gave the initial (and expectedly reasonable) value for width and height, and then added the code to resize it again, if desired, it will help you.
var vis = d3.select ("# Vis_container") .inert ("svg: svg", "h2") .attr ("width", h). attr ("height", w) ... var chart = $ ("#vis_container" gt; svg), aspect = chart.width () / chart.height (), container = chart.parent (); $ (Window) .on ("resize", function () {var targetWidth = container.width (); chart.attr ("width", targetWidth); chart.attr ("height", math width (targetWidth / aspect) ));}) Trigger ("size");
Comments
Post a Comment