Skip to content

Commit 5702e63

Browse files
[fix]知识图谱对接边线颜色和线宽 review by qiw
1 parent afea615 commit 5702e63

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

src/common/iServer/KnowledgeGraphService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class KnowledgeGraphService extends CommonServiceBase {
4242
*/
4343
query(params, callback) {
4444
const paramKey = 'cypherQuery';
45-
const url = Util.urlAppend(this.url + '/query.json', `${paramKey}=${params}`);
45+
const url = Util.urlAppend(this.url + '/query.json', `${paramKey}=${encodeURI(params)}`);
4646
this.processAsync({ url, method: 'GET', callback });
4747
}
4848

src/common/overlay/knowledge-graph/G6Render.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ export class G6Render {
153153
};
154154
const defaultEdgeHighlightStyle = {
155155
stroke: hoverColor,
156-
lineWidth: 2,
156+
shadowColor: hoverColor,
157+
shadowBlur: 5,
157158
endArrow: {
158159
path: 'M 0,0 L 2,1 L 2,-1 Z',
159160
fill: hoverColor

src/common/overlay/knowledge-graph/format.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,27 @@ export function nodeFromGraphMap(entity, style, captionField) {
7676
export function edgeFromGraphMap(entity, style) {
7777
const { start, end, id, type, properties } = entity;
7878
const styleData = style ? getEdgeStyle(entity, style) : {};
79-
return {
79+
const edge = {
8080
source: start + '',
8181
target: end + '',
8282
edgeId: id + '',
8383
label: type,
84-
labelCfg: {
85-
style: styleData
86-
},
84+
style: {},
85+
labelCfg: {},
8786
properties
8887
};
88+
if (styleData.stroke) {
89+
edge.style.stroke = styleData.stroke;
90+
delete styleData.stroke;
91+
}
92+
if (styleData.lineWidth) {
93+
edge.style.lineWidth = styleData.lineWidth;
94+
delete styleData.lineWidth;
95+
}
96+
edge.labelCfg = {
97+
style: styleData
98+
};
99+
return edge;
89100
}
90101

91102
function getEdgeStyle(entity, style) {
@@ -95,11 +106,13 @@ function getEdgeStyle(entity, style) {
95106
const { id, type } = entity;
96107
const data = style.filter((item) => item.type === 'relationShip');
97108
for (let i = 0; i < data.length; i++) {
98-
const { textColor, font, relationTypes, relationIds } = data[i];
109+
const { color, width, textColor, font, relationTypes, relationIds } = data[i];
99110
const ids = JSON.parse(relationIds || '[]');
100111
const types = JSON.parse(relationTypes || '[]');
101112
if (ids.includes(id) || types.includes(type)) {
102113
return {
114+
stroke: color,
115+
lineWidth: Number(width) * 1.4,
103116
fontSize: font.fontSize,
104117
fill: textColor,
105118
...formatFontName(font.fontName),

test/resources/knowledgeGraphService.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)