3.2.21 • Published 2 months ago

webcmp-topo-chart-horizontal v3.2.21

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

webcmp-topo-chart-horizontal

拓扑图组件封装

Install

# run in terminal
yarn add webcmp-topo-chart-horizontal
# or
npm install webcmp-topo-chart-horizontal

Usage

import Fruchterman from 'webcmp-topo-chart-horizontal'

const fruchterman = new Fruchterman(dom)
fruchterman.render({
  hideExport: true,
  data: {
    nodes: [
      {
        id: '0e359bf67a182f5f58efa5075b113483',
        label: '节点',
        targetTypeName: 'deeeedeeeedeeeedeeeedeeeedeeee',
        icon: 'asset_node',
        showLink: false,
        targetType: 'node',
        link: false,
      },
    ],
    edges: [
      {
        source: '0e359bf67a182f5f58efa5075b113483',
        target: '0e359bf67a182f5f58efa5075b113483',
      },
    ],
  },
})

组件颜色控制

节点状态

1、默认状态 2、hover:鼠标 hover 上去之后的样式 3、hoverNeighbor:hover 节点的兄弟节点样式 4、select:节点被选中样式 5、neighbor:被选中节点的兄弟节点样式

修改默认状态样式

{
  "name": "节点1",
  "label": "修改节点默认样式",
  "id": "节点1",
  "shape": "diamond",
  "icon": "asset_system",
  "style": {
    "fill": "#E2453A",
    "stroke": "#E2453A",
    "lineWidth": 2
  }
}

修改 hover 状态样式

{
  "name": "节点1",
  "label": "修改节点默认样式",
  "id": "节点1",
  "shape": "diamond",
  "icon": "asset_system",
  "stateStyles": {
    "hover": {
      "fill": "#E2453A",
      "stroke": "#E2453A",
      "lineWidth": 2
    }
  }
}

修改 hoverNeighbor 状态样式

{
  "name": "节点1",
  "label": "修改节点默认样式",
  "id": "节点1",
  "shape": "diamond",
  "icon": "asset_system",
  "stateStyles": {
    "hoverNeighbor": {
      "stroke": "#E2453A",
      "fill": "#E2453A",
      "lineWidth": 2,
      "icon": {
        "stroke": "#fff",
        "fill": "#fff"
      }
    }
  }
}

修改 select 状态样式

{
  "name": "节点1",
  "label": "修改节点默认样式",
  "id": "节点1",
  "shape": "diamond",
  "icon": "asset_system",
  "stateStyles": {
    "select": {
      "fill": "#E2453A",
      "stroke": "#E2453A",
      "lineWidth": 2,
      "icon": {
        "stroke": "#fff",
        "fill": "#fff"
      }
    }
  }
}

修改 neighbor 状态样式

{
  "name": "节点1",
  "label": "修改节点默认样式",
  "id": "节点1",
  "shape": "diamond",
  "icon": "asset_system",
  "stateStyles": {
    "neighbor": {
      "stroke": "#E2453A",
      "fill": "#E2453A",
      "lineWidth": 2,
      "icon": {
        "stroke": "#fff",
        "fill": "#fff"
      }
    }
  }
}

连线状态

1、默认状态 2、select:节点 hover 或者选择时候的状态

修改默认状态样式

{
  "source": "0",
  "target": "2",
  "style": {
    "fill": "#E2453A",
    "stroke": "#E2453A",
    "lineWidth": 2
  }
}

修改 select 状态样式

{
  "source": "0",
  "target": "2",
  "stateStyles": {
    "select": {
      "fill": "#E2453A",
      "stroke": "#E2453A",
      "lineWidth": 2
    }
  }
}

整体例子

{
  "nodes": [
    {
      "name": "节点1",
      "label": "节点1",
      "id": "0",
      "shape": "diamond",
      "icon": "asset_system",
      "style": {
        "fill": "#E2453A",
        "stroke": "#E2453A",
        "lineWidth": 2
      }
    },
    {
      "name": "节点2",
      "label": "节点2",
      "id": "2",
      "shape": "diamond",
      "icon": "asset_system",
      "style": {
        "fill": "#E2453A",
        "stroke": "#E2453A",
        "lineWidth": 2
      },
      "stateStyles": {
        "neighbor": {
          "stroke": "#E2453A",
          "fill": "#E2453A",
          "lineWidth": 2,
          "icon": {
            "stroke": "#fff",
            "fill": "#fff"
          }
        },
        "hover": {
          "fill": "#E2453A",
          "stroke": "#E2453A",
          "lineWidth": 2
        },
        "select": {
          "fill": "#E2453A",
          "stroke": "#E2453A",
          "lineWidth": 2,
          "icon": {
            "stroke": "#fff",
            "fill": "#fff"
          }
        },
        "hoverNeighbor": {
          "stroke": "#E2453A",
          "fill": "#E2453A",
          "lineWidth": 2,
          "icon": {
            "stroke": "#fff",
            "fill": "#fff"
          }
        },
        "neighbor": {
          "stroke": "#E2453A",
          "fill": "#E2453A",
          "lineWidth": 2,
          "icon": {
            "stroke": "#fff",
            "fill": "#fff"
          }
        }
      }
    }
  ],
  "edges": [
    {
      "source": "0",
      "target": "2",
      "stateStyles": {
        "fill": "#E2453A",
        "stroke": "#E2453A",
        "lineWidth": 2,
        "icon": {
          "stroke": "#fff",
          "fill": "#fff"
        }
      }
    }
  ]
}
3.2.21

2 months ago

3.2.20

2 months ago

3.2.19

4 months ago

3.2.18

4 months ago

3.2.17

4 months ago

2.0.24-keta.6

6 months ago

2.0.24-keta.3

6 months ago

2.0.24-keta.5

6 months ago

2.0.24-keta.4

6 months ago

3.2.13

6 months ago

3.2.12

7 months ago

3.2.15

6 months ago

3.2.14

6 months ago

3.2.16

6 months ago

3.2.15-prerelease8

6 months ago

3.2.15-prerelease7

6 months ago

3.2.11

7 months ago

3.1.8

10 months ago

3.2.2

9 months ago

3.0.4

10 months ago

3.2.1

9 months ago

3.0.3

11 months ago

3.2.0

9 months ago

3.0.2

11 months ago

3.0.1

11 months ago

3.2.6

9 months ago

3.0.8

10 months ago

3.2.5

9 months ago

3.0.7

10 months ago

3.2.4

9 months ago

3.2.3

9 months ago

3.0.5

10 months ago

3.0.0

11 months ago

2.0.24-keta.1

8 months ago

2.0.24-keta.2

8 months ago

3.2.9

8 months ago

3.2.8

8 months ago

3.2.7

8 months ago

3.0.9

10 months ago

3.1.3

10 months ago

3.1.2

10 months ago

3.1.1

10 months ago

3.1.0

10 months ago

3.1.7

10 months ago

3.1.6

10 months ago

3.1.5

10 months ago

1.0.5-beta.12

11 months ago

1.0.5-beta.13

10 months ago

1.0.5-beta.14

10 months ago

3.2.10

8 months ago

2.0.23

11 months ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.5-beta.9

1 year ago

2.0.3

1 year ago

2.0.16

1 year ago

2.0.2

1 year ago

2.0.13

1 year ago

1.0.5-beta.7

1 year ago

2.0.5

1 year ago

2.0.14

1 year ago

1.0.5-beta.8

1 year ago

2.0.4

1 year ago

2.0.11

1 year ago

2.0.7

1 year ago

1.0.5-beta.5

1 year ago

2.0.12

1 year ago

1.0.5-beta.6

1 year ago

2.0.6

1 year ago

2.0.9

1 year ago

1.0.5-beta.3

1 year ago

2.0.10

1 year ago

2.0.8

1 year ago

1.0.5-beta.4

1 year ago

1.0.5-beta.1

1 year ago

1.0.5-beta.2

1 year ago

1.0.5-beta.0

1 year ago

2.0.0

1 year ago

1.0.5-beta.10

1 year ago

1.0.5-beta.11

1 year ago

2.0.19

1 year ago

2.0.17

1 year ago

2.0.18

1 year ago

2.0.22

12 months ago

2.0.20

1 year ago

2.0.21

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago