小编Rob*_*sca的帖子

Cytoscape.js 如何将节点形状为圆角矩形?

当尝试将 cytoscape.js 中的节点形状设置为 roundrectangle 时,我只得到一个普通矩形,没有圆角。我什至在 cytoscape.js 的“实时代码示例”中尝试过它。代码如下:

$(loadCy = function(){

  options = {
    showOverlay: false,
    minZoom: 0.5,
    maxZoom: 2,

    style: cytoscape.stylesheet()
      .selector('node')
        .css({
          'content': 'data(name)',
          'font-family': 'helvetica',
          'font-size': 14,
          'text-outline-width': 3,
          'text-outline-color': '#888',
          'text-valign': 'center',
          'color': '#fff',
          'width': 'mapData(weight, 30, 80, 20, 50)',
          'height': 'mapData(height, 0, 200, 10, 45)',
          'border-color': '#fff',
          'shape':'roundrectangle'
        })
      .selector(':selected')
        .css({
          'background-color': '#000',
          'line-color': '#000',
          'target-arrow-color': '#000',
          'text-outline-color': '#000'
        })
      .selector('edge')
        .css({
          'width': 2,
          'target-arrow-shape': 'triangle'
        })
    ,

    elements: {
      nodes: [
        {
          data: { id: …
Run Code Online (Sandbox Code Playgroud)

svg shapes cytoscape.js

5
推荐指数
1
解决办法
4451
查看次数

标签 统计

cytoscape.js ×1

shapes ×1

svg ×1