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 authored and ml-evs committed Nov 27, 2024
1 parent 660dcaf commit c15d7fb
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 c15d7fb

Please sign in to comment.