handle resize events
This commit is contained in:
parent
b6ea47573f
commit
4581df14f1
|
@ -27,9 +27,28 @@ function getOffset( el ) {
|
|||
|
||||
var offset = getOffset(document.getElementById('chart'))
|
||||
|
||||
var w = window.innerWidth - offset.left,
|
||||
var w, h
|
||||
|
||||
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() {
|
||||
var s;
|
||||
if (style !== undefined)
|
||||
|
|
Loading…
Reference in a new issue