gpt4 book ai didi

javascript - 为什么 vis.js 不显示任何内容

转载 作者:太空宇宙 更新时间:2023-11-04 15:49:11 25 4
gpt4 key购买 nike

我正在尝试 vis.js 并一直在使用可以在此处找到的示例: http://visjs.org/docs/network/

我使用了完全相同的 html 设置,如下所示:

<html>
<head>
<script type="text/javascript" src="../../dist/vis.js"></script>
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" />

<style type="text/css">
#mynetwork {
width: 600px;
height: 400px;
border: 1px solid lightgray;
}
</style>
</head>
<body>
<div id="mynetwork"></div>

<script type="text/javascript">
// create an array with nodes
var nodes = new vis.DataSet([
{id: 1, label: 'Node 1'},
{id: 2, label: 'Node 2'},
{id: 3, label: 'Node 3'},
{id: 4, label: 'Node 4'},
{id: 5, label: 'Node 5'}
]);

// create an array with edges
var edges = new vis.DataSet([
{from: 1, to: 3},
{from: 1, to: 2},
{from: 2, to: 4},
{from: 2, to: 5}
]);

// create a network
var container = document.getElementById('mynetwork');

// provide the data in the vis format
var data = {
nodes: nodes,
edges: edges
};
var options = {};

// initialize your network!
var network = new vis.Network(container, data, options);
</script>
</body>
</html>

存在 Javascript 和 CSS。在 Firefox 或 Chrome no Graphics 中测试文件时,没有任何反应。这里出了什么问题?

最佳答案

改变

<script type="text/javascript" src="../../dist/vis.js"></script>

<script type="text/javascript" src="../../dist/vis.min.js"></script>

解决了问题。

关于javascript - 为什么 vis.js 不显示任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43282203/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com