handle resize events

alfred-data
Nils Schneider 2012-06-16 04:49:35 +02:00
parent b6ea47573f
commit 4581df14f1
1 changed files with 21 additions and 2 deletions

View File

@ -27,8 +27,27 @@ function getOffset( el ) {
var offset = getOffset(document.getElementById('chart')) var offset = getOffset(document.getElementById('chart'))
var w = window.innerWidth - offset.left, var w, h
h = window.innerHeight - offset.top - 1
resize()
window.onresize = resize
function resize() {
var offset = getOffset(document.getElementById('chart'))
w = window.innerWidth - offset.left
h = window.innerHeight - offset.top - 1
d3.select("#chart")
.attr("width", w).attr("height", h)
if (vis)
vis.attr("width", w).attr("height", h)
if (force)
force.size([w, h]).start()
}
function next_style() { function next_style() {
var s; var s;