re-render on window resize
This commit is contained in:
parent
b36ca9d87b
commit
6828a158f8
|
@ -76,8 +76,10 @@ module.exports =
|
|||
|
||||
# Render the D3 chart.
|
||||
'render': ([ actual, ideal ], cb) ->
|
||||
(target = document.querySelector('#graph')).innerHTML = ''
|
||||
|
||||
# Get available space.
|
||||
{ height, width } = document.querySelector('#graph').getBoundingClientRect()
|
||||
{ height, width } = target.getBoundingClientRect()
|
||||
|
||||
margin = { top: 30, right: 30, bottom: 40, left: 50 }
|
||||
width -= margin.left + margin.right
|
||||
|
|
|
@ -80,6 +80,9 @@ class exports.Repo
|
|||
render '#progress', 'progress', { progress }
|
||||
|
||||
# Render the chart.
|
||||
graph.render values, cb
|
||||
do doit = -> graph.render values, cb
|
||||
|
||||
# Watch window resize?
|
||||
window.onresize = doit if 'onresize' of window
|
||||
|
||||
], cb
|
Loading…
Reference in New Issue