Movatterモバイル変換


[0]ホーム

URL:


js-sequence-diagrams

Turns text into UML sequence diagrams

Fork me on GitHub

Demo. Try editing me below

Andrew->China: Says HelloNote right of China: China thinks\nabout itChina-->Andrew: How are you?Andrew->>China: I am good thanks!
Theme: |Download as SVG
This should be a diagram! If you don't see it you need Javascript enabled

Intro

A simple javascript library to turn text into vectorUML sequence diagrams. Heavily inspired bywebsequencediagrams.com, who offer a serverside solution. We useJison to parse the text, andSnap.svg to draw the image.

Examples

Title: Here is a titleA->B: Normal lineB-->C: Dashed lineC->>D: Open arrowD-->>A: Dashed open arrow
Theme: |Download as SVG
# Example of a comment.Note left of A: Note to the\n left of ANote right of A: Note to the\n right of ANote over A: Note over ANote over A,B: Note over both A and B
Theme: |Download as SVG
participant Cparticipant Bparticipant ANote right of A: By listing the participants\n you can change their order
Theme: |Download as SVG

Syntax

The following diagram shows the syntax for the diagrams. The exact grammar can befound here in bison format.

generated byRailroad Diagram GeneratorRR

Usage

js-sequence-diagrams depends onSnap.svg andUnderscore.js (orlodash). You can download all these files manually, or use "bower install bramp/js-sequence-diagrams".

Then include the following HTML:

<script src="webfont.js"></script><script src="snap.svg-min.js"></script><script src="underscore-min.js"></script><script src="sequence-diagram-min.js"></script>
and now you have two options. You can manually parse the text:
<div id="diagram"></div><script>  var diagram = Diagram.parse("A->B: Message");  diagram.drawSVG("diagram", {theme: 'hand'});</script>
or use jQuery to do all the work:
<div class="diagram">A->B: Message</div><script>$(".diagram").sequenceDiagram({theme: 'hand'});</script>

More documentation is in the officialREADME.md


[8]ページ先頭

©2009-2025 Movatter.jp