anvaka / VivaGraphJS

Graph drawing library for JavaScript
Other
3.72k stars 423 forks source link

Cannot render graph #247

Open soccerdroid opened 5 years ago

soccerdroid commented 5 years ago

I have just found this library, but I cannot get to render a simple graph from the readme example. I am not using any web framework. Here is my code: `

<body>
</body>
<script type='text/javascript'>
    var graph = Viva.Graph.graph();
    graph.addLink(1, 2);
    var graphics = Viva.Graph.View.svgGraphics();
    var renderer = Viva.Graph.View.renderer(graph, {
        graphics : graphics
    });
    renderer.run();

</script>

`

soccerdroid commented 5 years ago

Ok so the graph was there, but it is so tiny I hade to make a 400%zoom to see it a little bit. How can I set the container size?

vincenzopalazzo commented 4 years ago

@soccerdroid if you use the SVG, add the CSS in your code

html, body, svg { 
   width: 100%; 
   height: 100%;
}

The example contains the CSS