返回

图谱节点

发布时间:2022-12-24 19:01:03 353
# webkit# edge# 容器
<template>
<div id="mountNode"></div>
</template>

<script>
import G6 from "@antv/g6";
export default {
data() {
return {
gg: {
// 点集
nodes: [
{
id: "node1",
x: 100,
y: 600,
},
{
id: "node2",
x: 200,
y: 520,
},
{
id: "node3",
x: 100,
y: 400,
},
{
id: "node4",
x: 100,
y: 300,
},
],
// 边集
edges: [
// 表示一条从 node1 节点连接到 node2 节点的边
{
source: "node1",
target: "node2",
},
{
source: "node2",
target: "node3",
},
{
source: "node3",
target: "node4",
},
{
source: "node1",
target: "node3",
},
],
},
};
},
mounted() {
this.g6();
},
methods: {
g6() {
// 创建 G6 图实例
const graph = new G6.Graph({
container: "mountNode", // 指定图画布的容器 id,与第 9 行的容器对应
// 画布宽高
width: 1800,
height: 1500,
});
graph.data(this.gg);
graph.render();
},
},
};
</script>

<style>
#main {
width: 1000px;
height: 1000px;
}
</style>
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像
精选文章
thumb 中国研究员首次曝光美国国安局顶级后门—“方程式组织”
thumb 俄乌线上战争,网络攻击弥漫着数字硝烟
thumb 从网络安全角度了解俄罗斯入侵乌克兰的相关事件时间线
下一篇
html学习笔记三 选择器 2022-12-24 18:38:04