Mag*_*o C 5 javascript cytoscape.js
我有一些cytoscape节点
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)'
})
...
Run Code Online (Sandbox Code Playgroud)
如何使内容包含两行或更多行以及2个或更多串联字符串?
...
'content': 'data(id)' + '<br>' + data('name') + '<br>test123',
...
Run Code Online (Sandbox Code Playgroud)
TIA
在样式表中:
text-wrap: wrap;
label: 'My multiline\nlabel';
Run Code Online (Sandbox Code Playgroud)
参见http://js.cytoscape.org/#style/labels