Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Combine 2 force layouts
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
s_mb  
View profile  
 More options Jan 16 2012, 6:24 am
From: s_mb <sebastian.br...@googlemail.com>
Date: Mon, 16 Jan 2012 03:24:22 -0800 (PST)
Local: Mon, Jan 16 2012 6:24 am
Subject: Combine 2 force layouts
Hi,

I want to add two diagramms on my page. Each of them should have a
force layout with different parameters (gravity, charge, etc). If I
create two javascript files with two different force layouts, one set
of settings overwrites the other set.

Is there a solution?

Thx
Sebastian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Johnson  
View profile  
 More options Jan 16 2012, 4:28 pm
From: Ian Johnson <enja...@gmail.com>
Date: Mon, 16 Jan 2012 13:28:06 -0800
Local: Mon, Jan 16 2012 4:28 pm
Subject: Re: Combine 2 force layouts

This sounds like a javascript scope issue, so one thing you could do is use
different variable names when making your force layouts (if you have the
same variable name in two different files, only the last one to be loaded
will be used). You may want to do some more reading on javascript to get
the fundamentals down, otherwise things may seem a lot harder than they are
:)

On Mon, Jan 16, 2012 at 3:24 AM, s_mb <sebastian.br...@googlemail.com>wrote:

> Hi,

> I want to add two diagramms on my page. Each of them should have a
> force layout with different parameters (gravity, charge, etc). If I
> create two javascript files with two different force layouts, one set
> of settings overwrites the other set.

> Is there a solution?

> Thx
> Sebastian

--
Ian Johnson
http://enja.org

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Bostock  
View profile   Translate to Translated (View Original)
 More options Jan 16 2012, 4:35 pm
From: Mike Bostock <mbost...@cs.stanford.edu>
Date: Mon, 16 Jan 2012 13:35:22 -0800
Local: Mon, Jan 16 2012 4:35 pm
Subject: Re: Combine 2 force layouts
I often wrap code in a self-executing function to avoid these sorts of
collisions. For example, compare this:

<script>(function() {

var foo = 1;
setTimeout(function() {
  alert(foo);

}, 2000);
})()</script>

<script>(function() {

var foo = 2;

})()</script>

To this:

<script>

var foo = 1;
setTimeout(function() {
  alert(foo);

}, 2000);

</script>
<script>

var foo = 2;

</script>

Mike


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »