cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
426
Views
0
Helpful
1
Replies

Performance issues with JS Client after opening/closing NodeSets multiple times to overlay paths over links

aaikepae
Cisco Employee
Cisco Employee

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);

                              }

               }

});

1 Accepted Solution

Accepted Solutions

aaikepae
Cisco Employee
Cisco Employee

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

View solution in original post

1 Reply 1

aaikepae
Cisco Employee
Cisco Employee

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

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers