cytoscape.js没有导入样式

时间:2016-07-13 09:49:23

标签: cytoscape.js cytoscape

我使用cytoscape.js 2.7.5显示由Cytoscape Desktop导出的图形,将graph.cyjs转换为包含#include <iostream> using namespace std; enum e1 { e1a }; enum class ec1 { ec1a }; enum e2 { e2a = 'a' , e2b = sizeof(e2a) // <-- here the type of e2a is still char }; // <-- here the type of e2a becomes the same as the type of e2 (i.e. int) enum class ec2 { ec2a = 'a' }; int main() { cout << "plain enum:" << sizeof(e1a) << endl; cout << "enum class:" << sizeof(ec1::ec1a) << endl; cout << "char initialized plain enum:" << sizeof(e2a) << " but e2b=" << e2b <<endl; cout << "char initialized enum class:" << sizeof(ec2::ec2a) << endl; } 的Javascript文件graph.js。使用以下HTML我看到节点和边缘,但不导入样式(颜色,用作节点名称的属性)。我怎样才能导入样式?

plain enum:4
enum class:4
char initialized plain enum:4 but e2b=1
char initialized enum class:4

1 个答案:

答案 0 :(得分:0)

显然,Cytoscape Desktop不会在其.csjs文件中保存样式信息,因此必须单独导出和导入:

<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
 <script src="cytoscape.js"></script>
 <script src="graph.js"></script>
 <script src="style.js"></script>
</head>
<body>
<div id="cy" style="width:100%;height:100vh;"></div>
<script>
var cy = cytoscape({
  container: document.getElementById('cy'),
    style: style[0].style
    });
cy.add(graph.elements);
</script>
</body>
</html>