score:-1

Example (note: uses jQuery):

var $graphic = $('#graphic');
function drawGraphic() {
    var margin = { top: 10, right: 10, bottom: 30, left: 30 };
    var width = $graphic.width() - margin.left - margin.right;
    $graphic.empty();
    // ... code to create the chart ...
}
d3.csv("data.csv", function(data) {  //loading data, may differ
    // ... manipulate data here ...
    drawGraphic();
    window.onresize = drawGraphic;
}

A method based on D3 responsive charts described here: http://blog.apps.npr.org/2014/05/19/responsive-charts.html

My example is described here: http://bl.ocks.org/michalskop/2fa7d4c0ae029c36ba4e

See it in action here: http://bl.ocks.org/michalskop/raw/2fa7d4c0ae029c36ba4e/

My demo for Leaflet based responsive map: http://bl.ocks.org/michalskop/raw/001f6182db52d08f4925/


Related Query

More Query from same tag