[英]D3 geo node plotting on map?
I've recently created this D3 map which I had intended to put nodes on the map with links between each node. 我最近创建了这个D3地图,我打算将节点放置在地图上,并在每个节点之间建立链接。 However I don't know how to do this without using force layout.
但是我不知道如何不使用强制布局。 So far I have created a map of the world using d3 geo map.
到目前为止,我已经使用d3地理地图创建了世界地图。 I have seen a couple of examples of the lines eg http://datamaps.github.io/old.html but these don't have nodes on the end of them.
我已经看到了几行示例,例如http://datamaps.github.io/old.html,但这些示例在末尾没有节点。 I've put my version on JSFiddle which can be found here: http://jsfiddle.net/GarrettUK/n396w4vq/2/ .
我已经将我的版本放在JSFiddle上,可以在这里找到: http : //jsfiddle.net/GarrettUK/n396w4vq/2/ 。
I'm sure the way to do the lines would be like this: 我确定行的方式将是这样的:
var election = new Datamap({
scope: 'world',
element: document.getElementById('arcs'),
projection: 'mercator'
});
I would refer you back to the Data Maps arc tutorial. 我会让您回到Data Maps arc教程中。
http://datamaps.github.io/ http://datamaps.github.io/
As far a creating nodes, you could always just append an image to your map using the d3.append and then decide what attributes if any to assign those images. 就创建节点而言,您始终可以仅使用d3.append将图像附加到地图上,然后确定要分配这些图像的属性(如果有)。 If your looking for the classic node, just append a circle by doing something like this.
如果您正在寻找经典节点,只需执行以下操作即可添加一个圆圈。
var img = g.append("svg:image")
.attr("xlink:href", "circle")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.