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

https://github.com/gram-data/d3-gram

D3 support for gram format.
https://github.com/gram-data/d3-gram

d3 d3-gram gram gram-format

Last synced: 5 months ago
JSON representation

D3 support for gram format.

Awesome Lists containing this project

README

          

D3 support for the [gram](http://gram-data.github.io) text format of graph data. `(a)-->(b)<--(c)`

## How to d3-gram

`d3Gram()` parses text in the gram format, producing a graph of nodes and links that is
ready to be used in a `d3-force` simulation.

``` TypeScript
import * as d3 from "d3";
import {parse, layout, draw, drag, updateNodes, updateLinks} from 'd3-gram';

d3.text("https://raw.githubusercontent.com/gram-data/d3-gram/master/public/miserables.gram").then( gramSource => {

let graph = parse(gramSource);

let simulation = layout(graph);

const {nodeSelection, linkSelection} = draw(graph, "svg");

nodeSelection.call(drag(simulation));

simulation.on("tick", () => {
updateNodes(nodeSelection);
updateLinks(linkSelection);
});
}
```