Skip to content

Commit 1b471af

Browse files
author
David Emory
committed
feat(api): Support resizing of externally-managed SVG containers
1 parent da5320f commit 1b471af

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/display/display.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ export default class Display {
226226
}
227227

228228
resized () {
229-
var newWidth = this.el.clientWidth
230-
var newHeight = this.el.clientHeight
229+
var newWidth = this.el ? this.el.clientWidth : this.svgContainer.clientWidth
230+
var newHeight = this.el ? this.el.clientHeight : this.svgContainer.clientHeight
231231

232232
var xDomain = this.xScale.domain()
233233
var xFactor = newWidth / this.width

lib/transitive.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ export default class Transitive {
223223
.style('height', height + 'px')
224224
this.display.resized()
225225
}
226+
227+
/**
228+
* trigger a display resize action (for externally-managed SVG containers)
229+
*/
230+
231+
resized () {
232+
this.display.resized()
233+
}
226234
}
227235

228236
/**

0 commit comments

Comments
 (0)