Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set a multiple text lines in Cytoscape.JS node content?

I have some cytoscape nodes with

  style: cytoscape.stylesheet()
    .selector('node')
      .css({
        'border-color': '#0266C8',
        'border-width' : '1px',
        'shape': 'data(faveShape)',
        'width': '80px',
        'font-family' : 'Consolas',
        'font-size' : '10px',
        'content': 'data(id)',
        'text-valign': 'center',
        'background-color': 'data(faveColor)',
        'color': 'data(textColor)'
      })
      ...

How can I have a content with two or more lines and 2 or more concatenated strings?

...
'content': 'data(id)' + '<br>' + data('name') + '<br>test123',
...

TIA

like image 881
Magno C Avatar asked Jul 11 '14 13:07

Magno C


1 Answers

In your stylesheet:

text-wrap: wrap;
label: 'My multiline\nlabel';

See http://js.cytoscape.org/#style/labels

like image 156
maxkfranz Avatar answered Nov 15 '22 16:11

maxkfranz