02-25-2016 12:03 PM
Quote from Bruno Klauser email
Performance issues with JS Client after opening/closing NodeSets multiple times to overlay paths (2) over links
nx.define('Tooltip.Node', nx.ui.Component, {
view: {
content: [{
name: 'topo',
type: 'nx.graphic.Topology',
props: {
...
nodeInstanceClass: 'NTSNode',
nodeSetInstanceClass: 'NTSNodeSet',
linkInstanceClass: "NTSLink",
...
}
}]
...
}
}
In the ’NTSLink‘ class, I call the ‘addPath‘ function from the ‘update’ function. Because of this every link gets two paths.
Now, the more Nodes and Links are in the topology, the worse will be the performance.
When opening a NodeSet, the application is not opening the nodes fluid.
If I remove the ‘addPath’ function, everything works fine.
nx.define('NTSLink', nx.graphic.Topology.Link, {
methods: {
update: function() {
this.inherited();
this.addPath();
},
addPath : function(){
var pathLayer = this.topology().getLayer("paths")
var links1 = [this];
var path1 = new NTSPath({
pathPadding: [20, '50%'],
pathWidth: 1,
links: links1,
arrow: 'end',
pathStyle : {
stroke: '#6BC7E2',
fill: "#6BC7E2",
cursor: "pointer"
},
isFirstPath : true
});
var path2 = new NTSPath({
pathPadding: [20, '50%'],
pathWidth: 1,
links: links1,
reverse: true,
arrow: 'end',
pathStyle : {
stroke: '#007699',
fill: "#007699",
cursor: "pointer"
},
isFirstPath : false
});
pathLayer.addPath(path1);
pathLayer.addPath(path2);
}
}
});
Solved! Go to Solution.
02-25-2016 12:10 PM
The performance issues cause by :
when nodeSet opening, it will redraw all the related links and 'update' function will be invoked 60 times/second, so in this case, you add dozens of paths to topology. So you can add a simple logic to detacted if you have attached path or not.
And better way is use general way to add path or just extend 'attach' function in your links instance.
Abu
02-25-2016 12:10 PM
The performance issues cause by :
when nodeSet opening, it will redraw all the related links and 'update' function will be invoked 60 times/second, so in this case, you add dozens of paths to topology. So you can add a simple logic to detacted if you have attached path or not.
And better way is use general way to add path or just extend 'attach' function in your links instance.
Abu
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide