How to make a node in vis.js clickable? The Next CEO of Stack OverflowHow do JavaScript closures work?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do I redirect to another webpage?How do I include a JavaScript file in another JavaScript file?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?How do I return the response from an asynchronous call?

Method for adding error messages to a dictionary given a key

What did we know about the Kessel run before the prequels?

Is it ever safe to open a suspicious HTML file (e.g. email attachment)?

Why is information "lost" when it got into a black hole?

Why isn't acceleration always zero whenever velocity is zero, such as the moment a ball bounces off a wall?

A Man With a Stainless Steel Endoskeleton (like The Terminator) Fighting Cloaked Aliens Only He Can See

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

Why do airplanes bank sharply to the right after air-to-air refueling?

WOW air has ceased operation, can I get my tickets refunded?

Why do remote US companies require working in the US?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Find non-case sensitive string in a mixed list of elements?

Math-accent symbol over parentheses enclosing accented symbol (amsmath)

Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis

Legal workarounds for testamentary trust perceived as unfair

What does "Its cash flow is deeply negative" mean?

Reference request: Grassmannian and Plucker coordinates in type B, C, D

Is a distribution that is normal, but highly skewed considered Gaussian?

The past simple of "gaslight" – "gaslighted" or "gaslit"?

Calculator final project in Python

How is this set of matrices closed under multiplication?

Prepend last line of stdin to entire stdin

Is it convenient to ask the journal's editor for two additional days to complete a review?

RigExpert AA-35 - Interpreting The Information



How to make a node in vis.js clickable?



The Next CEO of Stack OverflowHow do JavaScript closures work?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do I redirect to another webpage?How do I include a JavaScript file in another JavaScript file?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?How do I return the response from an asynchronous call?










0















I am trying to make node clickable but it is not working



I am beginner in javascript so please help me in this.
I have used vis.js library.I want when someone clicks on node then it should redirect to the webpage which is in the url.
I tried to do make changes via given examples but it was not working.



Thank you in advance.



var graph =nodes:[id:0,group:'Mission Learning',label:"Content Tech + QA",url:'http://www.youtube.com',shape:'box',id:1,group:'Mission Learning',label:"Content Hygiene / Launch Automation",url:'http://www.google.com',shape:'box'],edges:[from:0,to:1];
function destroy()
if (network !== null)
network.destroy();
network = null;



function draw()
destroy();

var nodes = graph.nodes;
var edges = graph.edges;
// randomly create some nodes and edges

// create a network
var container = document.getElementById('mynetwork');
var data =
nodes: nodes,
edges: edges
;

var options =
edges:
color:color:'white',
width: 2,
arrows:
to: enabled: true, scaleFactor:.5, type:'arrow'


,
nodes:
borderWidth:2,
size:50,
color:
border: '#222222',
background: 'grey'
,
font:color:'black',
size: 40,
face :'arial',
,
margin:
top: 20,
bottom: 20,
left: 20,
right: 20

,
physics:
forceAtlas2Based:
gravitationalConstant: -350,
centralGravity: 0.05,
springLength: 400,
springConstant: 0.01,
avoidOverlap:10
,
maxVelocity: 20,
minVelocity:0,
solver: 'forceAtlas2Based',
timestep: 0.10,
stabilization: enabled:false,iterations: 0
,
interaction:
multiselect: true,
dragView: true
,
edges:
smooth: false,
arrows: to : true

;
network = new vis.Network(container, data, options);

network.on( 'click', function(properties)
var ids = properties.nodes;
var clickedNodes = nodes.get(ids);
console.log('clicked nodes:', clickedNodes);

);




















share|improve this question






















  • Check out the comments in this issue – there is a JSFiddle that demonstrates clicking on a node to open the url. github.com/almende/vis/issues/2156

    – slothbear
    Mar 13 at 1:55















0















I am trying to make node clickable but it is not working



I am beginner in javascript so please help me in this.
I have used vis.js library.I want when someone clicks on node then it should redirect to the webpage which is in the url.
I tried to do make changes via given examples but it was not working.



Thank you in advance.



var graph =nodes:[id:0,group:'Mission Learning',label:"Content Tech + QA",url:'http://www.youtube.com',shape:'box',id:1,group:'Mission Learning',label:"Content Hygiene / Launch Automation",url:'http://www.google.com',shape:'box'],edges:[from:0,to:1];
function destroy()
if (network !== null)
network.destroy();
network = null;



function draw()
destroy();

var nodes = graph.nodes;
var edges = graph.edges;
// randomly create some nodes and edges

// create a network
var container = document.getElementById('mynetwork');
var data =
nodes: nodes,
edges: edges
;

var options =
edges:
color:color:'white',
width: 2,
arrows:
to: enabled: true, scaleFactor:.5, type:'arrow'


,
nodes:
borderWidth:2,
size:50,
color:
border: '#222222',
background: 'grey'
,
font:color:'black',
size: 40,
face :'arial',
,
margin:
top: 20,
bottom: 20,
left: 20,
right: 20

,
physics:
forceAtlas2Based:
gravitationalConstant: -350,
centralGravity: 0.05,
springLength: 400,
springConstant: 0.01,
avoidOverlap:10
,
maxVelocity: 20,
minVelocity:0,
solver: 'forceAtlas2Based',
timestep: 0.10,
stabilization: enabled:false,iterations: 0
,
interaction:
multiselect: true,
dragView: true
,
edges:
smooth: false,
arrows: to : true

;
network = new vis.Network(container, data, options);

network.on( 'click', function(properties)
var ids = properties.nodes;
var clickedNodes = nodes.get(ids);
console.log('clicked nodes:', clickedNodes);

);




















share|improve this question






















  • Check out the comments in this issue – there is a JSFiddle that demonstrates clicking on a node to open the url. github.com/almende/vis/issues/2156

    – slothbear
    Mar 13 at 1:55













0












0








0








I am trying to make node clickable but it is not working



I am beginner in javascript so please help me in this.
I have used vis.js library.I want when someone clicks on node then it should redirect to the webpage which is in the url.
I tried to do make changes via given examples but it was not working.



Thank you in advance.



var graph =nodes:[id:0,group:'Mission Learning',label:"Content Tech + QA",url:'http://www.youtube.com',shape:'box',id:1,group:'Mission Learning',label:"Content Hygiene / Launch Automation",url:'http://www.google.com',shape:'box'],edges:[from:0,to:1];
function destroy()
if (network !== null)
network.destroy();
network = null;



function draw()
destroy();

var nodes = graph.nodes;
var edges = graph.edges;
// randomly create some nodes and edges

// create a network
var container = document.getElementById('mynetwork');
var data =
nodes: nodes,
edges: edges
;

var options =
edges:
color:color:'white',
width: 2,
arrows:
to: enabled: true, scaleFactor:.5, type:'arrow'


,
nodes:
borderWidth:2,
size:50,
color:
border: '#222222',
background: 'grey'
,
font:color:'black',
size: 40,
face :'arial',
,
margin:
top: 20,
bottom: 20,
left: 20,
right: 20

,
physics:
forceAtlas2Based:
gravitationalConstant: -350,
centralGravity: 0.05,
springLength: 400,
springConstant: 0.01,
avoidOverlap:10
,
maxVelocity: 20,
minVelocity:0,
solver: 'forceAtlas2Based',
timestep: 0.10,
stabilization: enabled:false,iterations: 0
,
interaction:
multiselect: true,
dragView: true
,
edges:
smooth: false,
arrows: to : true

;
network = new vis.Network(container, data, options);

network.on( 'click', function(properties)
var ids = properties.nodes;
var clickedNodes = nodes.get(ids);
console.log('clicked nodes:', clickedNodes);

);




















share|improve this question














I am trying to make node clickable but it is not working



I am beginner in javascript so please help me in this.
I have used vis.js library.I want when someone clicks on node then it should redirect to the webpage which is in the url.
I tried to do make changes via given examples but it was not working.



Thank you in advance.



var graph =nodes:[id:0,group:'Mission Learning',label:"Content Tech + QA",url:'http://www.youtube.com',shape:'box',id:1,group:'Mission Learning',label:"Content Hygiene / Launch Automation",url:'http://www.google.com',shape:'box'],edges:[from:0,to:1];
function destroy()
if (network !== null)
network.destroy();
network = null;



function draw()
destroy();

var nodes = graph.nodes;
var edges = graph.edges;
// randomly create some nodes and edges

// create a network
var container = document.getElementById('mynetwork');
var data =
nodes: nodes,
edges: edges
;

var options =
edges:
color:color:'white',
width: 2,
arrows:
to: enabled: true, scaleFactor:.5, type:'arrow'


,
nodes:
borderWidth:2,
size:50,
color:
border: '#222222',
background: 'grey'
,
font:color:'black',
size: 40,
face :'arial',
,
margin:
top: 20,
bottom: 20,
left: 20,
right: 20

,
physics:
forceAtlas2Based:
gravitationalConstant: -350,
centralGravity: 0.05,
springLength: 400,
springConstant: 0.01,
avoidOverlap:10
,
maxVelocity: 20,
minVelocity:0,
solver: 'forceAtlas2Based',
timestep: 0.10,
stabilization: enabled:false,iterations: 0
,
interaction:
multiselect: true,
dragView: true
,
edges:
smooth: false,
arrows: to : true

;
network = new vis.Network(container, data, options);

network.on( 'click', function(properties)
var ids = properties.nodes;
var clickedNodes = nodes.get(ids);
console.log('clicked nodes:', clickedNodes);

);

















javascript vis.js vis.js-network






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 16:53









anurag kumar anuanurag kumar anu

12




12












  • Check out the comments in this issue – there is a JSFiddle that demonstrates clicking on a node to open the url. github.com/almende/vis/issues/2156

    – slothbear
    Mar 13 at 1:55

















  • Check out the comments in this issue – there is a JSFiddle that demonstrates clicking on a node to open the url. github.com/almende/vis/issues/2156

    – slothbear
    Mar 13 at 1:55
















Check out the comments in this issue – there is a JSFiddle that demonstrates clicking on a node to open the url. github.com/almende/vis/issues/2156

– slothbear
Mar 13 at 1:55





Check out the comments in this issue – there is a JSFiddle that demonstrates clicking on a node to open the url. github.com/almende/vis/issues/2156

– slothbear
Mar 13 at 1:55












1 Answer
1






active

oldest

votes


















0














What problem do you have?

Does your code reach the click event?



Try:



network.on( 'click', function(properties) 
console.log('I'm clicked');
var ids = properties.nodes;
var clickedNodes = nodes.get(ids);
console.log('clicked nodes:');
console.log(clickedNodes);
);


Do you get the I'm clicked? at console?

Do you get the clicked nodes:? at console?

Do you get any error at console?






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55049042%2fhow-to-make-a-node-in-vis-js-clickable%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    What problem do you have?

    Does your code reach the click event?



    Try:



    network.on( 'click', function(properties) 
    console.log('I'm clicked');
    var ids = properties.nodes;
    var clickedNodes = nodes.get(ids);
    console.log('clicked nodes:');
    console.log(clickedNodes);
    );


    Do you get the I'm clicked? at console?

    Do you get the clicked nodes:? at console?

    Do you get any error at console?






    share|improve this answer



























      0














      What problem do you have?

      Does your code reach the click event?



      Try:



      network.on( 'click', function(properties) 
      console.log('I'm clicked');
      var ids = properties.nodes;
      var clickedNodes = nodes.get(ids);
      console.log('clicked nodes:');
      console.log(clickedNodes);
      );


      Do you get the I'm clicked? at console?

      Do you get the clicked nodes:? at console?

      Do you get any error at console?






      share|improve this answer

























        0












        0








        0







        What problem do you have?

        Does your code reach the click event?



        Try:



        network.on( 'click', function(properties) 
        console.log('I'm clicked');
        var ids = properties.nodes;
        var clickedNodes = nodes.get(ids);
        console.log('clicked nodes:');
        console.log(clickedNodes);
        );


        Do you get the I'm clicked? at console?

        Do you get the clicked nodes:? at console?

        Do you get any error at console?






        share|improve this answer













        What problem do you have?

        Does your code reach the click event?



        Try:



        network.on( 'click', function(properties) 
        console.log('I'm clicked');
        var ids = properties.nodes;
        var clickedNodes = nodes.get(ids);
        console.log('clicked nodes:');
        console.log(clickedNodes);
        );


        Do you get the I'm clicked? at console?

        Do you get the clicked nodes:? at console?

        Do you get any error at console?







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 20 at 10:52









        Ran4DisplayRan4Display

        13




        13





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55049042%2fhow-to-make-a-node-in-vis-js-clickable%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            1928 у кіно

            Захаров Федір Захарович

            Ель Греко