[fix: [UI-hash] fix graph node zoom

This commit is contained in:
Terrtia 2018-07-27 11:27:41 +02:00
parent 03a37af5cf
commit 009f87ee10
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 25 additions and 11 deletions

View file

@ -102,12 +102,19 @@ def save_hash(decoder_name, message, date, decoded):
# create hash metadata
serv_metadata.sadd('hash_'+ decoder_name +'_all_type', type)
# first time we see this hash today
if serv_metadata.zscore('hash_date:'+date_key, hash) is None:
serv_metadata.zincrby('hash_type:'+type, date_key, 1)
# first time we see this hash encoding today
if serv_metadata.zscore(decoder_name+'_date:'+date_key, hash) is None:
serv_metadata.zincrby(decoder_name+'_type:'+type, date_key, 1)
save_hash_on_disk(decoded, type, hash, json_data)
print('found {} '.format(type))
serv_metadata.hincrby('metadata_hash:'+hash, decoder_name+'_decoder', 1)
serv_metadata.zincrby('hash_type:'+type, date_key, 1)
serv_metadata.zincrby(decoder_name+'_type:'+type, date_key, 1)
serv_metadata.zincrby('nb_seen_hash:'+hash, message, 1)# hash - paste map

View file

@ -191,8 +191,8 @@
<i id="flash-tld" class="glyphicon glyphicon-flash " flash-tld=""></i> Graph
</div>
<div class="panel-body" style="text-align:center;">
<button class="btn btn-primary" onclick="redraw_graph();">
<span class="glyphicon glyphicon-refresh"></span>&nbsp;Redraw Graph</div>
<button class="btn btn-primary" onclick="resize_graph();">
<span class="glyphicon glyphicon-refresh"></span>&nbsp;Resize Graph</div>
</button>
</div>
</div>
@ -251,9 +251,9 @@
</script>
<script>
function redraw_graph() {
container_graph.attr("transform", "translate(40,0)")
.attr("transform", "scale(2)");
function resize_graph() {
zoom.translateTo(svg_node, 200, 200);
zoom.scaleTo(svg_node, 2);
}
</script>
@ -301,7 +301,11 @@ var width = 400,
var link;
var transform = d3.zoomIdentity;
var zoom = d3.zoom()
.scaleExtent([.2, 10])
.on("zoom", zoomed);
//var transform = d3.zoomIdentity;
var color = d3.scaleOrdinal(d3.schemeCategory10);
@ -322,9 +326,9 @@ var svg_node = d3.select("#graph").append("svg")
.call(d3.zoom().scaleExtent([1, 8]).on("zoom", zoomed))
.on("dblclick.zoom", null)
var container_graph = svg_node.append("g")
.attr("transform", "translate(40,0)")
.attr("transform", "scale(2)");
var container_graph = svg_node.append("g");
//.attr("transform", "translate(40,0)")
//.attr("transform", "scale(2)");
function create_graph(url){
@ -372,6 +376,9 @@ d3.json(url)
return d.icon
} });
zoom.translateTo(svg_node, 200, 200);
zoom.scaleTo(svg_node, 2);
/* node.append("text")
.attr("dy", 3)
.attr("dx", 7)