feat: add organisations to network view

See #78
This commit is contained in:
James Graham
2021-03-01 14:43:16 +00:00
parent 550d7cede0
commit b73e2dcb2d
3 changed files with 31 additions and 1 deletions

View File

@@ -53,6 +53,8 @@
-->
{{ person_set|json_script:'person-set-data' }}
{{ organisation_set|json_script:'organisation-set-data' }}
{{ relationship_set|json_script:'relationship-set-data' }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.14.0/cytoscape.min.js"
@@ -102,6 +104,22 @@
})
}
// Load organisations and add to graph
var organisation_set = JSON.parse(document.getElementById('organisation-set-data').textContent);
for (var item of organisation_set) {
cy.add({
group: 'nodes',
data: {
id: 'organisation-' + item.pk.toString(),
name: item.name
},
style: {
shape: 'rectangle'
}
})
}
// Load relationships and add to graph
var relationship_set = JSON.parse(document.getElementById('relationship-set-data').textContent);