Merge remote-tracking branch 'production/master'

This commit is contained in:
j 2018-11-15 15:01:37 +00:00
commit 0b5d56ed94
5 changed files with 31 additions and 1 deletions

View file

@ -264,6 +264,8 @@
"soup": {},
"tea": {}
},
"tech": {
},
"miscellaneous": {
"bicycle": {},
"make-up": {},

View file

@ -1,3 +1,4 @@
<meta charset="utf-8" />
<script src="/static/oxjs/min/Ox.js"></script>
<script>
function pandora_api(action, data, callback) {

View file

@ -19,3 +19,9 @@ body {
stroke: #ccc;
stroke-width: 1.5px;
}
.zoom {
position: fixed;
top: 5px;
right: 5px;
}

View file

@ -7,6 +7,10 @@
<title>Ontology Tree</title>
</head>
<body>
<div class="zoom">
<button class="plus">+</button>
<button class="minus">-</button>
</div>
<script src="index.js"></script>
</body>
</html>

View file

@ -51,6 +51,22 @@ function resize() {
update(root);
}
function zoom(size) {
height = size;
tree.size([height, width]);
svg.attr("width", width).attr("height", height + margin.top + margin.bottom)
document.querySelector('svg').attributes.height.value = height + margin.top + margin.bottom
resize()
}
document.querySelector('.zoom button.plus').addEventListener('click', function(event) {
zoom(height*1.5)
})
document.querySelector('.zoom button.minus').addEventListener('click', function(event) {
zoom(height/1.5)
})
function get_color(d) {
if (d.children || d._children) {
@ -95,7 +111,8 @@ function update(source) {
})
.text(function(d) {
if (d.children || d._children) {
return d.name;
//return d.name;
return d.name + '(' + (d.children || d._children).length +')';
}
return d.name + ' (' + d.size + ')';
})