JS新手。不知道为什么我在 Chrome 中加载它时会收到以下错误。该vivagraph.js
文件与 html 位于同一目录中。
<!DOCTYPE html>
<html>
<head>
<title>01. Create Graph. Vivagraph SVG tutorial.</title>
<script type="text/javascript" src="./vivagraph.js"></script>
<script type="text/javascript">
function main () {
// Step 1. We create a graph object.
var graph = Viva.Graph.graph();
// Step 2. We add nodes and edges to the graph:
graph.addLink(1, 2);
/* Note: graph.addLink() creates new nodes if they are not yet
present in the graph. Thus calling this method is equivalent to:
graph.addNode(1);
graph.addNode(2);
graph.addLink(1, 2);
*/
// Step 3. Render the graph.
var renderer = Viva.Graph.View.renderer(graph);
renderer.run();
}
</script>
<style type="text/css" media="screen">
html, body, svg { width: 100%; height: 100%;}
</style>
</head>
<body onload='main()'>
</body>
</html>