Skip to content

Commit

Permalink
fixes width resizing on small charts (closes #503)
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Jul 5, 2016
1 parent b780a17 commit e0d48aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
21 changes: 10 additions & 11 deletions src/viz/methods/resize.coffee
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
module.exports = {
"accepted" : [ Boolean ],
"value" : false,
"timeout": 400,
"process" : (value, vars) ->
module.exports =
accepted: [Boolean]
value: false
timeout: 400
process: (value, vars) ->
if !value
return false

resize = null;
resize = null

resizeEnd = ->
mainNode = vars.container.value.node().parentNode.getBoundingClientRect()

width = mainNode.width
height = mainNode.height

vars.width.value = width
vars.height.value = height
vars.self.width(width)
vars.self.height(height)

vars.self(vars.container.value)
vars.self.draw()

d3.select(window).on("resize." + vars.container.id, (e) =>
clearTimeout resize
resize = setTimeout resizeEnd, this.timeout
)

return value
}
value
2 changes: 1 addition & 1 deletion src/viz/types/helpers/graph/includes/axes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dataChange = (vars) ->
changed = vars.id.solo.changed or vars.id.mute.changed unless changed
return changed if changed

check = ["data", "time", "id", "depth", "type", "x", "y", "x2", "y2"]
check = ["data", "time", "id", "depth", "type", "width", "height", "x", "y", "x2", "y2"]
for k in check
if vars[k].changed
changed = true
Expand Down

0 comments on commit e0d48aa

Please sign in to comment.