Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nenuadrian/d3-html5-canvas-graph-network

Example code on how to create and interact with a network of nodes in a canvas element, a graph, using the D3 javascript library which is mainly build for SVG. Presumably Canvas should be faster in most cases.
https://github.com/nenuadrian/d3-html5-canvas-graph-network

canvas canvas-element d3 d3js drawing-app graph graphs html5 javascript js

Last synced: 7 days ago
JSON representation

Example code on how to create and interact with a network of nodes in a canvas element, a graph, using the D3 javascript library which is mainly build for SVG. Presumably Canvas should be faster in most cases.

Awesome Lists containing this project

README

        

# D3-HTML5-Canvas-Graph-Network
Example code on how to create and interact with a network of nodes in a canvas element, a graph, using the D3 javascript library which is mainly build for SVG. Presumably Canvas should be faster in most cases.

However, on my tests on Android, the speed is improved but it's still laggy as Android does not properly support some web technologies. Everything works just that it will skip frame rates.

On laptops, desktops, iOS, etc, it runs very smoothly.

The code also bounds the nodes to the inside of the canvas in a bounding box.

Moreover, D3 transitions are possible thanks to the fact that we'll be generating DOM elements for D3 to run on, outside of the canvas, and then use their attributes on draw.

I'm using the RandomGraph JS library to generate graph data conveniently.