neo4j和neovis.js
图片能显示,但是节点和关系的字体显示不出来,能帮看看吗,这是什么情况
img
下面是源代码
```html
<!doctype html>
<html>
<head>
<title>Neovis.js Simple Example</title>
<style type="text/css">
html, body {
font: 16pt arial;
}
#viz {
width: 900px;
height: 700px;
border: 1px solid lightgray;
font: 22pt arial;
}
</style>
<script src="https://unpkg.com/neovis.js@2.0.2"></script>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
</head>
<script type="text/javascript">
let neoViz;
function draw() {
const config = {
containerId: "viz",
neo4j: {
serverUrl: 'bolt://localhost:7687',
serverUser: 'neo4j',
serverPassword: 'yanwei1003456/*',
},
labels: {
FactorsAffectingLifeSpan: {
caption: 'rocks' ,
size:'pagerank',
community:'community',
font: { size: 15, color: '#606266' },
},
Rocktype: {
caption: 'shale',
size:'pagerank',
community:'community',
font: { size: 10, color: '#606266' },
}
},
relationships: {
IsIncluding: {
caption: true,
thickness:'weight',
font: { size: 12, color: '#606266' }
}
},
initialCypher: 'MATCH (n)-[r:IsIncluding]->(m) RETURN *'
};
neoViz = new NeoVis.default(config);
neoViz.render();
console.log(neoViz);
}
</script>
<body onload="draw()">
<div id="viz"></div>
</body>
</html>
```
在labels和relationships中配置的font属性要生效,需要在CSS中定义对应的选择器:
css
.FactorsAffectingLifeSpan {
font-size: 15px;
color: #606266;
}
.Rocktype {
font-size: 10px;
color: #606266;
}
.IsIncluding {
font-size: 12px;
color: #606266;
}