最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue 集成 vis-network 實(shí)現(xiàn)網(wǎng)絡(luò)拓?fù)鋱D的方法

 更新時(shí)間:2019年08月07日 10:33:11   作者:hucoke  
這篇文章主要介紹了vue 集成 vis-network 實(shí)現(xiàn)網(wǎng)絡(luò)拓?fù)鋱D的方法,本文通過實(shí)例代碼給大家介紹的非常詳細(xì) ,需要的朋友可以參考下

vis.js  網(wǎng)站

https://visjs.org/

vs  code 下安裝命令

npm install vis-network

在vue  下引入 vis-network組件

const vis = require("vis-network/dist/vis-network.min.js");
require("vis-network/dist/vis-network.min.css");

例子代碼使用

let DIR = "/jtopo/";
let nodes = [
{ id: 1, shape: "circularImage", image: DIR + "server.png" },
{ id: 2, shape: "circularImage", image: DIR + "server.png" },
{ id: 3, shape: "circularImage", image: DIR + "server.png" },
{
id: 4,
shape: "circularImage",
image: DIR + "gather.png",
label: "pictures by this guy!"
},
{ id: 5, shape: "circularImage", image: DIR + "wanjet.png" },
{ id: 6, shape: "circularImage", image: DIR + "center.png" },
{ id: 7, shape: "circularImage", image: DIR + "cloud.png" },
{ id: 8, shape: "circularImage", image: DIR + "center.png" },
{ id: 9, shape: "circularImage", image: DIR + "wanjet.png" },
{ id: 10, shape: "circularImage", image: DIR + "gather.png" }
// { id: 11, shape: "circularImage", image: DIR + "11.png" },
// { id: 12, shape: "circularImage", image: DIR + "12.png" },
// { id: 13, shape: "circularImage", image: DIR + "13.png" },
// { id: 14, shape: "circularImage", image: DIR + "14.png" },
// {
// id: 15,
// shape: "circularImage",
// image: DIR + "missing.png",
// brokenImage: DIR + "missingBrokenImage.png",
// label: "when images\nfail\nto load"
// },
// {
// id: 16,
// shape: "circularImage",
// image: DIR + "anotherMissing.png",
// brokenImage: DIR + "9.png",
// label: "fallback image in action"
// }
];
let edges = [
{ from: 1, to: 4 },
{ from: 2, to: 4 },
{ from: 3, to: 4 },
{ from: 4, to: 5 },
{ from: 5, to: 6 },
{ from: 6, to: 7 },
{ from: 8, to: 7 },
{ from: 9, to: 8 },
{ from: 10, to: 9 }
// { from: 8, to: 10 },
// { from: 10, to: 11 },
// { from: 11, to: 12 },
// { from: 12, to: 13 },
// { from: 13, to: 14 },
// { from: 9, to: 16 }
];
for (let i = 1; i <= 100; i++) {
num = i + 10;
nodes.push({
id: num,
label: num.toString()
});
edges.push({ from: num, to: 10 });
}
let data = {
nodes: nodes,
edges: edges
};
let container = document.getElementById("mynetwork");
//let options = {};
let options = {
nodes: {
font: {
color: "white", //字體的顏色
size: 30 //顯示字體大小
},
scaling: {
min: 16,
max: 32 //縮放效果比例
},
borderWidth: 0,
color: {
border: "white",
background: "white" //若是引用圖標(biāo),背景顏色
}
},
groups: {
ws: {
//系統(tǒng)定義的形狀 dot等 這些官網(wǎng)都可以找到
shape: "dot",
color: "white"
}
},
edges: {
//連接線的樣式
color: {
color: "white",
highlight: "white",
hover: "#848484",
inherit: "from",
opacity: 1.0
}
},
layout: {
randomSeed: 1 //配置每次生成的節(jié)點(diǎn)位置都一樣,參數(shù)為數(shù)字1、2等
},
physics: {
// barnesHut: { gravitationalConstant: -30000 },
barnesHut: {
gravitationalConstant: -80000,
springConstant: 0.001,
springLength: 200
},
stabilization: false
//{ iterations: 2500 }
},
interaction: {
// navigationButtons: true,
hover: true, //鼠標(biāo)移過后加粗該節(jié)點(diǎn)和連接線
selectConnectedEdges: false, //選擇節(jié)點(diǎn)后是否顯示連接線
hoverConnectedEdges: false, //鼠標(biāo)滑動(dòng)節(jié)點(diǎn)后是否顯示連接線
tooltipDelay: 200,
zoomView: true //是否能縮放畫布
},
edges: {
shadow: true, //連接線陰影配置
smooth: true //是否顯示方向箭頭
// arrows: {to : true }//箭頭指向from節(jié)點(diǎn)
}
};
that.network = new vis.Network(container, data, options);
that.network.on("click", function(params) {});

設(shè)置 stabilization: false  可以快速生成10000個(gè)節(jié)點(diǎn)

總結(jié)

以上所述是小編給大家介紹的vue 集成 vis-network 實(shí)現(xiàn)網(wǎng)絡(luò)拓?fù)鋱D的方法,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

相關(guān)文章

最新評(píng)論

大荔县| 屏边| 庆城县| 五河县| 和政县| 汉中市| 蛟河市| 丰顺县| 马龙县| 佳木斯市| 喀喇沁旗| 东平县| 天等县| 镶黄旗| 黑河市| 辛集市| 宁陕县| 行唐县| 明星| 孟村| 体育| 天峨县| 化隆| 德惠市| 乌鲁木齐县| 三亚市| 天等县| 钟祥市| 富顺县| 福州市| 新沂市| 天祝| 类乌齐县| 鄢陵县| 新泰市| 无极县| 开阳县| 乡宁县| 龙口市| 额敏县| 望谟县|