mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
feat: add buttons to anonymise nodes on graph
This commit is contained in:
@@ -6,11 +6,21 @@ var hide_organisations = false;
|
||||
var organisation_nodes;
|
||||
var organisation_edges;
|
||||
|
||||
var anonymise_people = false;
|
||||
var anonymise_organisations = false;
|
||||
|
||||
var network_style = [
|
||||
{
|
||||
selector: 'node[name]',
|
||||
style: {
|
||||
label: 'data(name)',
|
||||
label: function (ele) {
|
||||
var anonymise = anonymise_people;
|
||||
if (ele.data('kind') == 'organisation') {
|
||||
anonymise = anonymise_organisations;
|
||||
}
|
||||
|
||||
return anonymise ? ele.data('id') : ele.data('name')
|
||||
},
|
||||
width: '100px',
|
||||
height: '100px',
|
||||
'text-halign': 'center',
|
||||
@@ -63,6 +73,22 @@ function toggle_organisations() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle person node labels between names and ids.
|
||||
*/
|
||||
function toggle_anonymise_people() {
|
||||
anonymise_people = !anonymise_people
|
||||
cy.elements().remove().restore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle organisation node labels between names and ids.
|
||||
*/
|
||||
function toggle_anonymise_organisations() {
|
||||
anonymise_organisations = !anonymise_organisations
|
||||
cy.elements().remove().restore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate a Cytoscape network from :class:`Person` and :class:`Relationship` JSON embedded in page.
|
||||
*/
|
||||
|
||||
@@ -73,6 +73,11 @@
|
||||
<div class="col-md-4">
|
||||
<button class="btn btn-block btn-info mb-3" onclick="toggle_organisations();">Toggle Organisations</button>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<button class="btn btn-block btn-info mb-3" onclick="toggle_anonymise_people();">Toggle Anonymise People</button>
|
||||
<button class="btn btn-block btn-info mb-3" onclick="toggle_anonymise_organisations();">Toggle Anonymise Organisations</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="cy"
|
||||
|
||||
Reference in New Issue
Block a user