diff options
Diffstat (limited to 'subprojects/frontend/src/graph/dotSource.ts')
-rw-r--r-- | subprojects/frontend/src/graph/dotSource.ts | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/subprojects/frontend/src/graph/dotSource.ts b/subprojects/frontend/src/graph/dotSource.ts index bcd386cf..ce504c37 100644 --- a/subprojects/frontend/src/graph/dotSource.ts +++ b/subprojects/frontend/src/graph/dotSource.ts | |||
@@ -227,6 +227,25 @@ function binarySerach( | |||
227 | return undefined; | 227 | return undefined; |
228 | } | 228 | } |
229 | 229 | ||
230 | function getEdgeLabel( | ||
231 | name: string, | ||
232 | containment: boolean, | ||
233 | value: string, | ||
234 | ): string { | ||
235 | if (value !== 'ERROR') { | ||
236 | return containment ? `<<b>${name}</b>>` : `"${name}"`; | ||
237 | } | ||
238 | // No need to set an id for the image for animation, | ||
239 | // because it will be the only `<use>` element in its group. | ||
240 | return `<<table fixedsize="TRUE" align="left" border="0" cellborder="0" cellspacing="0" cellpadding="0"> | ||
241 | <tr> | ||
242 | <td><img src="#ERROR"/></td> | ||
243 | <td width="3.9375"></td> | ||
244 | <td align="left">${containment ? `<b>${name}</b>` : name}</td> | ||
245 | </tr> | ||
246 | </table>>`; | ||
247 | } | ||
248 | |||
230 | function createRelationEdges( | 249 | function createRelationEdges( |
231 | graph: GraphStore, | 250 | graph: GraphStore, |
232 | nodeData: NodeData[], | 251 | nodeData: NodeData[], |
@@ -243,10 +262,10 @@ function createRelationEdges( | |||
243 | let weight = EDGE_WEIGHT; | 262 | let weight = EDGE_WEIGHT; |
244 | let penwidth = 1; | 263 | let penwidth = 1; |
245 | const name = graph.getName(relation); | 264 | const name = graph.getName(relation); |
246 | let label = `"${name}"`; | 265 | let containment = false; |
247 | if (detail.type === 'reference' && detail.containment) { | 266 | if (detail.type === 'reference' && detail.containment) { |
248 | weight = CONTAINMENT_WEIGHT; | 267 | weight = CONTAINMENT_WEIGHT; |
249 | label = `<<b>${name}</b>>`; | 268 | containment = true; |
250 | penwidth = 2; | 269 | penwidth = 2; |
251 | } else if ( | 270 | } else if ( |
252 | detail.type === 'opposite' && | 271 | detail.type === 'opposite' && |
@@ -311,8 +330,10 @@ function createRelationEdges( | |||
311 | edgeWeight *= UNKNOWN_WEIGHT_FACTOR; | 330 | edgeWeight *= UNKNOWN_WEIGHT_FACTOR; |
312 | } | 331 | } |
313 | 332 | ||
333 | const id = `${fromNode.name},${toNode.name},${relation.name}`; | ||
334 | const label = getEdgeLabel(name, containment, value); | ||
314 | lines.push(`n${from} -> n${to} [ | 335 | lines.push(`n${from} -> n${to} [ |
315 | id="${fromNode.name},${toNode.name},${relation.name}", | 336 | id="${id}", |
316 | dir="${dir}", | 337 | dir="${dir}", |
317 | constraint=${edgeConstraint}, | 338 | constraint=${edgeConstraint}, |
318 | weight=${edgeWeight}, | 339 | weight=${edgeWeight}, |