VivaGraphJS icon indicating copy to clipboard operation
VivaGraphJS copied to clipboard

Will <canvas> improve scalability and portability ?

Open gg4u opened this issue 8 years ago • 2 comments

Hi @anvaka , I found SVG implementation very handy, however, did you considered to support also rendering of graph on html5 ?

I thought that for expanded-on-demand graphs it would be a really good approach, for drawing only visibile elements on the canvas, instead of progressively adding new elements on the DOM.

Basically, I see graphs as a google maps, so that you can zoom on more details only on the portion you are interested in - perfect for exploring hair-balls.

Or do you have any particular reason for which you choose not to support ?

Possible to use the layout part to compute position of elements, and a new module for rendering of elements that check which are in the viewports and does the rendering ?

gg4u avatar Apr 29 '17 09:04 gg4u

You can use WebGL like so:

    let graph = Viva.Graph.graph();
    let webglGraphics = Viva.Graph.View.webglGraphics();
    let renderer = Viva.Graph.View.renderer(graph, {
      container: document.querySelector('#graph-ctn'),
      graphics: webglGraphics,
    });

It's waaaay faster than SVG.

josephrocca avatar May 01 '17 07:05 josephrocca

Would you tell about pros/cons you see between canvas and webgl ?

How to improve webgl rendering ? In vivagraph I see that webgl doubles rendering of edges and nodes when zooming the graph.

I see some nice examples with pixi.js and three.js + ngraph. Is webgl rendering in vivagraph different from renderer in ngraph + pixi ? If so, I would really find useful a little tutorial showing how to build vivagraph with custom rendering engine and some examples to customise nodes and edges looking with images.

gg4u avatar May 03 '17 08:05 gg4u