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 22, 2024
1 parent 3ace9a2 commit b81d370
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 b81d370

Please sign in to comment.