Я пытаюсь отобразить некоторые данные узла Neo4j в моем личном веб-приложении.
Я попробовал оттуда примеры github: https://github.com/neo4j-contrib/neovis.js/tree/master/examples
И прочитал все вопросы оттуда: https://github.com/neo4j-contrib/neovis.js/issues
Я просто хочу сначала отобразить что-то простое.
Это мой код:
<html>
<head>
<title>DataViz</title>
<style type="text/css">
#viz {
width: 900px;
height: 700px;
}
</style>
<script src="https://rawgit.com/neo4j-contrib/neovis.js/master/dist/neovis.js"></script>
</head>
<script>
function draw() {
var config = {}
var viz = new NeoVis.default(config);
viz.render();
}
</script>
<body onload="draw()">
<div id="viz"></div>
</body>
</html>
В моем коде config - это набор данных, который я бы отображал.
{
"comment": "AlchemyJS contributors",
"nodes": [
{
"id": 0,
"caption": "AlchemyJS",
"role": "project",
"fun_fact": "built almost entirely in D3",
"root": true
},
{
"id": 1,
"caption": "Huston Hedinger",
"github": "hustonhedinger",
"role": "Maintainer",
"fun_fact": "hooligan"
},
{
"id": 2,
"caption": "Grace Andrews",
"github": "Grace-Andrews",
"role": "Maintainer",
"fun_fact": "was born left handed, now right handed."
},
{
"id": 3,
"caption": "Isabella Jorissen",
"github": "ifjorissen",
"role": "Maintainer",
"fun_fact": "knows a lot of digits of pi. Also loves pie."
},
{
"id": 4,
"caption": "Matt Cox",
"github": "MDCox",
"role": "Maintainer",
"fun_fact": "is not fun"
},
{
"id": 5,
"caption": "Dave Torbeck",
"github": "DaveTorbeck",
"role": "Contributor",
"fun_fact": ""
}
],
"edges": [
{
"source": 1,
"target": 0,
"caption": "Maintains"
},
{
"source": 2,
"target": 0,
"caption": "Maintains"
},
{
"source": 3,
"target": 0,
"caption": "Maintains"
},
{
"source": 4,
"target": 0,
"caption": "Often Breaks"
},
{
"source": 5,
"target": 0,
"caption": "contributes"
}
]
}
Исходная конфигурация из примера:
{
container_id: "viz",
server_url: "bolt://54.88.38.186:32889",
server_user: "neo4j",
server_password: "change-guest-honks",
labels: {
"Troll": {
caption: "user_key",
size: "pagerank",
community: "community"
}
},
relationships: {
"RETWEETS": {
caption: false,
thickness: "count"
}
},
initial_cypher: "MATCH p=(:Troll)-[:RETWEETS]->(:Troll) RETURN p"
}
Я хочу напрямую отображать данные Neo4j в моем представлении, не запрашивая базу данных из моего клиента.