admin管理员组

文章数量:1287972

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

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

Share Improve this question asked Jul 11, 2014 at 13:40 Magno CMagno C 2,1964 gold badges28 silver badges58 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

In your stylesheet:

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

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

本文标签: javascriptHow can I set a multiple text lines in CytoscapeJS node contentStack Overflow