mirror of
https://gitee.com/antv/g6.git
synced 2024-12-05 13:18:40 +08:00
60 lines
1.3 KiB
HTML
60 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">
|
|
<script src="./assets/jquery-3.2.1.min.js"></script>
|
|
<script src="../build/g6.js"></script>
|
|
<script src="../build/plugin.layout.forceAtlas2.js"></script>
|
|
<script src="../build/plugin.layout.circle.js"></script>
|
|
<script src="../build/plugin.util.dataCleaner.js"></script>
|
|
<script src="../build/plugin.layout.dagre.js"></script>
|
|
<script src="../build/plugin.tool.tooltip.js"></script>
|
|
<title>测试</title>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="mountNode"></div>
|
|
<script>
|
|
G6.registerNode('custom', {
|
|
getHtml(){
|
|
return '<div>3333</div>';
|
|
}
|
|
}, 'html');
|
|
const data = {
|
|
nodes: [{
|
|
id: 'node1',
|
|
x: 100,
|
|
y: 200
|
|
}, {
|
|
id: 'node2',
|
|
x: 300,
|
|
y: 200
|
|
}],
|
|
edges: [{
|
|
target: 'node2',
|
|
source: 'node1'
|
|
}]
|
|
};
|
|
const graph = new G6.Graph({
|
|
container: 'mountNode',
|
|
width: 500,
|
|
height: 500,
|
|
renderer: 'svg'
|
|
});
|
|
graph.node({
|
|
shape: 'custom'
|
|
});
|
|
graph.read(data);
|
|
setTimeout(()=>{
|
|
graph.update('node1', {
|
|
title: 'sss'
|
|
});
|
|
}, 1000);
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|