Skip to content

Commit

Permalink
Add arrow labels on graph outputted by calm-visualizer (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviajanejohns committed Nov 11, 2024
1 parent 257477c commit 6dc64f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function FileUploader({ callback }: Props) {
<button
onClick={handleSubmit}
className="submit"
>Upload a file</button>
>Visualize</button>
)}
</>
);
Expand Down
9 changes: 5 additions & 4 deletions calm-visualizer/src/components/graph/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ interface Props {
relationships: RelationshipLayout[]
}

// const groups: string[] = [];

function createConnectsRelationship(instance: BrowserJsPlumbInstance, relationship: CALMConnectsRelationship) {
const r = relationship["relationship-type"]["connects"];
instance.connect({
Expand All @@ -29,7 +27,8 @@ function createConnectsRelationship(instance: BrowserJsPlumbInstance, relationsh
options: {}
},
overlays: [
{ type:"Arrow", options:{location:1}}
{ type:"Arrow", options:{location:1}},
{ type: "Label", options: { location: 0.5, label: relationship.description }}
]
});
}
Expand All @@ -53,7 +52,9 @@ function createInteractsRelationship(instance: BrowserJsPlumbInstance, relations
}
},
overlays: [
{ type:"Arrow", options:{location:1}}
{ type:"Arrow", options:{location:1}},
{ type: "Label", options: { location: 0.5, label: relationship.description }}

]
});
})
Expand Down

0 comments on commit 6dc64f3

Please sign in to comment.