How to draw nodes after edges, only with customized node and edge types ?

59 views
Skip to first unread message

Gregoor van der Eyken

unread,
Aug 7, 2016, 7:42:42 PM8/7/16
to JavaScript InfoVis Toolkit
Hi everyone,

Indeed, my radial graph use native customized node and edges, but sometimes some lines are drawn after (on over) the nodes (round tiles)

I do not need to (and do not want) to use labels (DOM or natives)... Is it an other way to DRAW nodes after EDGES without to drawn them a second time in a afterPlotNode function, or to tell me how to detect which nodes have to be draw again (about 5 on 20)

Thanks for any help

Gregoor

Thomas Raab

unread,
Nov 21, 2016, 1:53:07 PM11/21/16
to JavaScript InfoVis Toolkit
Hey, 

i don't know if my anser is 100% correct, but i had the same problem. In my custom line, i set the globalCompositeOperation from the canvas to 'destination-over'. Now the lines are drawn ('under') my nodes.

$jit.RGraph.Plot.EdgeTypes.implement({
   
'lineUnder': {
       
'render': function (adj, canvas) {
           
var ctx = canvas.getCtx();
           
var from = adj.nodeFrom.pos.getc(true),
               
to = adj.nodeTo.pos.getc(true);
           
ctx.globalCompositeOperation = 'destination-over';
           
this.edgeHelper.line.render(from, to, canvas);
       
},
       
'contains': function (adj, pos) {
           
var from = adj.nodeFrom.pos.getc(true),
               
to = adj.nodeTo.pos.getc(true);
           
return this.edgeHelper.line.contains(from, to, pos, this.edge.epsilon);
       
}
   
}
});

It works pretty well, but as i said, i'm not shure if this is 100% correct.

Greetings Thomas
Reply all
Reply to author
Forward
0 new messages