GetNode

HTML

<link rel="stylesheet" href="https://abdvl.github.io/src/dist/css/next.css">
<script src="https://abdvl.github.io/src/dist/js/next.js"></script>
<button onClick="getNode()">GetNode</button>

CSS

body,
html {
  height: 100%;
}

JavaScript

topo = new nx.graphic.Topology({
  adaptive: true,
  nodeConfig: {
    label: 'model.id',
  },
  showIcon: true,
  theme: 'yellow'
});

topo.on('ready', function() {
  topo.data(topologyData);
});

getNode = function() {
	console.log(topo.getNode(0))
}

var app = new nx.ui.Application();
topo.attach(app);

var topologyData = {
  nodes: [{
    "id": 0,
    "x": 410,
    "y": 100,
    "name": "12K-1"
  }, {
    "id": 1,
    "x": 410,
    "y": 280,
    "name": "12K-2"
  }, {
    "id": 2,
    "x": 660,
    "y": 280,
    "name": "Of-9k-03"
  }, {
    "id": 3,
    "x": 660,
    "y": 100,
    "name": "Of-9k-02"
  }, {
    "id": 4,
    "x": 180,
    "y": 190,
    "name": "Of-9k-01"
  }],
  links: [{
    "source": 0,
    "target": 1
  }, {
    "source": 1,
    "target": 2
  }, {
    "source": 1,
    "target": 3
  }, {
    "source": 4,
    "target": 1
  }, {
    "source": 2,
    "target": 3
  }, {
    "source": 2,
    "target": 0
  }, {
    "source": 3,
    "target": 0
  }, {
    "source": 3,
    "target": 0
  }, {
    "source": 3,
    "target": 0
  }, {
    "source": 0,
    "target": 4
  }, {
    "source": 0,
    "target": 4
  }],
  nodeSet: [{
    id: 5,
    nodes: [0, 1],
    "x": 300,
    "y": 300,
    "name": "Node set 1",
    iconType: 'router'
  }]
};