cytoscape.js - How to change label of cytoscape nodes -


this newbie cytoscape.js question. nodes labeled using data(lbl) below, , dynamically switch pulling label from different data element, e.g. change 'label': 'data(lbl2)'

style:[  {    selector: 'node',    style: {      'background-color': 'data(color)',      'label': 'data(lbl)',      'font-size' : '25px',      'width' : 'data(size)',      'height' : 'data(size)'    } 

to honest not sure how iterate on nodes, let alone apply style change. had no trouble laying out nice graph using instructions provided, seems me guidance javascript controls quite telegraphic comparison. there no sample code see showing simple operations being performed.

use selectors in html/css. simplest case classes.

style: [   {     selector: 'node.foo',     style: {       'label': data(foo)     }   },   {     selector: 'node.bar',     style: {       'label': data(bar)     }   }   // ... ] 

and use classes functions:

node.removeclass('foo').addclass('bar') 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -