1
我正在尝试调整节点的形状以适应节点文本的大小。我遵循https://github.com/cytoscape/cytoscape.js/issues/649的说明。但是:使用dagre布局调整cytoscape.js中的图形大小
- 形状总是最终与高度=宽度
- 所有形状的大小是相同的。
- 形状大小似乎达到它无法增长的最大值。
(我不知道这事做与dagre布局。)
我使用下列库与dagre布局:
cytoscape.min.js
dagre.min.js
cytoscape-dagre.js
container: document.getElementById('cy'), boxSelectionEnabled: false, autounselectify: true, layout: {name: 'dagre', rankDir: 'LR', align: 'LR'}, style: [{ selector: 'node', style: { 'content': 'data(name)', 'label': 'data(name)', 'text-opacity': 1, 'text-valign': 'center', 'text-halign': 'center', 'text-wrap': 'wrap', 'font-size': 9, 'background-color': '#AAA', 'shape':'rectangle', 'width': 'data(width)' * 50, 'height': 'data(height)' * 50 } },{ selector: 'edge', style: { 'width': 4, 'content': 'data(name)', 'target-arrow-shape': 'triangle', 'line-color': 'data(color)', 'text-wrap': 'wrap', 'target-arrow-color': 'data(color)', 'font-size': 10, } }]
由于最大。它现在有效。我在搜索这个网站,但不知何故忽略了该部分。这有很大帮助。再次感谢。 – Marcus