-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build API docs using jsdoc-to-markdown
- Loading branch information
Showing
6 changed files
with
1,124 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Viz.js | ||
|
||
This project builds [Graphviz](http://www.graphviz.org) with [Emscripten](https://emscripten.org) and provides a simple wrapper for using it on the web. | ||
|
||
## Install | ||
|
||
Viz.js is published on NPM as `@viz-js/viz`. | ||
|
||
## Usage | ||
|
||
Call `instance()`, which returns a `Promise` that resolves to a new `Viz` instance. Then call any of the instance's `render` methods to render a graph. A graph can be written in [the DOT language](https://www.graphviz.org/doc/info/lang.html) or as a plain JavaScript object. The `renderSVGElement()` method is convenient for displaying a graph in a webpage. The instance can be reused for multiple `render` calls. | ||
|
||
```js | ||
<script type="module"> | ||
import { instance } from "@viz-js/viz"; | ||
instance().then(function(viz) { | ||
// DOT string | ||
document.body.appendChild(viz.renderSVGElement("digraph { a -> b }")); | ||
// Graph object | ||
document.body.appendChild(viz.renderSVGElement({ | ||
edges: [ | ||
{ tail: "a", head: "b" } | ||
] | ||
})); | ||
}); | ||
</script> | ||
``` | ||
|
||
See the examples directory for more. | ||
|
||
## API | ||
|
||
{{>main}} |
Oops, something went wrong.