您好我试图使用JointJS库执行Hello world应用程序,如下所示:http: //www.jointjs.com/tutorial#hello-world 我已经下载了joint.js和joint.css文件我已经复制了HelloWorld教程中给出的代码在html文件中并从firefox浏览器(26.0)访问它但它没有按预期工作并在教程中显示.预计:应该有两个带链接的盒子.实际:浏览器上没有任何内容.Ater调试错误是:"NS_ERROR_FAILURE:"在joint.js中:
var bbox = this.el.getBBox();
Run Code Online (Sandbox Code Playgroud)
代码是:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="joint.css" />
<script src="joint.js"></script>
</head>
<body>
<script type="text/javascript">
var graph = new joint.dia.Graph;
var paper = new joint.dia.Paper({
el: $('#myholder'),
width: 600,
height: 200,
model: graph
});
var rect = new joint.shapes.basic.Rect({
position: { x: 100, y: 30 },
size: { width: 100, height: 30 },
attrs: { rect: { fill: 'blue' }, text: { text: 'my box', fill: 'white' } }
});
var rect2 = rect.clone();
rect2.translate(300);
var link = new joint.dia.Link({
source: { id: rect.id },
target: { id: rect2.id }
});
graph.addCells([rect, rect2, link]);
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
关心Ranganath
你错过了纸质对象的持有人.在开始<body>标记后面添加以下内容:
<div id="myholder"></div>
Run Code Online (Sandbox Code Playgroud)