源码复制成功复制失败全屏 复制 运行
Minimap 缩略图.g6-minimap {
position: absolute;
right: 0;
top: 6px;
background-color: #fff;
}
var minimap = new Minimap({
size: [window.innerWidth / 4, window.innerHeight / 4]
});
var graph = new G6.Graph({
container: 'mountNode',
width: window.innerWidth,
height: window.innerHeight,
plugins: [minimap],
defaultNode: {
size: [40, 40]
},
modes: {
default: ['zoom-canvas', 'drag-canvas']
}
});
$.getJSON('https://gw.alipayobjects.com/os/antvdemo/assets/data/g6-construction.json', function(data) {
data.nodes.forEach(function(node) {
node.id += '';
});
data.edges.forEach(function(edge) {
edge.source += '';
edge.target += '';
});
graph.read(data);
});