dalejung / id3

interactive d3
Apache License 2.0
4 stars 0 forks source link

Add layouts. #22

Open dalejung opened 11 years ago

dalejung commented 11 years ago

Something as simple as a VerticalLayout that gives each Figure equal space and also updates with browser window size changes?

I do somewhat of the equivalent with:

function updateWindow() {
    var width = window.innerWidth - 60;
    var height = window.innerHeight * .40;
    fig.width(width).height(height);
    fig2.height(height/2).width(width);
    focus.width(width);
}

var doit;
window.onresize = function(){
  clearTimeout(doit);
  doit = setTimeout(updateWindow, 100);
};
dalejung commented 11 years ago

so the idea would be that the Layout object would be resonsible for setting the width()/height() for each of its children based on some rule.