Comparing version 1.4.1 to 1.5.0
{ | ||
"name": "viz.js", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "A hack to put Graphviz on the web.", | ||
@@ -5,0 +5,0 @@ "main": "viz.js", |
@@ -17,8 +17,10 @@ # Viz.js | ||
## "Lite" Version | ||
A smaller version of Viz.js can be downloaded from the [releases page](https://github.com/mdaines/viz.js/releases). `viz-lite.js` omits Expat and the NEATO layout plugin. | ||
## API | ||
Viz.js defines a single function to handle most cases: | ||
### Viz(src, options={ format="svg", engine="dot", scale }) | ||
Viz(src, options={ format="svg", engine="dot", scale }) | ||
- `src` is a string representing the graph to render in the DOT language. | ||
@@ -30,3 +32,3 @@ - `options` | ||
Output is returned as a string, except when using the "png-image-element" format, when it is returned as an instance of HTMLImageElement. | ||
Parses `src` and renders a graph according to the `options` given. Output is a string, except when using the "png-image-element" format, when it is returned as an instance of HTMLImageElement. | ||
@@ -42,2 +44,18 @@ For example: | ||
### Viz.svgXmlToPngImageElement(svgXml[, scale[, callback]]) | ||
- `svgXml` is an SVG XML string, as may be obtained from the `Viz` function using the `"svg"` format option. | ||
- `scale` sets the scale factor for the output. If this is not specified, `window.devicePixelRatio` will be used if available, and `1` if not. | ||
- `callback` is an optional Node-style callback. If specified, it is given two arguments, `(err, image)`. If not specified, `Viz.svgXmlToPngImageElement` returns an instance of HTMLImageElement. | ||
Converts `svgXml` to a PNG HTMLImageElement. If `callback` is specfied, `image` is loaded by the time the callback is invoked. | ||
### Viz.svgXmlToPngBase64(svgXml, scale, callback) | ||
- `svgXml` is an SVG XML string, as may be obtained from the `Viz` function using the `"svg"` format option. | ||
- `scale` sets the scale factor for the output. If this is given as `undefined`, `window.devicePixelRatio` will be used if available, and `1` if not. | ||
- `callback` is a Node-style callback. It is given two arguments, `(err, data)`. | ||
Converts `svgXml` to a PNG represented as a Base64 string. This function requires a callback, unlike `svgXmlToPngImageElement`. | ||
## Supported Graphviz features | ||
@@ -82,3 +100,3 @@ | ||
## Support Viz.js | ||
## Donate | ||
@@ -85,0 +103,0 @@ If you find Viz.js useful, please consider a donation. Thank you! |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102
2368156
9336