Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph Inside Div #6

Closed
sherlholmes opened this issue Aug 17, 2012 · 6 comments
Closed

Graph Inside Div #6

sherlholmes opened this issue Aug 17, 2012 · 6 comments

Comments

@sherlholmes
Copy link

I am trying to render the Graph inside a div. Not able to figure it out.
How to put the graph in the div?

@anvaka
Copy link
Owner

anvaka commented Aug 18, 2012

When you create a renderer instance set the 'container' property to required DOM element, where you want to place a graph. E.g.

   var renderer = Viva.Graph.View.renderer(graph,
        {
            container  : document.getElementById('graphDiv')
            // other settings
        });

@Clay-Ferguson
Copy link

@anvaka This is probably going to be a popular question. You may want to therefore address this question right at the beginning of your first example. Specifically in the readme.md would be best imo. That's where I was missing it.

Thanks! looking forward to trying this out. Looks awesome in the demos!

@anvaka
Copy link
Owner

anvaka commented Mar 31, 2016

@Clay-Ferguson thanks! fixed

@Clay-Ferguson
Copy link

I tried to run it, and it renders a canvas object that's 1px by 1px. Not sure what i'm doing wrong. I'm sure I have the JS file loading correctly but not working yet.

@anvaka
Copy link
Owner

anvaka commented Mar 31, 2016

check the CSS for the div - does it have width/height?

@Clay-Ferguson
Copy link

I tried again, but still can't get it. Here's the code:
I am sure the DIV exists, and has size 500x500px, and the vivaGraph.js is
definitely getting found and loaded correctly.
(So something's gotta be missing? Are there other dependecies? I have
jquery and polymer and lots of other javascript, BTW,
so maybe I should try on a blank page or something and get it running there
first).

I didn't (nor will I) run any command line code. ALL i'm doing is including
your JS file, right?

                    var graph = Viva.Graph.graph();
                    graph.addLink(1, 2);

///////////////
//var graphGenerator = Viva.Graph.generator();
//var graph = graphGenerator.grid(3, 3);

// var layout = Viva.Graph.Layout.forceDirected(graph, {
// springLength : 10,
// springCoeff : 0.0005,
// dragCoeff : 0.02,
// gravity : -1.2
// });

var graphics = Viva.Graph.View.webglGraphics();
var container = document.getElementById('searchResultsPanelSub');
if (container==null) {
console.log("container is null in viva!");
return;
}
var renderer = Viva.Graph.View.renderer(graph, {
container : container,
graphics : graphics//,
//layout : layout
});
renderer.run();

Best regards,
Clay Ferguson
wclayf@gmail.com

On Wed, Mar 30, 2016 at 11:13 PM, Andrei Kashcha notifications@github.com
wrote:

check the CSS for the div - does it have width/height?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#6 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants