Coder Social home page Coder Social logo

graph.d3's Introduction

Graph.d3

Overview

This is a wrapper object around D3js, which allows developers to instantiate multiple instances of the visualization and facilitate reusability.

Data Format

The following JSON is an example of the require format consumable by the Graph object.

{
    "nodes":[
        {"name":"A","group":1},
        {"name":"B","group":1},
        {"name":"C","group":1},
        {"name":"D","group":1},
        {"name":"E","group":1},
        {"name":"F","group":1},
        {"name":"G","group":1}
    ],
    "links": [
        {"source":1,"target":0,"value":1},
        {"source":2,"target":1,"value":8},
        {"source":3,"target":0,"value":10},
        {"source":3,"target":2,"value":6},
        {"source":4,"target":0,"value":1},
        {"source":5,"target":0,"value":1},    
    ]
}

Get Started

The following code is the minimum requirement to get started

 var graph = Graph();
 
 var data = { "nodes":[ ... ], "links":[ ... ] }
 
 var container = d3.select("#vis").datum(data).call(graph);

Manipulable Attributes

The following are manipulable attributes of the Graph object

graph.width

Changes the width of the container

graph.height;

Changes the height of the container

graph.color;

Changes the color scale for D3

  • d3.scale.category10()
  • d3.scale.category20()
  • d3.scale.category20b()
  • d3.scale.category20c()

graph.container;

Identifier of the container div where SVG will be appended

graph.charge;

How close the nodes will be to each other

graph.linkDistance;

Changes length of links

graph.shape;

Shape of the node

  • rect
  • circle

graph.size;

Size of the node

graph.linkClass;

CSS class of the links

graph.nodeClass;

CSS class of the nodes

graph.d3's People

Contributors

ngokchau avatar

Watchers

 avatar  avatar

Forkers

nadavash

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.