Cytoscape.js cannot read property 'qtip' of undefined





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







2















I'm trying to use Qtip in addition to Cytoscape.js to show tooltip on mouseover nodes.
I followed the guide there but I'm unable to make it works, I get this error when my mouse is over a node :
enter image description here



This is the code related to the error :



cy.on('mouseover', 'node', function(event) {
var node = event.cyTarget;
node.qtip({
content: 'hello',
show: {
event: event.type,
ready: true
},
hide: {
event: 'mouseout unfocus'
}
}, event);
});


Here's my index where I call the .js files :



<!DOCTYPE>
<html>
<head>
<title>cytoscape-dagre.js demo</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<link href="css/style.css" rel="stylesheet" />
<link type="text/css" rel="stylesheet" href="css/jquery.qtip.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

</head>
<body>
<div id="cy"></div>
<script type="text/javascript" src="json/data_error.json"></script>

<script src="js/jquery.qtip.min.js"></script>
<script src="js/cytoscape.min.js"></script>
<script src="js/cytoscape-qtip.js"></script>
<script src="https://cdn.rawgit.com/cpettitt/dagre/v0.7.4/dist/dagre.min.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-dagre/1.5.0/cytoscape-dagre.js"></script>

<script src="js/code.js"></script>
</body>
</html>


What I'm doing wrong ? Many thanks !










share|improve this question























  • Are you inside of an iframe?

    – Stephan T.
    Nov 17 '18 at 9:19











  • No, I do not. Should I ?

    – Majestic
    Nov 18 '18 at 10:12











  • Nah, i just get that error because of an iframe i work with

    – Stephan T.
    Nov 18 '18 at 12:11











  • Sorry for the late answer, I just simply didn't see the mistake until now ;]

    – Stephan T.
    Nov 19 '18 at 5:45


















2















I'm trying to use Qtip in addition to Cytoscape.js to show tooltip on mouseover nodes.
I followed the guide there but I'm unable to make it works, I get this error when my mouse is over a node :
enter image description here



This is the code related to the error :



cy.on('mouseover', 'node', function(event) {
var node = event.cyTarget;
node.qtip({
content: 'hello',
show: {
event: event.type,
ready: true
},
hide: {
event: 'mouseout unfocus'
}
}, event);
});


Here's my index where I call the .js files :



<!DOCTYPE>
<html>
<head>
<title>cytoscape-dagre.js demo</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<link href="css/style.css" rel="stylesheet" />
<link type="text/css" rel="stylesheet" href="css/jquery.qtip.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

</head>
<body>
<div id="cy"></div>
<script type="text/javascript" src="json/data_error.json"></script>

<script src="js/jquery.qtip.min.js"></script>
<script src="js/cytoscape.min.js"></script>
<script src="js/cytoscape-qtip.js"></script>
<script src="https://cdn.rawgit.com/cpettitt/dagre/v0.7.4/dist/dagre.min.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-dagre/1.5.0/cytoscape-dagre.js"></script>

<script src="js/code.js"></script>
</body>
</html>


What I'm doing wrong ? Many thanks !










share|improve this question























  • Are you inside of an iframe?

    – Stephan T.
    Nov 17 '18 at 9:19











  • No, I do not. Should I ?

    – Majestic
    Nov 18 '18 at 10:12











  • Nah, i just get that error because of an iframe i work with

    – Stephan T.
    Nov 18 '18 at 12:11











  • Sorry for the late answer, I just simply didn't see the mistake until now ;]

    – Stephan T.
    Nov 19 '18 at 5:45














2












2








2








I'm trying to use Qtip in addition to Cytoscape.js to show tooltip on mouseover nodes.
I followed the guide there but I'm unable to make it works, I get this error when my mouse is over a node :
enter image description here



This is the code related to the error :



cy.on('mouseover', 'node', function(event) {
var node = event.cyTarget;
node.qtip({
content: 'hello',
show: {
event: event.type,
ready: true
},
hide: {
event: 'mouseout unfocus'
}
}, event);
});


Here's my index where I call the .js files :



<!DOCTYPE>
<html>
<head>
<title>cytoscape-dagre.js demo</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<link href="css/style.css" rel="stylesheet" />
<link type="text/css" rel="stylesheet" href="css/jquery.qtip.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

</head>
<body>
<div id="cy"></div>
<script type="text/javascript" src="json/data_error.json"></script>

<script src="js/jquery.qtip.min.js"></script>
<script src="js/cytoscape.min.js"></script>
<script src="js/cytoscape-qtip.js"></script>
<script src="https://cdn.rawgit.com/cpettitt/dagre/v0.7.4/dist/dagre.min.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-dagre/1.5.0/cytoscape-dagre.js"></script>

<script src="js/code.js"></script>
</body>
</html>


What I'm doing wrong ? Many thanks !










share|improve this question














I'm trying to use Qtip in addition to Cytoscape.js to show tooltip on mouseover nodes.
I followed the guide there but I'm unable to make it works, I get this error when my mouse is over a node :
enter image description here



This is the code related to the error :



cy.on('mouseover', 'node', function(event) {
var node = event.cyTarget;
node.qtip({
content: 'hello',
show: {
event: event.type,
ready: true
},
hide: {
event: 'mouseout unfocus'
}
}, event);
});


Here's my index where I call the .js files :



<!DOCTYPE>
<html>
<head>
<title>cytoscape-dagre.js demo</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<link href="css/style.css" rel="stylesheet" />
<link type="text/css" rel="stylesheet" href="css/jquery.qtip.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

</head>
<body>
<div id="cy"></div>
<script type="text/javascript" src="json/data_error.json"></script>

<script src="js/jquery.qtip.min.js"></script>
<script src="js/cytoscape.min.js"></script>
<script src="js/cytoscape-qtip.js"></script>
<script src="https://cdn.rawgit.com/cpettitt/dagre/v0.7.4/dist/dagre.min.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-dagre/1.5.0/cytoscape-dagre.js"></script>

<script src="js/code.js"></script>
</body>
</html>


What I'm doing wrong ? Many thanks !







javascript cytoscape.js qtip2 qtip






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 15:51









MajesticMajestic

3911521




3911521













  • Are you inside of an iframe?

    – Stephan T.
    Nov 17 '18 at 9:19











  • No, I do not. Should I ?

    – Majestic
    Nov 18 '18 at 10:12











  • Nah, i just get that error because of an iframe i work with

    – Stephan T.
    Nov 18 '18 at 12:11











  • Sorry for the late answer, I just simply didn't see the mistake until now ;]

    – Stephan T.
    Nov 19 '18 at 5:45



















  • Are you inside of an iframe?

    – Stephan T.
    Nov 17 '18 at 9:19











  • No, I do not. Should I ?

    – Majestic
    Nov 18 '18 at 10:12











  • Nah, i just get that error because of an iframe i work with

    – Stephan T.
    Nov 18 '18 at 12:11











  • Sorry for the late answer, I just simply didn't see the mistake until now ;]

    – Stephan T.
    Nov 19 '18 at 5:45

















Are you inside of an iframe?

– Stephan T.
Nov 17 '18 at 9:19





Are you inside of an iframe?

– Stephan T.
Nov 17 '18 at 9:19













No, I do not. Should I ?

– Majestic
Nov 18 '18 at 10:12





No, I do not. Should I ?

– Majestic
Nov 18 '18 at 10:12













Nah, i just get that error because of an iframe i work with

– Stephan T.
Nov 18 '18 at 12:11





Nah, i just get that error because of an iframe i work with

– Stephan T.
Nov 18 '18 at 12:11













Sorry for the late answer, I just simply didn't see the mistake until now ;]

– Stephan T.
Nov 19 '18 at 5:45





Sorry for the late answer, I just simply didn't see the mistake until now ;]

– Stephan T.
Nov 19 '18 at 5:45












1 Answer
1






active

oldest

votes


















3














The mistake is the var node = event.cyTarget, there is no such property as cyTarget, so just call event.target and you are gucci:






var cy = window.cy = cytoscape({
container: document.getElementById('cy'),

boxSelectionEnabled: false,
autounselectify: true,

style: [{
selector: 'node',
css: {
'content': 'data(id)',
'text-valign': 'center',
'text-halign': 'center',
'height': '60px',
'width': '60px',
'border-color': 'black',
'border-opacity': '1',
'border-width': '10px'
}
},
{
selector: '$node > node',
css: {
'padding-top': '10px',
'padding-left': '10px',
'padding-bottom': '10px',
'padding-right': '10px',
'text-valign': 'top',
'text-halign': 'center',
'background-color': '#bbb'
}
},
{
selector: 'edge',
css: {
'target-arrow-shape': 'triangle'
}
},
{
selector: ':selected',
css: {
'background-color': 'black',
'line-color': 'black',
'target-arrow-color': 'black',
'source-arrow-color': 'black'
}
}
],
layout: {
name: 'circle'
}
});

var info = [{
"name": "Peter",
"next_op_name": "Claire",
}, {
"name": "Claire",
"next_op_name": "Mike",
}, {
"name": "Mike",
"next_op_name": "Rosa",
}, {
"name": "Rosa",
"next_op_name": "Peter",
}];

cy.ready(function() {
var array = ;
// iterate over info once
for (var i = 0; i < info.length; i++) {
array.push({
group: 'nodes',
data: {
id: info[i].name, // id is name!!!
label: info[i].name
}
});
array.push({
group: 'edges',
data: {
id: 'e' + i,
source: info[i].name,
target: info[i].next_op_name
}
});
}
cy.add(array);
cy.layout({
name: 'circle'
}).run();
});


// Important part
cy.on('mouseover', 'node', function(event) {
var node = event.target; // cy.target is the right choice here
node.qtip({
content: 'hello',
show: {
event: event.type,
ready: true
},
hide: {
event: 'mouseout unfocus'
}
}, event);
});

body {
font: 14px helvetica neue, helvetica, arial, sans-serif;
}

#cy {
height: 100%;
width: 75%;
position: absolute;
left: 0;
top: 0;
float: left;
}

<html>

<head>
<meta charset=utf-8 />
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.17/cytoscape.min.js"></script>
<!-- qtip imports -->
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-qtip/2.7.0/cytoscape-qtip.js"></script>

<!-- dagre imports -->
<script src="https://unpkg.com/dagre@0.7.4/dist/dagre.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-dagre/1.5.0/cytoscape-dagre.js"></script>
</head>

<body>
<div id="cy"></div>
</body>

</html>








share|improve this answer



















  • 1





    Awesome Stephan ! It is working, thank's a lot ! :D

    – Majestic
    Nov 19 '18 at 7:43











  • No problemo, always a pleasure <3

    – Stephan T.
    Nov 19 '18 at 7:49












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%2f53341269%2fcytoscape-js-cannot-read-property-qtip-of-undefined%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









3














The mistake is the var node = event.cyTarget, there is no such property as cyTarget, so just call event.target and you are gucci:






var cy = window.cy = cytoscape({
container: document.getElementById('cy'),

boxSelectionEnabled: false,
autounselectify: true,

style: [{
selector: 'node',
css: {
'content': 'data(id)',
'text-valign': 'center',
'text-halign': 'center',
'height': '60px',
'width': '60px',
'border-color': 'black',
'border-opacity': '1',
'border-width': '10px'
}
},
{
selector: '$node > node',
css: {
'padding-top': '10px',
'padding-left': '10px',
'padding-bottom': '10px',
'padding-right': '10px',
'text-valign': 'top',
'text-halign': 'center',
'background-color': '#bbb'
}
},
{
selector: 'edge',
css: {
'target-arrow-shape': 'triangle'
}
},
{
selector: ':selected',
css: {
'background-color': 'black',
'line-color': 'black',
'target-arrow-color': 'black',
'source-arrow-color': 'black'
}
}
],
layout: {
name: 'circle'
}
});

var info = [{
"name": "Peter",
"next_op_name": "Claire",
}, {
"name": "Claire",
"next_op_name": "Mike",
}, {
"name": "Mike",
"next_op_name": "Rosa",
}, {
"name": "Rosa",
"next_op_name": "Peter",
}];

cy.ready(function() {
var array = ;
// iterate over info once
for (var i = 0; i < info.length; i++) {
array.push({
group: 'nodes',
data: {
id: info[i].name, // id is name!!!
label: info[i].name
}
});
array.push({
group: 'edges',
data: {
id: 'e' + i,
source: info[i].name,
target: info[i].next_op_name
}
});
}
cy.add(array);
cy.layout({
name: 'circle'
}).run();
});


// Important part
cy.on('mouseover', 'node', function(event) {
var node = event.target; // cy.target is the right choice here
node.qtip({
content: 'hello',
show: {
event: event.type,
ready: true
},
hide: {
event: 'mouseout unfocus'
}
}, event);
});

body {
font: 14px helvetica neue, helvetica, arial, sans-serif;
}

#cy {
height: 100%;
width: 75%;
position: absolute;
left: 0;
top: 0;
float: left;
}

<html>

<head>
<meta charset=utf-8 />
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.17/cytoscape.min.js"></script>
<!-- qtip imports -->
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-qtip/2.7.0/cytoscape-qtip.js"></script>

<!-- dagre imports -->
<script src="https://unpkg.com/dagre@0.7.4/dist/dagre.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-dagre/1.5.0/cytoscape-dagre.js"></script>
</head>

<body>
<div id="cy"></div>
</body>

</html>








share|improve this answer



















  • 1





    Awesome Stephan ! It is working, thank's a lot ! :D

    – Majestic
    Nov 19 '18 at 7:43











  • No problemo, always a pleasure <3

    – Stephan T.
    Nov 19 '18 at 7:49
















3














The mistake is the var node = event.cyTarget, there is no such property as cyTarget, so just call event.target and you are gucci:






var cy = window.cy = cytoscape({
container: document.getElementById('cy'),

boxSelectionEnabled: false,
autounselectify: true,

style: [{
selector: 'node',
css: {
'content': 'data(id)',
'text-valign': 'center',
'text-halign': 'center',
'height': '60px',
'width': '60px',
'border-color': 'black',
'border-opacity': '1',
'border-width': '10px'
}
},
{
selector: '$node > node',
css: {
'padding-top': '10px',
'padding-left': '10px',
'padding-bottom': '10px',
'padding-right': '10px',
'text-valign': 'top',
'text-halign': 'center',
'background-color': '#bbb'
}
},
{
selector: 'edge',
css: {
'target-arrow-shape': 'triangle'
}
},
{
selector: ':selected',
css: {
'background-color': 'black',
'line-color': 'black',
'target-arrow-color': 'black',
'source-arrow-color': 'black'
}
}
],
layout: {
name: 'circle'
}
});

var info = [{
"name": "Peter",
"next_op_name": "Claire",
}, {
"name": "Claire",
"next_op_name": "Mike",
}, {
"name": "Mike",
"next_op_name": "Rosa",
}, {
"name": "Rosa",
"next_op_name": "Peter",
}];

cy.ready(function() {
var array = ;
// iterate over info once
for (var i = 0; i < info.length; i++) {
array.push({
group: 'nodes',
data: {
id: info[i].name, // id is name!!!
label: info[i].name
}
});
array.push({
group: 'edges',
data: {
id: 'e' + i,
source: info[i].name,
target: info[i].next_op_name
}
});
}
cy.add(array);
cy.layout({
name: 'circle'
}).run();
});


// Important part
cy.on('mouseover', 'node', function(event) {
var node = event.target; // cy.target is the right choice here
node.qtip({
content: 'hello',
show: {
event: event.type,
ready: true
},
hide: {
event: 'mouseout unfocus'
}
}, event);
});

body {
font: 14px helvetica neue, helvetica, arial, sans-serif;
}

#cy {
height: 100%;
width: 75%;
position: absolute;
left: 0;
top: 0;
float: left;
}

<html>

<head>
<meta charset=utf-8 />
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.17/cytoscape.min.js"></script>
<!-- qtip imports -->
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-qtip/2.7.0/cytoscape-qtip.js"></script>

<!-- dagre imports -->
<script src="https://unpkg.com/dagre@0.7.4/dist/dagre.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-dagre/1.5.0/cytoscape-dagre.js"></script>
</head>

<body>
<div id="cy"></div>
</body>

</html>








share|improve this answer



















  • 1





    Awesome Stephan ! It is working, thank's a lot ! :D

    – Majestic
    Nov 19 '18 at 7:43











  • No problemo, always a pleasure <3

    – Stephan T.
    Nov 19 '18 at 7:49














3












3








3







The mistake is the var node = event.cyTarget, there is no such property as cyTarget, so just call event.target and you are gucci:






var cy = window.cy = cytoscape({
container: document.getElementById('cy'),

boxSelectionEnabled: false,
autounselectify: true,

style: [{
selector: 'node',
css: {
'content': 'data(id)',
'text-valign': 'center',
'text-halign': 'center',
'height': '60px',
'width': '60px',
'border-color': 'black',
'border-opacity': '1',
'border-width': '10px'
}
},
{
selector: '$node > node',
css: {
'padding-top': '10px',
'padding-left': '10px',
'padding-bottom': '10px',
'padding-right': '10px',
'text-valign': 'top',
'text-halign': 'center',
'background-color': '#bbb'
}
},
{
selector: 'edge',
css: {
'target-arrow-shape': 'triangle'
}
},
{
selector: ':selected',
css: {
'background-color': 'black',
'line-color': 'black',
'target-arrow-color': 'black',
'source-arrow-color': 'black'
}
}
],
layout: {
name: 'circle'
}
});

var info = [{
"name": "Peter",
"next_op_name": "Claire",
}, {
"name": "Claire",
"next_op_name": "Mike",
}, {
"name": "Mike",
"next_op_name": "Rosa",
}, {
"name": "Rosa",
"next_op_name": "Peter",
}];

cy.ready(function() {
var array = ;
// iterate over info once
for (var i = 0; i < info.length; i++) {
array.push({
group: 'nodes',
data: {
id: info[i].name, // id is name!!!
label: info[i].name
}
});
array.push({
group: 'edges',
data: {
id: 'e' + i,
source: info[i].name,
target: info[i].next_op_name
}
});
}
cy.add(array);
cy.layout({
name: 'circle'
}).run();
});


// Important part
cy.on('mouseover', 'node', function(event) {
var node = event.target; // cy.target is the right choice here
node.qtip({
content: 'hello',
show: {
event: event.type,
ready: true
},
hide: {
event: 'mouseout unfocus'
}
}, event);
});

body {
font: 14px helvetica neue, helvetica, arial, sans-serif;
}

#cy {
height: 100%;
width: 75%;
position: absolute;
left: 0;
top: 0;
float: left;
}

<html>

<head>
<meta charset=utf-8 />
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.17/cytoscape.min.js"></script>
<!-- qtip imports -->
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-qtip/2.7.0/cytoscape-qtip.js"></script>

<!-- dagre imports -->
<script src="https://unpkg.com/dagre@0.7.4/dist/dagre.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-dagre/1.5.0/cytoscape-dagre.js"></script>
</head>

<body>
<div id="cy"></div>
</body>

</html>








share|improve this answer













The mistake is the var node = event.cyTarget, there is no such property as cyTarget, so just call event.target and you are gucci:






var cy = window.cy = cytoscape({
container: document.getElementById('cy'),

boxSelectionEnabled: false,
autounselectify: true,

style: [{
selector: 'node',
css: {
'content': 'data(id)',
'text-valign': 'center',
'text-halign': 'center',
'height': '60px',
'width': '60px',
'border-color': 'black',
'border-opacity': '1',
'border-width': '10px'
}
},
{
selector: '$node > node',
css: {
'padding-top': '10px',
'padding-left': '10px',
'padding-bottom': '10px',
'padding-right': '10px',
'text-valign': 'top',
'text-halign': 'center',
'background-color': '#bbb'
}
},
{
selector: 'edge',
css: {
'target-arrow-shape': 'triangle'
}
},
{
selector: ':selected',
css: {
'background-color': 'black',
'line-color': 'black',
'target-arrow-color': 'black',
'source-arrow-color': 'black'
}
}
],
layout: {
name: 'circle'
}
});

var info = [{
"name": "Peter",
"next_op_name": "Claire",
}, {
"name": "Claire",
"next_op_name": "Mike",
}, {
"name": "Mike",
"next_op_name": "Rosa",
}, {
"name": "Rosa",
"next_op_name": "Peter",
}];

cy.ready(function() {
var array = ;
// iterate over info once
for (var i = 0; i < info.length; i++) {
array.push({
group: 'nodes',
data: {
id: info[i].name, // id is name!!!
label: info[i].name
}
});
array.push({
group: 'edges',
data: {
id: 'e' + i,
source: info[i].name,
target: info[i].next_op_name
}
});
}
cy.add(array);
cy.layout({
name: 'circle'
}).run();
});


// Important part
cy.on('mouseover', 'node', function(event) {
var node = event.target; // cy.target is the right choice here
node.qtip({
content: 'hello',
show: {
event: event.type,
ready: true
},
hide: {
event: 'mouseout unfocus'
}
}, event);
});

body {
font: 14px helvetica neue, helvetica, arial, sans-serif;
}

#cy {
height: 100%;
width: 75%;
position: absolute;
left: 0;
top: 0;
float: left;
}

<html>

<head>
<meta charset=utf-8 />
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.17/cytoscape.min.js"></script>
<!-- qtip imports -->
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-qtip/2.7.0/cytoscape-qtip.js"></script>

<!-- dagre imports -->
<script src="https://unpkg.com/dagre@0.7.4/dist/dagre.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-dagre/1.5.0/cytoscape-dagre.js"></script>
</head>

<body>
<div id="cy"></div>
</body>

</html>








var cy = window.cy = cytoscape({
container: document.getElementById('cy'),

boxSelectionEnabled: false,
autounselectify: true,

style: [{
selector: 'node',
css: {
'content': 'data(id)',
'text-valign': 'center',
'text-halign': 'center',
'height': '60px',
'width': '60px',
'border-color': 'black',
'border-opacity': '1',
'border-width': '10px'
}
},
{
selector: '$node > node',
css: {
'padding-top': '10px',
'padding-left': '10px',
'padding-bottom': '10px',
'padding-right': '10px',
'text-valign': 'top',
'text-halign': 'center',
'background-color': '#bbb'
}
},
{
selector: 'edge',
css: {
'target-arrow-shape': 'triangle'
}
},
{
selector: ':selected',
css: {
'background-color': 'black',
'line-color': 'black',
'target-arrow-color': 'black',
'source-arrow-color': 'black'
}
}
],
layout: {
name: 'circle'
}
});

var info = [{
"name": "Peter",
"next_op_name": "Claire",
}, {
"name": "Claire",
"next_op_name": "Mike",
}, {
"name": "Mike",
"next_op_name": "Rosa",
}, {
"name": "Rosa",
"next_op_name": "Peter",
}];

cy.ready(function() {
var array = ;
// iterate over info once
for (var i = 0; i < info.length; i++) {
array.push({
group: 'nodes',
data: {
id: info[i].name, // id is name!!!
label: info[i].name
}
});
array.push({
group: 'edges',
data: {
id: 'e' + i,
source: info[i].name,
target: info[i].next_op_name
}
});
}
cy.add(array);
cy.layout({
name: 'circle'
}).run();
});


// Important part
cy.on('mouseover', 'node', function(event) {
var node = event.target; // cy.target is the right choice here
node.qtip({
content: 'hello',
show: {
event: event.type,
ready: true
},
hide: {
event: 'mouseout unfocus'
}
}, event);
});

body {
font: 14px helvetica neue, helvetica, arial, sans-serif;
}

#cy {
height: 100%;
width: 75%;
position: absolute;
left: 0;
top: 0;
float: left;
}

<html>

<head>
<meta charset=utf-8 />
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.17/cytoscape.min.js"></script>
<!-- qtip imports -->
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-qtip/2.7.0/cytoscape-qtip.js"></script>

<!-- dagre imports -->
<script src="https://unpkg.com/dagre@0.7.4/dist/dagre.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-dagre/1.5.0/cytoscape-dagre.js"></script>
</head>

<body>
<div id="cy"></div>
</body>

</html>





var cy = window.cy = cytoscape({
container: document.getElementById('cy'),

boxSelectionEnabled: false,
autounselectify: true,

style: [{
selector: 'node',
css: {
'content': 'data(id)',
'text-valign': 'center',
'text-halign': 'center',
'height': '60px',
'width': '60px',
'border-color': 'black',
'border-opacity': '1',
'border-width': '10px'
}
},
{
selector: '$node > node',
css: {
'padding-top': '10px',
'padding-left': '10px',
'padding-bottom': '10px',
'padding-right': '10px',
'text-valign': 'top',
'text-halign': 'center',
'background-color': '#bbb'
}
},
{
selector: 'edge',
css: {
'target-arrow-shape': 'triangle'
}
},
{
selector: ':selected',
css: {
'background-color': 'black',
'line-color': 'black',
'target-arrow-color': 'black',
'source-arrow-color': 'black'
}
}
],
layout: {
name: 'circle'
}
});

var info = [{
"name": "Peter",
"next_op_name": "Claire",
}, {
"name": "Claire",
"next_op_name": "Mike",
}, {
"name": "Mike",
"next_op_name": "Rosa",
}, {
"name": "Rosa",
"next_op_name": "Peter",
}];

cy.ready(function() {
var array = ;
// iterate over info once
for (var i = 0; i < info.length; i++) {
array.push({
group: 'nodes',
data: {
id: info[i].name, // id is name!!!
label: info[i].name
}
});
array.push({
group: 'edges',
data: {
id: 'e' + i,
source: info[i].name,
target: info[i].next_op_name
}
});
}
cy.add(array);
cy.layout({
name: 'circle'
}).run();
});


// Important part
cy.on('mouseover', 'node', function(event) {
var node = event.target; // cy.target is the right choice here
node.qtip({
content: 'hello',
show: {
event: event.type,
ready: true
},
hide: {
event: 'mouseout unfocus'
}
}, event);
});

body {
font: 14px helvetica neue, helvetica, arial, sans-serif;
}

#cy {
height: 100%;
width: 75%;
position: absolute;
left: 0;
top: 0;
float: left;
}

<html>

<head>
<meta charset=utf-8 />
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.17/cytoscape.min.js"></script>
<!-- qtip imports -->
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-qtip/2.7.0/cytoscape-qtip.js"></script>

<!-- dagre imports -->
<script src="https://unpkg.com/dagre@0.7.4/dist/dagre.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-dagre/1.5.0/cytoscape-dagre.js"></script>
</head>

<body>
<div id="cy"></div>
</body>

</html>






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 19 '18 at 5:44









Stephan T.Stephan T.

1,3161921




1,3161921








  • 1





    Awesome Stephan ! It is working, thank's a lot ! :D

    – Majestic
    Nov 19 '18 at 7:43











  • No problemo, always a pleasure <3

    – Stephan T.
    Nov 19 '18 at 7:49














  • 1





    Awesome Stephan ! It is working, thank's a lot ! :D

    – Majestic
    Nov 19 '18 at 7:43











  • No problemo, always a pleasure <3

    – Stephan T.
    Nov 19 '18 at 7:49








1




1





Awesome Stephan ! It is working, thank's a lot ! :D

– Majestic
Nov 19 '18 at 7:43





Awesome Stephan ! It is working, thank's a lot ! :D

– Majestic
Nov 19 '18 at 7:43













No problemo, always a pleasure <3

– Stephan T.
Nov 19 '18 at 7:49





No problemo, always a pleasure <3

– Stephan T.
Nov 19 '18 at 7:49




















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%2f53341269%2fcytoscape-js-cannot-read-property-qtip-of-undefined%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

Bressuire

Vorschmack

Quarantine