emiliorizzo / vue-d3-network

Vue component to graph networks using d3-force
https://emiliorizzo.github.io/vue-d3-network/
MIT License
511 stars 139 forks source link
chart component d3 d3-force d3v4 graph network vue

GitHub issues GitHub license npm

vue-d3-network

Vue component to graph networks using d3-force

vue d3 network

Demo

Demo

Features

Installation

npm install vue-d3-network --save

Usage

<d3-network :net-nodes="nodes" :net-links="links" :options="options" />
import D3Network from 'vue-d3-network'
  components: {
    D3Network
  }

<style src="https://github.com/emiliorizzo/vue-d3-network/raw/master/vue-d3-network/dist/vue-d3-network.css"></style>

Or: import source component from: 'vue-d3-network/src/vue-d3-network.vue' And install devDependencies. (d3-force, stylus and pug) See: package.json)

Props

net-nodes: Array of node objects

net-links: Array of link objects

selection : Object, links and nodes selected

nodeSym: String, node sprite svg doc

nodeCb: Function(node) -> node, node formatter

linkCb: Function(link) -> link, node link formatter

simCb: Function(sim) -> sim, d3 simulation formatter

customForces: Object: { [d3Function]:args }

options:

Events

Methods

Node object

Link Object

Css style and canvas style

SVG css classes:

To use this css styles in canvas we create 'ghosts' svg elements to pick up values from computed css properties. If you want, you can stylize the canvas elements directly, setting: options.canvasStyles, but these styles will not be applied to the svg graph.

see: src/canvasStyles.js

TODO

More Examples