mirror of
https://gitee.com/antv/g6.git
synced 2024-12-15 18:11:08 +08:00
63 lines
1.3 KiB
HTML
63 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>插件-缩略图</title>
|
|
</head>
|
|
|
|
<body>
|
|
<div style="position: relative;">
|
|
<div id="mountNode"></div>
|
|
<div id="minimap" style="border: 1px solid #999; position: absolute; top: 0px;"></div>
|
|
</div>
|
|
<script src="../build/g6.js"></script>
|
|
<script src="../build/toolMinimap.js"></script>
|
|
<script>
|
|
const plugin = new G6.Plugins['tool.minimap']({
|
|
container: 'minimap',
|
|
width: 180,
|
|
height: 120
|
|
});
|
|
const data = {
|
|
nodes: [{
|
|
id: 'node0',
|
|
x: -100,
|
|
y: 200
|
|
}, {
|
|
id: 'node1',
|
|
x: 100,
|
|
y: 200
|
|
}, {
|
|
id: 'node2',
|
|
x: 300,
|
|
y: 200
|
|
}, {
|
|
id: 'node3',
|
|
x: 600,
|
|
y: 200
|
|
}],
|
|
edges: [{
|
|
target: 'node0',
|
|
source: 'node1'
|
|
}, {
|
|
target: 'node2',
|
|
source: 'node1'
|
|
}, {
|
|
target: 'node2',
|
|
source: 'node3'
|
|
}]
|
|
};
|
|
const graph = new G6.Graph({
|
|
container: 'mountNode',
|
|
fitView: 'cc',
|
|
height: window.innerHeight,
|
|
plugins: [plugin]
|
|
});
|
|
graph.read(data);
|
|
</script>
|
|
</body>
|
|
</html>
|