-
Notifications
You must be signed in to change notification settings - Fork 77
fix(forcedirected.js): make force directed graph zoomable and pannable #393
base: master
Are you sure you want to change the base?
fix(forcedirected.js): make force directed graph zoomable and pannable #393
Conversation
Deploy preview for superset-ui-plugins ready! Built with commit d7ba315 |
Codecov Report
@@ Coverage Diff @@
## master #393 +/- ##
=========================================
+ Coverage 1.48% 2.78% +1.29%
=========================================
Files 185 186 +1
Lines 5805 5827 +22
Branches 370 372 +2
=========================================
+ Hits 86 162 +76
+ Misses 5707 5638 -69
- Partials 12 27 +15
Continue to review full report at Codecov.
|
@@ -38,11 +38,18 @@ const propTypes = { | |||
/* Modified from http://bl.ocks.org/d3noob/5141278 */ | |||
function ForceDirected(element, props) { | |||
const { data, width, height, linkLength = 200, charge = -500 } = props; | |||
|
|||
let w = window.innerWidth; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The chart does not always have width
and height
being 100% of the window width
and height
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the input. I commited a version where width/height are inherited.
.attr('width', width) | ||
.attr('height', height); | ||
function resize() { | ||
const { innerWidth, innerHeight } = window; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using window
's innerWidth
and innerHeight
makes the chart expand beyond its supposed size.
💔 Breaking Changes
🏆 Enhancements
📜 Documentation
🐛 Bug Fix
Fix apache/superset#7246
Force directed graph can now be zoomed in/out and panned.
🏠 Internal