SVGTree | Handy JavaScript library for drawing trees | Graphics library
kandi X-RAY | SVGTree Summary
kandi X-RAY | SVGTree Summary
Handy JavaScript library for drawing trees using scalable vector graphics (SVG)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SVGTree
SVGTree Key Features
SVGTree Examples and Code Snippets
Community Discussions
Trending Discussions on SVGTree
QUESTION
I have a basic Leaflet Map in one div and a d3-collapsible tree in another div (based on this Fiddle):
The Map (right div) loads a GeoJSON, the D3 tree (left div) loads the corresponding hierarchical JSon data. When I now expand a node in the tree, the map elements also shift (see red arrow).
I tried to rename all class-names, variables and id's but the issue persists.
Here is a codepen with the data & code. I think it may have something to do with both leaflet and D3 using grouped SVG-elements (all in one ?) for nodes/features. I adjusted my tree to use
var svgTree =
without success..
If you cannot provide a specific solution to my problem, I would also be happy with a reference or example that demonstrates how to use D3 and Leaflet next to each other.
[Edit] Problem solved:
The Panning Function I tried to incorporate from Rob Schmuecker’s Block 7880033 needed both a tree svg (svgTree
) and a container svg (svgGroup
), which holds all the -elements. Finally, the centerNode function needs to call
svgTree.select("g").transition()
(and not d3.select("g")
or svgGroup.select("g")
)
Here is the updated code. The Code for the Leaflet map is in Body:
...ANSWER
Answered 2017-Apr-24 at 11:38In your centerNode
function, instead of:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install SVGTree
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page