【发布时间】:2016-05-14 19:02:19
【问题描述】:
我正在尝试将节点的形状调整为节点文本的大小。我按照https://github.com/cytoscape/cytoscape.js/issues/649 的指示进行操作。然而:
- 形状总是以 height = width 结尾
- 所有形状的大小都是一样的。
- 形状大小似乎达到了无法增长的最大值。
(我不确定这是否与 dagre 布局有关。)
我正在使用以下带有 dagre 布局的库:
cytoscape.min.jsdagre.min.js-
cytoscape-dagre.jscontainer: 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, } }]
【问题讨论】:
标签: javascript layout graph cytoscape.js dagre