neovis.js
neovis.js copied to clipboard
viz.nodeToHtml not work now for 2.0.0 branch
trafficstars
an update is needed for 2.0.0 branch。 for example:
according to the example file advanced-example.html, .you need to customize lable through this way
labels: {
Character: {
label: 'pagerank',
group: 'community',
[NeoVis.NEOVIS_ADVANCED_CONFIG]: {
cypher: {
value: 'MATCH (n) WHERE id(n) = $id RETURN n.size',
},
function: {
title: NeoVis.objectToTitleHtml,
},
},
},
but we still got the suggestion to use (node) => viz.nodeToHtml(node, undefined) inside docs/index.html or docs/modules.html
maybe a update to the docs is more appropriate title to this issue
My bad, forgot to update readme 😅
How to set the title which property to display?
If you ended up here because you want to set a custom label for your nodes by using the advanced config. This worked for me:
// For a "Person" node that has "name" and "firstname" properties:
labels: {
Person: {
// label: "name", <-- I want to have a custom label but can only specifiy a key here
[Neovis.NEOVIS_ADVANCED_CONFIG]: {
static: {
//...
},
function: {
label: (node) =>
`${node.properties.name}, ${node.properties.firstname}`, // <--- Tweak this to your node properties and build your own label
},
},
},