relation-network-graph

1.0.44 • Public • Published

relation-network-graph

数据图谱初始化、力导向计算、节点布局、渲染

智能图谱解决方案,关系图谱,网络图谱,D3force力导向图,知识图谱可视化,是关系网络中实体与关系与实体的表示,是将复杂的信息通过计算处理成能够结构化表示的数据

应用场景

人物关系、互联网关系、图书情报、知识产品、产业链图谱、企业图谱、医疗、汽车等

在线示例

基础展示

https://haojiey.github.io/relation-network-graph/example/index.html

可操作性功能展示

https://haojiey.github.io/relation-network-graph/example/page/operate.html

自定义可操作性功能展示

https://haojiey.github.io/relation-network-graph/example/page/operateCustom.html

颜色大小配置展示

https://haojiey.github.io/relation-network-graph/example/page/colorSize.html

特定范围内展示

https://haojiey.github.io/relation-network-graph/example/page/range.html

大数据量展示

https://haojiey.github.io/relation-network-graph/example/page/bigData.html

安装

使用 npm 或 yarn 安装

$ npm install relation-network-graph --save
$ yarn add relation-network-graph

使用静态资源

引入静态文件dist/relation-network-graph.js

文档

使用方式

import { createContainer } from 'relation-network-graph';
new createContainer(options:ContainerConfig)

配置说明

ContainerConfig

成员 说明 类型 是否必须 默认值
width 容器宽度 number 1000
height 容器高度 number 1000
containerName 所在容器元素使用id string
nodes 节点数据 Node[] []
links 节点间的关系数据 Link[] []
benchmark 数据基准点以数据的什么属性为基准 string id
background 容器背景色 string #F7FAFC
isShowMask 选中某个节点时其他节点是否出现暗淡效果 boolean true
isCustomMouse 是否支持节点自定义mouse事件 boolean false
toolbarData 点击节点周围出现扇形区域进行更多功能的操作(删除、连线、收起、展开等) toolbarData[] toolbarData
colors 节点颜色集合 string[] colors
activeColors 移入节点时高亮效果 string[] activeColors
nodeClick 点击节点时触发相应函数 Function(Node)
nodeMouseover 移入节点时触发相应函数(搭配isCustomMouse使用) Function(Node)
nodeMouseout 移除节点时触发相应函数(搭配isCustomMouse使用) Function(Node)
nodeMove 节点内移动时触发相应函数 Function(Node)
linkClick 点击节点间关系线时时触发相应函数 Function(Link)
zoomOptions 容器缩放配置 zoomOptions 0.5-1.5
linkOps 关系线配置 linkOps
layout 控制节点的显示,在特定范围内展示 layout

Node[]:

成员 说明 类型 是否必须 可用值
id 唯一id string|number
name 节点名 string
color 节点颜色 number [1,2,3]等
size 节点大小 number [1,2,3]
shape 节点形状 string 'circle'
props 属性 Array<any>
hide 是否隐藏 boolean false
isExtendedState 是否是扩展状态 boolean false

Link[]

成员 说明 类型 是否必须 可用值
id 唯一id string
label 关系名称 string
hide 是否隐藏 boolean false
color 关系颜色 string ['1','2','3']等
label 关系名称 string
source 源点基准id string|number
target 终点基准id string|number
sourceRadius 点的半径 number
targetRadius 点的半径 number
value 关系线的粗细 number
color 线条颜色 number [1,2,3]等
props 属性 Array<any>

zoomOptions

成员 说明 类型 是否必须 可用值
minScale 最小值 number 0-10
maxScale 最大值 number 0-10

linkOps

成员 说明 类型 是否必须 可用值
stroke 关系线的颜色 string
stroke-opacity 关系线的透明度 number 0-10

layout

成员 说明 类型 是否必须 可用值
x x轴缩小范围大小 number
y y轴缩小范围大小 number
simulation y轴作用力 number
distance 关系线长度 number
force 是否开启特定范围内展示 number

支持环境

IE / EdgeIE / Edge FirefoxFirefox ChromeChrome SafariSafari OperaOpera
10+ 52+ 15+ 5.1+ 15+

Package Sidebar

Install

npm i relation-network-graph

Weekly Downloads

2

Version

1.0.44

License

ISC

Unpacked Size

147 kB

Total Files

8

Last publish

Collaborators

  • jiejiangzi