vidi-graph-gl

Graph visualization package based on three.js

Usage no npm install needed!

<script type="module">
  import vidiGraphGl from 'https://cdn.skypack.dev/vidi-graph-gl';
</script>

README


Graph-GL

Minimized graph visualization package only for rendering and interactions.
Explore the docs »

Demo Under Construction · Report Bug · Request Feature

package

Table of Contents

About The Project

Graph-gl is a minimum package dedicated to render graphs and handel interactions based on WebGL.

Built With

Notification

Check out npm or github release branch for latest version.

The interaction feature is under development and will be released very soon.

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • npm
npm install npm@latest -g

Installation

Using the lib

The library could be installed with

npm install vidi-graph-gl

Develop the lib

  1. Clone the repo
git clone https://github.com/haicatw/graph-gl.git
  1. Install NPM packages
npm install
  1. Lint
npm run lint
  1. Build
npm run build

Usage

  1. Import the library

    import GraphGL from "vidi-graph-gl";
    
  2. Initialize the instance

    const graphGLInstance = new GraphGL({ selector: "#container" });
    
  3. Load your graph

    const myGraph = {
        nodes: [
            { id: 0, x: 0, y: 0, size: 40, label: "testing..." },
            { id: 1, x: 3.4, y: -5.2, size: 30, borderWidth: 10, label: "testing" },
            { id: 2, x: 0, y: 10, size: 30, borderWidth: 30, label: "testing label"},
        ],
        edges: [{ id: 0, source: 2, target: 1, color: "#2ec1ac", width: 1 }],
    };
    graphGLInstance.readGraph(myGraph);
    

    initialization

  4. Update visualization

    graphGLInstance.refresh();
    
  5. Update graph data

    for(const node of graphGLInstance.nodes()) { // or .edges() for updating edges
        node.color = '#000000'
        node.borderWidth = 40
        node.opacity = 0.5
        node.borderColor = '#2ec1ac'
        node.size = 40
        node.label = "new label"
    }
    graphGLInstance.refresh();
    

    updated

  6. Clear current graph data

    graphGLInstance.clear();
    

Roadmap

See the open issues for a list of proposed features (and known issues).

Features

  • Graph model
  • Node visual encoding
  • Edge visual encoding
  • Curved edge
  • Auto fit scene
  • Label
  • Interaction handler
  • Graph hot updator

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.