Skip to content
On this page

力导向图

静态数据

js
{
  "categories": [
    "类目0",
    "类目1",
    "类目2",
    "类目3"
  ],
  "series": [
    {
      "data": [
        {
          "id": "0",
          "name": "Myriel",
          "symbolSize": 59.12381,
          "x": 80,
          "y": 0,
          "value": 28.685715,
          "category": 0,
          "symbol": "http://124.71.147.50:9000/caster/upload/20211115/fa396e414628d388c3154b911b42f1f3.png"
        },
        {
          "id": "1",
          "name": "Napoleon",
          "symbolSize": 19.6,
          "x": 180,
          "y": 80,
          "value": 4,
          "category": 0
        },
        {
          "id": "2",
          "name": "MlleBaptistine",
          "symbolSize": 66.3,
          "x": 100,
          "y": -120,
          "value": 9.485714,
          "category": 1
        },
        {
          "id": "3",
          "name": "MmeMagloire",
          "symbolSize": 16.32,
          "x": 190,
          "y": -190,
          "value": 9.485714,
          "category": 1
        },
        {
          "id": "4",
          "name": "CountessDeLo",
          "symbolSize": 72.66,
          "x": -80,
          "y": 50,
          "value": 4,
          "category": 2
        },
        {
          "id": "5",
          "name": "Geborand",
          "symbolSize": 82.66,
          "x": -50,
          "y": -80,
          "value": 4,
          "category": 3
        },
        {
          "id": "6",
          "name": "Champtercier",
          "symbolSize": 19.666,
          "x": -180,
          "y": 50,
          "value": 4,
          "category": 2
        },
        {
          "id": "7",
          "name": "Cravatte",
          "symbolSize": 19.66,
          "x": -150,
          "y": -80,
          "value": 4,
          "category": 3
        },
        {
          "id": "8",
          "name": "Count",
          "symbolSize": 19.66,
          "x": -180,
          "y": 90,
          "value": 4,
          "category": 2
        },
        {
          "id": "9",
          "name": "OldMan",
          "symbolSize": 19.66,
          "x": 100,
          "y": 100,
          "value": 4,
          "category": 0
        }
      ],
      "links": [
        {
          "id": "0",
          "source": "1",
          "target": "0"
        },
        {
          "id": "1",
          "source": "2",
          "target": "0"
        },
        {
          "id": "2",
          "source": "3",
          "target": "0"
        },
        {
          "id": "3",
          "source": "3",
          "target": "2"
        },
        {
          "id": "4",
          "source": "4",
          "target": "0"
        },
        {
          "id": "5",
          "source": "5",
          "target": "0"
        },
        {
          "id": "6",
          "source": "6",
          "target": "4"
        },
        {
          "id": "7",
          "source": "7",
          "target": "5"
        },
        {
          "id": "8",
          "source": "8",
          "target": "4"
        },
        {
          "id": "9",
          "source": "9",
          "target": "0"
        }
      ]
    }
  ]
}
{
  "categories": [
    "类目0",
    "类目1",
    "类目2",
    "类目3"
  ],
  "series": [
    {
      "data": [
        {
          "id": "0",
          "name": "Myriel",
          "symbolSize": 59.12381,
          "x": 80,
          "y": 0,
          "value": 28.685715,
          "category": 0,
          "symbol": "http://124.71.147.50:9000/caster/upload/20211115/fa396e414628d388c3154b911b42f1f3.png"
        },
        {
          "id": "1",
          "name": "Napoleon",
          "symbolSize": 19.6,
          "x": 180,
          "y": 80,
          "value": 4,
          "category": 0
        },
        {
          "id": "2",
          "name": "MlleBaptistine",
          "symbolSize": 66.3,
          "x": 100,
          "y": -120,
          "value": 9.485714,
          "category": 1
        },
        {
          "id": "3",
          "name": "MmeMagloire",
          "symbolSize": 16.32,
          "x": 190,
          "y": -190,
          "value": 9.485714,
          "category": 1
        },
        {
          "id": "4",
          "name": "CountessDeLo",
          "symbolSize": 72.66,
          "x": -80,
          "y": 50,
          "value": 4,
          "category": 2
        },
        {
          "id": "5",
          "name": "Geborand",
          "symbolSize": 82.66,
          "x": -50,
          "y": -80,
          "value": 4,
          "category": 3
        },
        {
          "id": "6",
          "name": "Champtercier",
          "symbolSize": 19.666,
          "x": -180,
          "y": 50,
          "value": 4,
          "category": 2
        },
        {
          "id": "7",
          "name": "Cravatte",
          "symbolSize": 19.66,
          "x": -150,
          "y": -80,
          "value": 4,
          "category": 3
        },
        {
          "id": "8",
          "name": "Count",
          "symbolSize": 19.66,
          "x": -180,
          "y": 90,
          "value": 4,
          "category": 2
        },
        {
          "id": "9",
          "name": "OldMan",
          "symbolSize": 19.66,
          "x": 100,
          "y": 100,
          "value": 4,
          "category": 0
        }
      ],
      "links": [
        {
          "id": "0",
          "source": "1",
          "target": "0"
        },
        {
          "id": "1",
          "source": "2",
          "target": "0"
        },
        {
          "id": "2",
          "source": "3",
          "target": "0"
        },
        {
          "id": "3",
          "source": "3",
          "target": "2"
        },
        {
          "id": "4",
          "source": "4",
          "target": "0"
        },
        {
          "id": "5",
          "source": "5",
          "target": "0"
        },
        {
          "id": "6",
          "source": "6",
          "target": "4"
        },
        {
          "id": "7",
          "source": "7",
          "target": "5"
        },
        {
          "id": "8",
          "source": "8",
          "target": "4"
        },
        {
          "id": "9",
          "source": "9",
          "target": "0"
        }
      ]
    }
  ]
}

属性

参数说明类型
categories类目数据array
series图表数据值array

series

参数说明类型
data关系图的节点数据列表array
link节点间的关系数据array

data

参数说明类型
idstring
name数据项名称string
symbolSize节点标记的大小,可以设置成诸如 10 这样单一的数字,也可以用数组分开表示宽和高,例如 [20, 10] 表示标记宽为 20,高为 10numberarray
x节点的初始 x 值。在不指定的时候需要指明 layout 属性选择布局方式number
y节点的初始 y 值。在不指定的时候需要指明 layout 属性选择布局方式number
value数据项值numberarray
category数据项所在类目的 indexnumber
symbol该类目节点标记的图形string
参数说明类型
idstring
source边的源节点名称的字符串,也支持使用数字表示源节点的索引stringnumber
target边的目标节点名称的字符串,也支持使用数字表示源节点的索引stringnumber

其它配置项,可参考echarts