Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

show hide a node by id #140

Closed
oceatoon opened this issue May 22, 2014 · 11 comments
Closed

show hide a node by id #140

oceatoon opened this issue May 22, 2014 · 11 comments

Comments

@oceatoon
Copy link

Hi
Thanks for your great work
I'm making a tag filter on a graph,
I can't find in the docs how to show hide a node in a graph with it's ID ?
is there a sample with something like this ?

@AlexDM0 AlexDM0 added the Graph label May 22, 2014
@AlexDM0
Copy link
Contributor

AlexDM0 commented May 22, 2014

Hi Oceatoon,

We currently do not have a visibility option for our nodes or edges. As a workaround though, you could change their color to the background using setOptions()?

Regards,

Alex

@oceatoon
Copy link
Author

Hi Alex
thanks , my problem is when I redraw the whole

I have a message conflict about existing Ids so unable to redraw
is there a way to empty the graph ?

it would be really usefull to simply show hide certain id nodes
is there any plans to do this ?

On Thu, May 22, 2014 at 12:27 PM, Alex notifications@github.com wrote:

Hi Oceatoon,

We currently do not have a visibility option for our nodes or edges. As a
workaround though, you could change their color to the background using
setOptions()?

Regards,

Alex


Reply to this email directly or view it on GitHubhttps://github.com//issues/140#issuecomment-43860950
.

Tibor Katelbach – Senior Developper
http://oceatoon.org
..·><((((º>·´¯`·.¸¸..><((((º>.¸¸..·.¸¸..><((((º>.¸¸..
La Riviere, La Reunion
e-mail : oceatoon@gmail.com
skype : oceatoon
Fixe : +262+262343686
Mobile : +262-693918532

Save a tree...please don't print this e-mail unless you really need to.

@AlexDM0
Copy link
Contributor

AlexDM0 commented May 22, 2014

Hi Oceatoon,

What do you mean with redraw? It does not sound like a redraw is required, all could be done with AJAX and normal javascript?

At the moment we do not have any plans to implement a visibility option. The workaround I gave you should work, could you further explain what you mean with " my problem is when I redraw the whole" or why the workaround is not feasible?

Regards,

Alex

@AlexDM0
Copy link
Contributor

AlexDM0 commented Jun 4, 2014

Hi Oceatoon,

Is this still an issue?

Regards,

Alex

@oceatoon
Copy link
Author

oceatoon commented Jun 4, 2014

Hi Alex
well i would love to be able to have a way to do it
for the moment I simply reload the page with the filtered content
but if you've upgraded it I could integrate it
cheers
Tibor

@AlexDM0
Copy link
Contributor

AlexDM0 commented Jun 4, 2014

Hi Oceatoon,

If you're using a Dataset you can update your content. This means you can trigger a style update on nodes and edges WITHOUT reloading the page. Is there any reason why this is not possible?

Take a look at http://visjs.org/examples/network/16_dynamic_data.html

Regards,

Alex

@oceatoon
Copy link
Author

oceatoon commented Jun 4, 2014

Hi ALex
I don't see class switching on this sample
removing a node , removes from the dataset , I just need to hide a node with an id
do you have a sample with the color switching ?
my problem is my background is an image and not just one color
hiding would really be the best solution
your not so far off when you remove I would just like the dataset to have attribute by id
cheers
Tibor

@AlexDM0
Copy link
Contributor

AlexDM0 commented Jun 5, 2014

Hi Oceatoon,

If your background is an image you cannot set it to a color to hide it. This is how you update the color:

In example 16 you can use: nodes.update({id:1,color:"#FFFFFF"}); to make the background of a node white. You can also pass the documented color object to make it completely one color.

Come to think of it, you can try to use an RGBA value:

nodes.update({id:1,color:"rgba(0,0,0,0)",fontColor:"rgba(0,0,0,0)"})

It works on my end, can you get it to work as well?

Regards,

Alex

@AlexDM0
Copy link
Contributor

AlexDM0 commented Jun 10, 2014

Hi Oceatoon,

As far as I can tell, this issue is closed. You're provided with a working line of code to produce you're results. If you have any other questions regarding this, please let me know. For now I'll close the issue.

Regards,

Alex

@wolfig
Copy link

wolfig commented Mar 17, 2016

Just because I ran into the same problem and Alex's comment helped me some hits that might be useful:

  1. Alex's code line
    nodes.update(...)
    refers to DataSets, not to network.nodes

  2. You can update the attribute "hidden" in the node-dataset, so they become invisible. Here a code snippet of updating a bunch of nodes:

        var updateArray = [];
                 for (nodeCounter = 0; nodeCounter < nodeCount; nodeCounter++) {
            updateArray.push({id: idsOfNodesForUpdate[nodeCounter], hidden: true});
        }
                nodeDataSet.update(updateArray);

@mvivekc
Copy link

mvivekc commented May 4, 2016

@wolfig
FYI: The above code does not take care of all the edges assigned to the hidden nodes. This needs to be taken care of with another forLoop on the edges array. Still, did not know about hidden field. Thanks.

@AlexDM0 Would be nice if hidden effectively removes/hides the edges connected to it as well.

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

No branches or pull requests

4 participants