How to use vis-network - 10 common examples

To help you get started, we’ve selected a few vis-network examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fenglex / janusgraph-visualization / vue / src / components / gremlin.vue View on Github external
}).then(res => {
						var result = res.data;
						this.$data.gremlinResult = result.result.replace(/\n/g, "<br>");
						console.info(result);
						// create a network
						var container = document.getElementById('graph');
						var nodes = new vis.DataSet(result.vertices);
						var edges = new vis.DataSet(result.edges);
						// provide the data in the vis format
						var data = {
							nodes: nodes,
							edges: edges
						};
						var options = {
							edges: {
								arrows: {
									to: {
										type: "arrow",
										enabled: true
									}
								}
							},
							nodes: {
github fenglex / janusgraph-visualization / vue / src / components / gremlin.vue View on Github external
}).then(res =&gt; {
						var result = res.data;
						this.$data.gremlinResult = result.result.replace(/\n/g, "<br>");
						console.info(result);
						// create a network
						var container = document.getElementById('graph');
						var nodes = new vis.DataSet(result.vertices);
						var edges = new vis.DataSet(result.edges);
						// provide the data in the vis format
						var data = {
							nodes: nodes,
							edges: edges
						};
						var options = {
							edges: {
								arrows: {
									to: {
										type: "arrow",
										enabled: true
									}
								}
							},
							nodes: {
								shape: 'circle'
github pycook / cmdb / ui / src / views / cmdb / modeling / preference_relation / index.vue View on Github external
setTimeout(() => {
          const container = document.querySelector('#view-' + this.relationViews.views[viewName].topo_flatten.join(''))
          const n = new Network(container, data, options)
          console.log(n) // TODO
        }, 100)
      })
github Thomaash / me / src / components / vis / VisCanvas.vue View on Github external
shape: 'image',
          color: this.buildGroupColor(theme.switch),
          size: 25,
          image: switchImg
        }
      }
    }

    // Create and fill datasets
    const nodes = this.nodes = new DataSet()
    const edges = this.edges = new DataSet()
    // It's necessary to load the items now, otherwise the network would be labeld as ready before the items are visible.
    this.replaceItems()

    // Create the network
    const net = new Network(this.$refs.vis, { nodes, edges }, options)
    this.net = net

    // Some labels contain placeholders for info from connected nodes.
    // Therefore this can't be done before the topology is built.
    this.updateLabels()

    this.cleanUpCallbacks.push(this.$store.subscribe(({ type, payload }, { data }) => {
      ;(this.storeActions[type] || (() => {}))(payload, data)
    }))

    this.$emit('ready', { container, net, nodes, edges })
  },
  beforeDestroy () {
github pycook / cmdb / ui / src / views / cmdb / modeling / preference_relation / index.vue View on Github external
nodes.push({
              id: item.parent.id,
              label: item.parent.alias
            })
          }

          nodeMap[item.child.id] = 1
          nodeMap[item.parent.id] = 1

          edges.push({
            from: item.parent.id,
            to: item.child.id,
            label: item.relation_type.name
          })
        })
        const _nodes = new DataSet(nodes)

        const _edges = new DataSet(edges)
        this.nodes = _nodes
        this.edges = _edges
        // create a network
        this.container = document.querySelector('#visualization')

        // provide the data in the vis format
        var data = {
          nodes: _nodes,
          edges: _edges
        }
        var options = {
          layout: { randomSeed: 2 },
          autoResize: true,
          nodes: {
github pycook / cmdb / ui / src / views / cmdb / modeling / preference_relation / index.vue View on Github external
label: item.parent.alias
            })
          }

          nodeMap[item.child.id] = 1
          nodeMap[item.parent.id] = 1

          edges.push({
            from: item.parent.id,
            to: item.child.id,
            label: item.relation_type.name
          })
        })
        const _nodes = new DataSet(nodes)

        const _edges = new DataSet(edges)
        this.nodes = _nodes
        this.edges = _edges
        // create a network
        this.container = document.querySelector('#visualization')

        // provide the data in the vis format
        var data = {
          nodes: _nodes,
          edges: _edges
        }
        var options = {
          layout: { randomSeed: 2 },
          autoResize: true,
          nodes: {
            size: 30,
            font: {
github zewa666 / aurelia-store-examples / vis / src / state-visualization.js View on Github external
githubUsersChanged() {
    if (this.githubUsers.length === 0) {
      return;
    }

    const nodes = new vis.DataSet(this.githubUsers.map((user) => ({
      id: user.id,
      label: user.login,
      title: user.login
    })));

    // create an array with edges
    const edges = new vis.DataSet(this.githubUsers.slice(1).map((user, idx) => {
      return {
        from: this.githubUsers[idx].id,
        to: user.id
      };
    }));

    if (!this.network) {
      this.network = new vis.Network(this.host, { nodes, edges }, {
        interaction: {
github pycook / cmdb / ui / src / views / cmdb / modeling / preference_relation / index.vue View on Github external
physics: {
            enabled: false
          },
          interaction: {
            hover: true,
            dragView: true,
            dragNodes: true,
            multiselect: true
          }
        }

        // initialize your network!
        this.container.oncontextmenu = () => { return false }
        this.options = options
        this.viewData = data
        this.network = new Network(this.container, data, options)
        this.canvas = this.network.canvas.frame.canvas
        this.ctx = this.canvas.getContext('2d')
      })
    },
github crubier / react-graph-vis / src / index.js View on Github external
smooth: false,
        color: "#000000",
        width: 0.5,
        arrows: {
          to: {
            enabled: true,
            scaleFactor: 0.5
          }
        }
      }
    };

    // merge user provied options with our default ones
    let options = defaultsDeep(defaultOptions, this.props.options);

    this.Network = new vis.Network(
      container,
      Object.assign({}, this.props.graph, {
        edges: this.edges,
        nodes: this.nodes
      }),
      options
    );

    if (this.props.getNetwork) {
      this.props.getNetwork(this.Network);
    }

    if (this.props.getNodes) {
      this.props.getNodes(this.nodes);
    }
github zewa666 / aurelia-store-examples / vis / src / state-visualization.js View on Github external
const nodes = new vis.DataSet(this.githubUsers.map((user) => ({
      id: user.id,
      label: user.login,
      title: user.login
    })));

    // create an array with edges
    const edges = new vis.DataSet(this.githubUsers.slice(1).map((user, idx) => {
      return {
        from: this.githubUsers[idx].id,
        to: user.id
      };
    }));

    if (!this.network) {
      this.network = new vis.Network(this.host, { nodes, edges }, {
        interaction: {
          hover: true
        },
        nodes: {
          color: {
            hover: {
              border: '#2B7CE9',
              background: '#D2E5FF'
            }
          }
        }
      });
    } else {
      this.network.setData({ edges, nodes });
    }
  }

vis-network

A dynamic, browser-based visualization library.

Apache-2.0
Latest version published 1 year ago

Package Health Score

81 / 100
Full package analysis