Commit fc9a3354 authored by Maxime Chazalviel's avatar Maxime Chazalviel

Glyph size in function of number displayed

parent 99c66378
......@@ -172,15 +172,34 @@ metExploreD3.GraphNode = {
},
addNbHidden : function(m, nbHidden){
d3.select("#viz").select("#D3viz").selectAll("g.node").filter(n=>m==n)
.append("svg:text")
.attr('class', 'nbHidden')
.text(nbHidden)
.style("font-size", 8)
.style("font-weight", "bold")
var textSize = d3.select("#viz").select("#D3viz").selectAll("g.node").filter(n=>m==n)
.select('text.nbHidden').node().getComputedTextLength();
var sizeBodyCircle = Math.max(textSize, 7);
d3.select("#viz").select("#D3viz").selectAll("g.node").filter(n=>m==n)
.append("svg:circle")
.selectAll('text.nbHidden').remove();
d3.select("#viz").select("#D3viz").selectAll("g.node").filter(n=>m==n)
.append("svg:path")
.attr('class', 'nbHidden')
.style("fill", "rgb(255, 73, 73)")
.style("opacity", "1")
.attr('r', 7)
.attr('cx', -17)
.attr('cy', -19);
.attr("d", "M 0, 0" +
" L "+sizeBodyCircle+", 0" +
" a 7,7 0 0,1 0,14" +
" L 7, 14" +
" a 7,7 0 0,1 0,-14")
.attr("transform", "translate(" + (-17-sizeBodyCircle) + ", " + -26 + ") scale(1)");
d3.select("#viz").select("#D3viz").selectAll("g.node").filter(n=>m==n)
.append("svg:rect")
......@@ -193,14 +212,19 @@ metExploreD3.GraphNode = {
.attr('x', -17)
.attr('y', -19);
var textPosition=(-10-7-textSize/2);
if(textSize>7) textPosition=textPosition-(sizeBodyCircle-7)/2;
d3.select("#viz").select("#D3viz").selectAll("g.node").filter(n=>m==n)
.append("svg:text")
.attr('class', 'nbHidden')
.text(nbHidden)
.style("font-size", 8)
.style("font-weight", "bold")
.attr('x', -19)
.attr('x', textPosition)
.attr('y', -16);
},
sortReactionFromMetaboRank : function(reacList, node){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment