我正在尝试使用Neovis
库来可视化网页中的Neo4j
图形数据。
在Component.ts
import NeoVis from 'neovis.js/dist/neovis.js';
ngOnInit() {
this.draw();
}
draw() {
const config = {
container_id: 'viz',
server_url: 'bolt://localhost',
server_user: 'neo4j',
server_password: 'test'
};
const viz = new NeoVis.default(config);
viz.render();
}
<div id="viz"></div>
但是我在加载应用程序时遇到此错误ERROR TypeError: neovis_js_dist_neovis_js__WEBPACK_IMPORTED_MODULE_4___default.a.default is not a constructor
删除default
可以解决问题。添加密码查询图后工作正常
draw() {
const config = {
container_id: 'viz',
server_url: 'bolt://localhost',
server_user: 'neo4j',
server_password: 'test',
initial_cypher: 'Match (n)-[r]->(m) return n,r,m'
};
const viz = new NeoVis(config);
console.log(viz);
viz.render();
}