neovis.js icon indicating copy to clipboard operation
neovis.js copied to clipboard

viz.nodeToHtml not work now for 2.0.0 branch

Open TianMing2018 opened this issue 3 years ago • 4 comments
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

TianMing2018 avatar Mar 02 '22 15:03 TianMing2018

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

TianMing2018 avatar Mar 02 '22 15:03 TianMing2018

My bad, forgot to update readme 😅

thebestnom avatar Jun 30 '22 13:06 thebestnom

How to set the title which property to display?

iceabing avatar Nov 17 '22 07:11 iceabing

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

FStriewski avatar Apr 09 '24 08:04 FStriewski