@dudes/lumly.uml.viewer
v0.0.9-build.1
Published
Drawing UML diagrams on canvas
Downloads
13
Readme
The project is based on GoJS.
Quick start
Install dependencies
yarn install
Start developing
npm run start
Build the project
Build distribution and minified distribution file ['dist/uml.js']
npm run build
Getting started
Preparation
Create an HTML element with an id attribute. Something like:
<div id="uml"></div>
Create an UML document
Next, use the UML() function to create an UML document within the wrapper element:
var uml = new UML('uml');
The first argument should be an id of the element. The second optional argument is options for fabric.Canvas.
Draw diagram
Pass JSON object to UML.draw() (Promise
function):
const json = JSON.stringify({
"title": "Some diagram",
"type": "usecase-diagram",
"definitions": {
"Actor01": {
"title": "John Doe",
"type": "actor"
}
}
});
uml.draw(json).then(
() => console.log('Diagram was successfully created!'),
(error) => alert(error)
);
Result:
If error: