g6/demos/plugin-quadratic-curve.html
2018-07-12 21:38:24 +08:00

50 lines
1017 B
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 id="mountNode"></div>
<script src="../build/g6.js"></script>
<script src="../build/plugin.edge.quadraticCurve.js"></script>
<script>
const data = {
nodes: [{
id: 'node1',
x: 100,
y: 200
}, {
id: 'node2',
x: 300,
y: 200
}],
edges: [{
target: 'node2',
source: 'node1',
shape: 'quadraticCurve'
}, {
target: 'node1',
source: 'node2',
shape: 'quadraticCurve'
}]
};
const graph = new G6.Graph({
container: 'mountNode',
fitView: 'cc',
height: window.innerHeight,
});
graph.edge({
style: {
endArrow: true
}
});
graph.read(data);
</script>
</body>
</html>