关系图谱后端不给指向性字段使用children
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { line-height: 1.5; margin-top: 35px; margin-bottom: 10px; padding-bottom: 5px }
.markdown-body h1 { font-size: 24px; line-height: 38px; margin-bottom: 5px }
.markdown-body h2 { font-size: 22px; line-height: 34px; padding-bottom: 12px; border-bottom: 1px solid rgba(236, 236, 236, 1) }
.markdown-body h3 { font-size: 20px; line-height: 28px }
.markdown-body h4 { font-size: 18px; line-height: 26px }
.markdown-body h5 { font-size: 17px; line-height: 24px }
.markdown-body h6 { font-size: 16px; line-height: 24px }
.markdown-body p { line-height: inherit; margin-top: 22px; margin-bottom: 22px }
.markdown-body img { max-width: 100% }
.markdown-body hr { border-top: 1px solid rgba(221, 221, 221, 1); border-right: none; border-bottom: none; border-left: none; margin-top: 32px; margin-bottom: 32px }
.markdown-body code { border-radius: 2px; overflow-x: auto; background-color: rgba(255, 245, 245, 1); color: rgba(255, 80, 44, 1); font-size: 0.87em; padding: 0.065em 0.4em }
.markdown-body code, .markdown-body pre { font-family: Menlo, Monaco, Consolas, Courier New, monospace }
.markdown-body pre { overflow: auto; position: relative; line-height: 1.75 }
.markdown-body pre>code { font-size: 12px; padding: 15px 12px; margin: 0; word-break: normal; display: block; overflow-x: auto; color: rgba(51, 51, 51, 1); background: rgba(248, 248, 248, 1) }
.markdown-body a { text-decoration: none; color: rgba(2, 105, 200, 1); border-bottom: 1px solid rgba(209, 233, 255, 1) }
.markdown-body a:active, .markdown-body a:hover { color: rgba(39, 91, 140, 1) }
.markdown-body table { display: inline-block !important; font-size: 12px; width: auto; max-width: 100%; overflow: auto; border: 1px solid rgba(246, 246, 246, 1) }
.markdown-body thead { background: rgba(246, 246, 246, 1); color: rgba(0, 0, 0, 1); text-align: left }
.markdown-body tr:nth-child(2n) { background-color: rgba(252, 252, 252, 1) }
.markdown-body td, .markdown-body th { padding: 12px 7px; line-height: 24px }
.markdown-body td { min-width: 120px }
.markdown-body blockquote { color: rgba(102, 102, 102, 1); padding: 1px 23px; margin: 22px 0; border-left: 4px solid rgba(203, 203, 203, 1); background-color: rgba(248, 248, 248, 1) }
.markdown-body blockquote:after { display: block; content: "" }
.markdown-body blockquote>p { margin: 10px 0 }
.markdown-body ol, .markdown-body ul { padding-left: 28px }
.markdown-body ol li, .markdown-body ul li { margin-bottom: 0; list-style: inherit }
.markdown-body ol li .task-list-item, .markdown-body ul li .task-list-item { list-style: none }
.markdown-body ol li .task-list-item ol, .markdown-body ol li .task-list-item ul, .markdown-body ul li .task-list-item ol, .markdown-body ul li .task-list-item ul { margin-top: 0 }
.markdown-body ol ol, .markdown-body ol ul, .markdown-body ul ol, .markdown-body ul ul { margin-top: 3px }
.markdown-body ol li { padding-left: 6px }
.markdown-body .contains-task-list { padding-left: 0 }
.markdown-body .task-list-item { list-style: none }
@media (max-width: 720px) { .markdown-body h1 { font-size: 24px } .markdown-body h2 { font-size: 20px } .markdown-body h3 { font-size: 18px } }.markdown-body pre, .markdown-body pre>code.hljs { color: rgba(51, 51, 51, 1); background: rgba(248, 248, 248, 1) }
.hljs-comment, .hljs-quote { color: rgba(153, 153, 136, 1); font-style: italic }
.hljs-keyword, .hljs-selector-tag, .hljs-subst { color: rgba(51, 51, 51, 1); font-weight: 700 }
.hljs-literal, .hljs-number, .hljs-tag .hljs-attr, .hljs-template-variable, .hljs-variable { color: rgba(0, 128, 128, 1) }
.hljs-doctag, .hljs-string { color: rgba(221, 17, 68, 1) }
.hljs-section, .hljs-selector-id, .hljs-title { color: rgba(153, 0, 0, 1); font-weight: 700 }
.hljs-subst { font-weight: 400 }
.hljs-class .hljs-title, .hljs-type { color: rgba(68, 85, 136, 1); font-weight: 700 }
.hljs-attribute, .hljs-name, .hljs-tag { color: rgba(0, 0, 128, 1); font-weight: 400 }
.hljs-link, .hljs-regexp { color: rgba(0, 153, 38, 1) }
.hljs-bullet, .hljs-symbol { color: rgba(153, 0, 115, 1) }
.hljs-built_in, .hljs-builtin-name { color: rgba(0, 134, 179, 1) }
.hljs-meta { color: rgba(153, 153, 153, 1); font-weight: 700 }
.hljs-deletion { background: rgba(255, 221, 221, 1) }
.hljs-addition { background: rgba(221, 255, 221, 1) }
.hljs-emphasis { font-style: italic }
.hljs-strong { font-weight: 700 }
这是后端给的json数据格式
{
"id": "726a59f1413043c18cacbd3a2d6514b9",
"name": "2dbe1f139b334a901eeb64dcabbe3a55.jpg",
"code": "F03584600293",
"type": "1",
"children": [
{
"id": "c687e253b96f4ca0acbb1cd6d29d538e",
"name": "rvt-{3D}",
"code": "M27701353069",
"type": "2",
"children": []
},
{
"id": "e3d86ad54151452a8bd11455556e7b8e",
"name": "截屏2023-12-27 08.45.13.png",
"code": "F03637928953",
"type": "1",
"children": []
}
]
}
echarts需要的数据格式
option
option = {
tooltip: {
trigger: 'item',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
},
formatter(params: any) {
const item = params.data
return `
${categoriesData[item.type].label}名称:${item.name}
<br/>
${categoriesData[item.type].label}编码:${item.code}
`
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: "rgba(50,50,50,0.7)",
textStyle: {
color: "#fff"
}
},
legend: {
orient: 'vertical',
left: "left",
bottom: '2',
},
series: [{
type: 'graph',
layout: 'force',
symbolSize: 58,
draggable: true,
roam: true,
categories: categories,
focusNodeAdjacency: true,
edgeSymbol: ['', 'arrow'],
edgeLabel: {
normal: {
show: true,
textStyle: {
fontSize: 20
},
formatter(x: any) {
return x.data.name;
}
}
},
label: {
show: true
},
force: {
repulsion: 2000,
edgeLength: 120
},
data: chartsData.nodes,
links: chartsData.links
}]
}
option && myChart.setOption(option);
}
series 里面的link的数据
[
{
"lineStyle": {},
"label": {
"align": "center",
"fontSize": 12
},
"source": "2dbe1f139b334a901eeb64dcabbe3a55.jpg",
"target": "rvt-{3D}",
"name": ""
},
{
"lineStyle": {},
"label": {
"align": "center",
"fontSize": 12
},
"source": "2dbe1f139b334a901eeb64dcabbe3a55.jpg",
"target": "截屏2023-12-27 08.45.13.png",
"name": ""
}
]
series 里面的link的数据
[
{
"code": "F03584600293",
"type": "0",
"symbolSize": 100,
"name": "2dbe1f139b334a901eeb64dcabbe3a55.jpg",
"itemStyle": {
"color": "#8570FE"
}
},
{
"code": "M27701353069",
"type": "2",
"symbolSize": 100,
"name": "rvt-{3D}",
"itemStyle": {
"color": "#73A455"
}
},
{
"code": "F03637928953",
"type": "1",
"symbolSize": 100,
"name": "截屏2023-12-27 08.45.13.png",
"itemStyle": {
"color": "#34A490"
}
}
]
递归调用方法
const changeData = (data: any) => {
let newData: any;
if (Object.prototype.toString.call(data) === '[object Object]') {
newData = [data]
} else if (Object.prototype.toString.call(data) === '[object Array]') {
newData = data
}
newData.forEach((item: any) => {
chartsData.nodes.push({
code: item.code,
type: item.type,
symbolSize: 100,
name: item.name,
itemStyle: {}
})
if (item.children.length > 0) {
changeData(item.children)
}
if (item.children.length > 0) {
item.children.forEach((value: any) => {
chartsData.links.push({
lineStyle: {},
label: {},
source: item.name,
target: value.name,
name: ''
})
})
}
})
}
关系图谱后端不给指向性字段使用children的更多相关文章
- ECharts 实现人民的名义关系图谱 代码开源
1.什么是ECharts ECharts是百度开源的纯 Javascript 图表库,目前开源可以与highcharts相匹敌的一个图表库,相信有很多国内用户使用. 官网 http://echarts ...
- Python来袭,教你用Neo4j构建“复联4”人物关系图谱!
来源商业新知网,原标题:Python来袭,教你用Neo4j构建“复联4”人物关系图谱!没有剧透! 复仇者联盟 之绝对不剧透 漫威英雄们为了不让自己剧透也是使出了浑身解数.在洛杉矶全球首映礼上记者费尽心 ...
- Relation.js——基于pixi.js的拓展模块之人物关系图谱
出于[重构基于D3的关系图谱项目]的目的,在看完pixi.js之后,并且网上又没有现成的基于webgl的关系图谱js库,于是,本人决定自己写一个. 因为平常要工作的原因,进度可能有点慢,但是githu ...
- 一文教你用 Neo4j 快速构建明星关系图谱
更多有趣项目及代码见于:DesertsX/gulius-projects 前言 本文将带你用 neo4j 快速实现一个明星关系图谱,因为拖延的缘故,正好赶上又一年的4月1日,于是将文中的几个例子顺势改 ...
- json-server的关系图谱详解(Relationships)
json-server的关系图谱 json-server是非常好用的一款模拟REST API的工具,文档也很详细和全面.详情:json-server而其中的关系图谱是它非常强大的一个功能,可以非常方便 ...
- vue使用GraphVis开发无限拓展的关系图谱
1.去GraphVis官网下载对应的js,新版和旧版的js有所不同,看自己需求引入旧版还是新版(GraphVis官方网址:http://www.graphvis.cn/) visgraph.min.j ...
- 基于cytoscape.js 、 d3.js实现的关系图谱初级版本
前面的文章已经介绍了cytoscape.js . d3.js的安装及简单demo,现在展示从html页面转移到vue项目下的最初版的demo 效果图: 代码如下: <template> & ...
- d3.js(v5.7)力导向图(关系图谱)
先上图,后面再一一解释: ok,为了方便理解,这里我就没有用之前封装的automatch函数来将数据和节点匹配了,如果你对enter(),exit()函数还不是很理解的话,请移步至我之前写的<n ...
- Java常用类、接口关系图谱
呕心沥血画出此图,希望在使用Java类.接口时捋顺其关系,从而更好的组织程序逻辑---请看图 Object分出来的类都是其子类 Iterable接口分出的也是子接口 从继承关系分析,其父类实现的接口子 ...
- 关系类型字段 -- Django从入门到精通系列教程
该系列教程系个人原创,并完整发布在个人官网刘江的博客和教程 所有转载本文者,需在顶部显著位置注明原作者及www.liujiangblog.com官网地址. Python及Django学习QQ群:453 ...
随机推荐
- MyBatis-Plus删除操作的几种基本方法
delete删除的三种方法 一.根据 id 删除 @Test void deleteById(Integer id) { empMapper.deleteById(new Emp().getId()) ...
- Correct the classpath of your application so that it contains a single, compatible version of xxx报错解决
1.背景 有时候引入包有冲突,比如在Maven项目中的不同模块多次重复引入等 这里遇到的问题是重复映入了如下包: <dependency> <groupId>com.baomi ...
- MD5签名生成,字典排序,实际生产
1.背景 作用:防止请求参数篡改,限制请求时效性: 常用方式:md5签名 关键:签名Key 常用签名原串排列:字母顺序.key1=value1&key2=value2....key (注意:签 ...
- 拈花云科基于 Apache DolphinScheduler 在文旅业态下的实践
作者|云科NearFar X Lab团队 左益.周志银.洪守伟.陈超.武超 一.导读 无锡拈花云科技服务有限公司(以下简称:拈花云科)是由拈花湾文旅和北京滴普科技共同孵化的文旅目的地数智化服务商.20 ...
- 朋友吐槽我为什么这么傻不在源生成器中用string.GetHashCode, 而要用一个不够优化的hash方法
明明有更好的hash方法 有位朋友对我吐槽前几天我列举的在源生成器的生成db映射实体的优化点 提前生成部分 hashcode 进行比较 所示代码 public static void Generate ...
- 9组-Alpha冲刺-6/4
一.基本情况 队名:不行就摆了吧 组长博客:https://www.cnblogs.com/Microsoft-hc/p/15546712.html 小组人数: 8 二.冲刺概况汇报 卢浩玮 过去两天 ...
- RabbitMq高级特性之TTL 存活时间/过期时间 通俗易懂 超详细 【内含案例】
RabbitMq高级特性之TTL 存活时间/过期时间 介绍 RabbitMQ支持消息的过期时间, 在消息发送时可以进行指定 RabbitMQ支持队列的过期时间, 从消息入队列开始计算, 只要超过了队列 ...
- FFT 高精度乘法模板
#define L(x) (1 << (x)) const double PI = acos(-1.0); const int N = 1e7 + 10; double ax[N], ay ...
- MPTCP(三) : 在内核中启用MPTCP相关模块
在内核中启用MPTCPv1相关的模块 1. 简介 本文所涉及的均为MPTCPv1版本的MPTCP,采用的内核版本为5.18.19 需要注意的是 虽然MPTCP官方文档中提到在5.6之后的linux内核 ...
- 使用image-syncer镜像同步工具将阿里云镜像仓库镜像迁移至私有Harbor
借助于阿里云开源的镜像同步工具image-syncer实现harbor及阿里云镜像仓库之间的镜像迁移 下载镜像同步工具 curl -fL "https://wiseo-generic.pkg ...