Skip to content

Commit

Permalink
change node labels dynamically on the existing graph, rather than reg…
Browse files Browse the repository at this point in the history
…enerating each time the 'label items by name' checkboxes are checked
  • Loading branch information
jdbocarsly committed Nov 25, 2024
1 parent a14806c commit 898104f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions webapp/src/components/ItemGraph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,20 @@ export default {
this.generateCyNetworkPlot();
},
labelStartingMaterialsByName() {
this.generateCyNetworkPlot();
// update the cytoscape stylesheet. Note: this adds styles, rather than overwriting the existing ones.
// That seems to be OK for performance.
this.cy
.style()
.selector('node[type = "starting_materials"]')
.style("label", this.labelStartingMaterialsByName ? "data(name)" : "data(id)")
.update();
},
labelItemsByName() {
this.generateCyNetworkPlot();
this.cy
.style()
.selector('node[type = "samples"], node[type = "cells"]')
.style("label", this.labelItemsByName ? "data(name)" : "data(id)")
.update();
},
},
async created() {
Expand Down

0 comments on commit 898104f

Please sign in to comment.