neo4j-contrib / neovis.js

Neo4j + vis.js = neovis.js. Graph visualizations in the browser with data from Neo4j.
Apache License 2.0
1.62k stars 324 forks source link

viz.nodeToHtml not work now for 2.0.0 branch #242

Open TianMing2018 opened 2 years ago

TianMing2018 commented 2 years ago

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

TianMing2018 commented 2 years ago

maybe a update to the docs is more appropriate title to this issue

thebestnom commented 2 years ago

My bad, forgot to update readme 😅

iceabing commented 1 year ago

How to set the title which property to display?

FStriewski commented 7 months ago

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
              },
            },
          },