gregoryv/draw

View on GitHub
docs/index.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>

<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<style>@import url('https://fonts.googleapis.com/css2?family=Inconsolata&family=Source+Sans+Pro&family=Source+Serif+Pro:wght@600');
@import url('https://fonts.googleapis.com/css2?family=Inconsolata&family=Lancelot&family=Open+Sans');
html, body {
margin: 0 0;
padding: 0 0;
font-family: 'Source Sans Pro', sans-serif;
}
article {
margin: 1em 1.62em;
max-width: 21cm;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Source Serif Pro', serif;
}
h2 a, h3 a {
text-decoration: none;
color: black;
}
h2:hover a, h3:hover a {
text-decoration: underline;
}
.writtenby {
float: right;
}
.toc {
font-weight: bold;
}
p, li {
font-family: 'Open Sans', sans-serif;
}
p {
line-height: 1.5em;
}
nav>ul {
list-style-type: none;
line-height: 1.5em;
}
li.h3 {
margin-left: 1em;
list-style-type: none;
}
td {
vertical-align: top;
}
img.me {
float: left;
margin-right: 2em;
}
.srcfile {
padding: .6em 1.6em .6em 1.6em;
display: block;
margin-top: 1.6em;
margin-bottom: 1.6em;
background-color: #eaeaea;
}
code {
font-family: Inconsolata;
-moz-tab-size: 4;
}
.left {
float: left;
margin-right: 6em;
}
.right {
float: left;
}
</style>
</head>
<body>
<article>
<h1>Draw - programming software design diagrams</h1>
<p>This module provides an API to program software design
        diagrams using the Go programming language.</p>
<p>Drawing diagrams by hand, though very intuitive and easy to
        create are rarely maintained over time. If we want to keep
        them up to date with our code, we need another
        way.<br>Autogenerated diagrams from source code is one way to
        go about it. However then the problem becomes one of making it
        informative enough for the inteded audience, ie. it's more
        difficult to filter out unwanted elements or place them in a
        logical order depending on the discussion/purpose.<br> We can
        also resort to using text formats and process those into
        diagrams, eg. mscgen or graphviz. These are great tools which
        bring design diagrams closer to the source code and benefit
        from the same revision control as other code. The problem of
        maintaining diagrams however remains, refactoring code doesn't
        touch the diagrams.</p>
<p>This module uses the benefits of the text base diagram
        formats by using the Go programming language. Ie. not another
        format rather it provides an API for programming
        diagrams. Developers can refer to types directly from the
        modules they want to describe. Whatever information can be
        gathered from the source code is used, which allows the
        programmer to focus on creating a diagram visually suitable
        for their reader.</p>
<div class="left"><nav><h4>Table of contents</h4>
<ul>
<li class="h2"><a href="#install">Install</a></li>
<li class="h2"><a href="#apidocumentation">API documentation</a></li>
<li class="h2"><a href="#about">About</a></li>
<li class="h2"><a href="#quickstart">Quick start</a></li>
<li class="h2"><a href="#diagrams">Diagrams</a></li>
<li class="h3"><a href="#class">Class</a></li>
<li class="h3"><a href="#activity">Activity</a></li>
<li class="h3"><a href="#sequence">Sequence</a></li>
<li class="h3"><a href="#ganttchart">Gantt chart</a></li>
<li class="h3"><a href="#generic">Generic</a></li>
<li class="h2"><a href="#shapes">Shapes</a></li>
<li class="h2"><a href="#changelog">Changelog</a></li>
<li class="h2"><a href="#license">License</a></li>
</ul>
</nav>
</div>
<div class="right"><h2 id="install"><a href="#install">Install</a></h2>
<pre><code>    go get <a href="https://github.com/gregoryv/draw">github.com/gregoryv/draw/</a>...</code></pre><h2 id="apidocumentation"><a href="#apidocumentation">API documentation</a></h2>
<ul>
<li><a href="https://godoc.org/github.com/gregoryv/draw">draw</a></li>
<li><a href="https://godoc.org/github.com/gregoryv/draw/shape">draw/shape</a> - SVG shapes</li>
<li><a href="https://godoc.org/github.com/gregoryv/draw/design">draw/design</a> - software design diagrams</li>
</ul>
<h2 id="about"><a href="#about">About</a></h2>
<img src="me_circle.png" class="me"/><p>Written by <a href="https://github.com/gregoryv">Gregory Vin&ccaron;i&cacute;</a><br/><a href="#license">MIT License</a></p>
</div>
<br clear="all"/><h2 id="quickstart"><a href="#quickstart">Quick start</a></h2>
<p>Each diagram is a Go type specifically designed to provide
        an easy and intuitive way of "programming" diagrams. Elements
        are either fixed strings or taken from the source code by
        using concrete instances of real types. This allows for
        refactoring to also update diagrams within a package.<br/>Once you selected which elements to include, position them
        relative to each other in the diagram. Relative placement has
        the benefit of adaptive diagrams once you add more methods or
        fields to your structs. It works for most cases, eliminating
        manual updates.</p>
<svg
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  font-family="Arial,Helvetica,sans-serif" width="707" height="252">
<path stroke="black" d="M381,96 L328,126" />
<g transform="rotate(151 381 96)"><path stroke="black" fill="#ffffff" d="M381,96 l 6,-4 6,4 -6,4 -6,-4" /></g>
<g transform="rotate(241 328 126)"><path stroke="black" fill="#ffffff" d="M324,134 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M381,65 L311,65" />
<g transform="rotate(180 381 65)"><path stroke="black" fill="#777777" d="M381,65 l 6,-4 6,4 -6,4 -6,-4" /></g>
<g transform="rotate(270 311 65)"><path stroke="black" fill="#ffffff" d="M307,73 l4,-8 l 4,8 Z" /></g>

<path stroke="black" stroke-dasharray="5,5,5" d="M207,130 L129,91" />
<g transform="rotate(296 129 91)"><path stroke="black" fill="#ffffff" d="M125,99 l4,-8 l 4,8 Z" /></g>

<path stroke="black" stroke-dasharray="5,5,5" d="M207,65 L137,65" />
<g transform="rotate(270 137 65)"><path stroke="black" fill="#ffffff" d="M133,73 l4,-8 l 4,8 Z" /></g>

<rect stroke="#d3d3d3" fill="#ffffff" x="20" y="39" width="117" height="52"/>
<path stroke="#d3d3d3" d="M20,65 L137,65" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="81">Materials()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="55">docs.Part interface</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="207" y="28" width="104" height="74"/>
<path stroke="#d3d3d3" d="M207,54 L311,54" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="213" y="70">Material</text>
<path stroke="#d3d3d3" d="M207,76 L311,76" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="213" y="92">Materials()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="213" y="44">docs.Door struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="207" y="124" width="121" height="74"/>
<path stroke="#d3d3d3" d="M207,150 L328,150" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="213" y="166">Model</text>
<path stroke="#d3d3d3" d="M207,172 L328,172" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="213" y="188">Materials()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="213" y="140">docs.Window struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="381" y="20" width="113" height="90"/>
<path stroke="#d3d3d3" d="M381,46 L494,46" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="387" y="62">Frontdoor</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="387" y="78">Windows</text>
<path stroke="#d3d3d3" d="M381,84 L494,84" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="387" y="100">Rooms()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="387" y="36">docs.House struct</text>
<path stroke="#d3d3d3" fill="#ffffcc" d="M564,44 v 41 h 141 v -31 l -10,-10 L 564,44 M705,54 h -10 v -10"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="574" y="60">Relations are automa-</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="574" y="76">tically rendered</text>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="288" y="245">Small example diagram</text></svg><pre class="srcfile"><code class="go">package docs

import (
    "github.com/gregoryv/draw/design"
    "github.com/gregoryv/draw/shape"
)

func ExampleSmallClassDiagram() *design.ClassDiagram {
    var (
        d      = design.NewClassDiagram()
        house  = d.Struct(House{})
        door   = d.Struct(Door{})
        window = d.Struct(Window{})
        part   = d.Interface((*Part)(nil))
        note   = shape.NewNote(`Relations are automa-
tically rendered`)
    )
    d.Place(part).At(20, 20)        // absolute positioning
    d.Place(door).RightOf(part, 70) // optional extra spacing
    d.Place(window).Below(door)
    d.Place(house, note).RightOf(door, 70)

    d.HAlignCenter(house, door, part, note)
    d.SetCaption("Small example diagram")
    return d
}
</code></pre><p>Once a diagram is done, you can render the SVG in different ways</p>
<ul>
<li><code>SaveAs(filename)</code></li>
<li><code>Inline()</code> - returns SVG as string with all classes replaced with styling</li>
<li><code>WriteSVG(io.Writer)</code></li>
</ul>
<p>These pages for instance are generated using the <a href="https://github.com/gregoryv/web">github.com/gregoryv/web</a> package using the Inline()
        method and looks something like the below code</p>
<pre class="srcfile"><code class="go">package docs

import . "github.com/gregoryv/web"

func Example_RenderInlinedDiagram() {
    page := NewPage(
        Html(
            Body(
                H1("An example"),
                ExampleSmallClassDiagram().Inline(),
            ),
        ),
    )
    page.SaveAs("mypage.html")
}
</code></pre><p>Styling is currently provided by <code>draw.ClassAttributes</code> and can be changed to some
            degree. For now font size and family should not be changed
            as size of shapes will not adapt to the styling
            values. The idea is however that the default styling
            should be left alone.</p>
<p>There are more design diagram types available, take a look
        below.  If you are missing something that could benefit the
        community, please let me know.</p>
<h2 id="diagrams"><a href="#diagrams">Diagrams</a></h2>
<h3 id="class"><a href="#class">Class</a></h3>
<p>In class diagrams the author wants to convey design
           relations between various entities. However the relations
           and most of the element naming can be generated from the
           source code. The author should add what is needed for a
           clear picture, ie. selecting entities to show and position
           them in a perceptible manner.</p>
<svg
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  font-family="Arial,Helvetica,sans-serif" width="775" height="1030">
<path stroke="black" d="M280,269 L145,269" />
<g transform="rotate(180 280 269)"><path stroke="black" fill="#ffffff" d="M280,269 l 6,-4 6,4 -6,4 -6,-4" /></g>
<g transform="rotate(270 145 269)"><path stroke="black" fill="#ffffff" d="M141,277 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M574,392 L412,184" />
<g transform="rotate(232 574 392)"><path stroke="black" fill="#777777" d="M574,392 l 6,-4 6,4 -6,4 -6,-4" /></g>
<g transform="rotate(322 412 184)"><path stroke="black" fill="#ffffff" d="M408,192 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M522,551 L582,551" />
<g transform="rotate(0 522 551)"><path stroke="black" fill="#777777" d="M522,551 l 6,-4 6,4 -6,4 -6,-4" /></g>
<g transform="rotate(90 582 551)"><path stroke="black" fill="#ffffff" d="M578,559 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M387,551 L317,551" />
<g transform="rotate(180 387 551)"><path stroke="black" fill="#777777" d="M387,551 l 6,-4 6,4 -6,4 -6,-4" /></g>
<g transform="rotate(270 317 551)"><path stroke="black" fill="#ffffff" d="M313,559 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M454,854 L454,764" />
<g transform="rotate(-90 454 854)"><path stroke="black" fill="#ffffff" d="M454,854 l 6,-4 6,4 -6,4 -6,-4" /></g>
<g transform="rotate(0 454 764)"><path stroke="black" fill="#ffffff" d="M450,772 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M600,758 L522,647" />
<g transform="rotate(234 600 758)"><path stroke="black" fill="#ffffff" d="M600,758 l 6,-4 6,4 -6,4 -6,-4" /></g>
<g transform="rotate(324 522 647)"><path stroke="black" fill="#ffffff" d="M518,655 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M212,551 L133,551" />
<g transform="rotate(180 212 551)"><path stroke="black" fill="#777777" d="M212,551 l 6,-4 6,4 -6,4 -6,-4" /></g>
<g transform="rotate(270 133 551)"><path stroke="black" fill="#ffffff" d="M129,559 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M82,378 L82,498" />
<g transform="rotate(90 82 378)"><path stroke="black" fill="#777777" d="M82,378 l 6,-4 6,4 -6,4 -6,-4" /></g>
<g transform="rotate(180 82 498)"><path stroke="black" fill="#ffffff" d="M78,506 l4,-8 l 4,8 Z" /></g>

<path stroke="black" stroke-dasharray="5,5,5" d="M667,346 L419,155" />
<g transform="rotate(307 419 155)"><path stroke="black" fill="#ffffff" d="M415,163 l4,-8 l 4,8 Z" /></g>

<path stroke="black" stroke-dasharray="5,5,5" d="M641,274 L419,143" />
<g transform="rotate(300 419 143)"><path stroke="black" fill="#ffffff" d="M415,151 l4,-8 l 4,8 Z" /></g>

<path stroke="black" stroke-dasharray="5,5,5" d="M619,130 L419,109" />
<g transform="rotate(275 419 109)"><path stroke="black" fill="#ffffff" d="M415,117 l4,-8 l 4,8 Z" /></g>

<path stroke="black" stroke-dasharray="5,5,5" d="M145,229 L280,145" />
<g transform="rotate(59 280 145)"><path stroke="black" fill="#ffffff" d="M276,153 l4,-8 l 4,8 Z" /></g>

<rect stroke="#d3d3d3" fill="#ffffff" x="280" y="20" width="139" height="164"/>
<path stroke="#d3d3d3" d="M280,46 L419,46" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="286" y="62">Direction()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="286" y="78">Height()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="286" y="94">Position()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="286" y="110">SetClass()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="286" y="126">SetX()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="286" y="142">SetY()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="286" y="158">Width()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="286" y="174">WriteSVG()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="286" y="36">shape.Shape interface</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="20" y="160" width="125" height="218"/>
<path stroke="#d3d3d3" d="M20,186 L145,186" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="202">Title</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="218">Fields</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="234">Methods</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="250">Font</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="266">Pad</text>
<path stroke="#d3d3d3" d="M20,272 L145,272" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="288">Edge()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="304">HideFields()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="320">HideMethod()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="336">HideMethods()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="352">SetFont()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="368">SetTextPad()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="176">shape.Record struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="619" y="20" width="117" height="234"/>
<path stroke="#d3d3d3" d="M619,46 L736,46" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="62">Point</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="78">Radius</text>
<path stroke="#d3d3d3" d="M619,84 L736,84" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="100">Above()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="116">Below()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="132">Distance()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="148">Edge()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="164">Equals()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="180">LeftOf()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="196">RightOf()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="212">String()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="228">XY()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="244">XYfloat64()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="36">shape.Circle struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="619" y="274" width="135" height="52"/>
<path stroke="#d3d3d3" d="M619,300 L754,300" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="316">Edge()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="290">shape.Diamond struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="619" y="346" width="130" height="26"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="625" y="362">shape.Triangle struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="569" y="392" width="130" height="154"/>
<path stroke="#d3d3d3" d="M569,418 L699,418" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="575" y="434">Spacing</text>
<path stroke="#d3d3d3" d="M569,440 L699,440" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="575" y="456">Above()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="575" y="472">At()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="575" y="488">Below()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="575" y="504">LeftOf()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="575" y="520">Move()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="575" y="536">RightOf()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="575" y="408">shape.Adjuster struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="31" y="498" width="102" height="106"/>
<path stroke="#d3d3d3" d="M31,524 L133,524" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="37" y="540">Height</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="37" y="556">LineHeight</text>
<path stroke="#d3d3d3" d="M31,562 L133,562" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="37" y="578">SetScale()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="37" y="594">TextWidth()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="37" y="514">draw.Font struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="212" y="482" width="105" height="138"/>
<path stroke="#d3d3d3" d="M212,508 L317,508" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="218" y="524">Font</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="218" y="540">TextPad</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="218" y="556">Pad</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="218" y="572">Spacing</text>
<path stroke="#d3d3d3" d="M212,578 L317,578" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="218" y="594">SetOutput()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="218" y="610">Write()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="218" y="498">draw.Style struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="280" y="256" width="134" height="26"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="286" y="272">design.Relation struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="387" y="338" width="135" height="426"/>
<path stroke="#d3d3d3" d="M387,364 L522,364" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="380">SVG</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="396">Aligner</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="412">Style</text>
<path stroke="#d3d3d3" d="M387,418 L522,418" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="434">AdaptSize()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="450">Append()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="466">Caption()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="482">Height()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="498">Inline()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="514">Link()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="530">LinkAll()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="546">Note()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="562">Place()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="578">PlaceGrid()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="594">Prepend()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="610">SaveAs()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="626">SetCaption()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="642">SetHeight()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="658">SetScale()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="674">SetSize()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="690">SetWidth()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="706">String()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="722">TextWidth()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="738">Width()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="754">WriteSVG()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="393" y="354">design.Diagram struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="582" y="485" width="124" height="132"/>
<path stroke="#d3d3d3" d="M582,511 L706,511" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="527">HAlignBottom()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="543">HAlignCenter()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="559">HAlignTop()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="575">VAlignCenter()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="591">VAlignLeft()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="607">VAlignRight()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="501">shape.Aligner struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="582" y="758" width="191" height="218"/>
<path stroke="#d3d3d3" d="M582,784 L773,784" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="800">Diagram</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="816">ColWidth</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="832">VMargin</text>
<path stroke="#d3d3d3" d="M582,838 L773,838" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="854">Add()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="870">AddColumns()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="886">AddInterface()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="902">AddStruct()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="918">ClearLinks()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="934">Group()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="950">Return()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="966">Skip()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="588" y="774">design.SequenceDiagram struct</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="372" y="854" width="166" height="122"/>
<path stroke="#d3d3d3" d="M372,880 L538,880" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="378" y="896">Diagram</text>
<path stroke="#d3d3d3" d="M372,902 L538,902" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="378" y="918">HideRealizations()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="378" y="934">Interface()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="378" y="950">Slice()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="378" y="966">Struct()</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="378" y="870">design.ClassDiagram struct</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="217" y="1023">Figure 1. Class diagram of design and design.shape packages</text></svg><br/>Source: <a href="class_example.go">class_example.go</a><p>Records describe each entity using package name and
           type. Methods and fields are shown only by name if
           visible. Details such as arguments and return values are
           left to the API documentation. Relations are automatically
           rendererd between entities if there is one.</p>
<h3 id="activity"><a href="#activity">Activity</a></h3>
<p>Activity diagrams start in one position and show states and
        activities transitioning from one stated to another ending in
        one or more exits.</p>
<svg
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  font-family="Arial,Helvetica,sans-serif" width="203" height="465">
<circle stroke="black" cx="86" cy="26" r="6" />\n
<rect stroke="#d3d3d3" fill="#ffffff" rx="10" ry="10" x="50" y="92" width="72" height="26"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="56" y="110">Commited</text>
<path stroke="black" d="M86,32 L86,92" />
<g transform="rotate(180 86 92)"><path stroke="black" fill="#ffffff" d="M82,100 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="99" y="62">push</text>
<rect stroke="#d3d3d3" fill="#ffffff" rx="10" ry="10" x="38" y="178" width="97" height="26"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="44" y="196">Build complete</text>
<path stroke="black" d="M86,118 L86,178" />
<g transform="rotate(180 86 178)"><path stroke="black" fill="#ffffff" d="M82,186 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="99" y="148">run git hook</text>
<path stroke="#d3d3d3" fill="#ffffff" d="M76,284 l 10,-10 10,10 -10,10 -10,-10" />
<path stroke="black" d="M86,204 L86,274" />
<g transform="rotate(180 86 274)"><path stroke="black" fill="#ffffff" d="M82,282 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="99" y="239">run tests</text>
<rect stroke="#d3d3d3" fill="#ffffff" rx="10" ry="10" x="57" y="354" width="58" height="26"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="63" y="372">Verified</text>
<path stroke="black" d="M86,294 L86,354" />
<g transform="rotate(180 86 354)"><path stroke="black" fill="#ffffff" d="M82,362 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="99" y="324">ok</text>
<circle stroke="black" stroke-width="2" fill="#ffffff" cx="86" cy="452" r="10" />\n<circle stroke="black" cx="86" cy="452" r="6" />\n
<path stroke="black" d="M86,380 L86,440" />
<g transform="rotate(180 86 440)"><path stroke="black" fill="#ffffff" d="M82,448 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="99" y="410"></text>
<circle stroke="black" stroke-width="2" fill="#ffffff" cx="190" cy="284" r="10" />\n<circle stroke="black" cx="190" cy="284" r="6" />\n
<path stroke="black" d="M96,284 L178,284" />
<g transform="rotate(90 178 284)"><path stroke="black" fill="#ffffff" d="M174,292 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="122" y="272">fails</text></svg><pre class="srcfile"><code class="go">package docs

import (
    "github.com/gregoryv/draw/design"
)

func ExampleActivityDiagram() *design.ActivityDiagram {
    d := design.NewActivityDiagram()

    d.Start().At(80, 20)
    d.Trans("push", "Commited")
    d.Trans("run git hook", "Build complete")

    test := d.Decide("run tests")
    d.Trans("ok", "Verified")
    d.Trans("", "EXIT")

    d.Or(test)
    d.TransRight("fails", "EXIT")
    return d
}
</code></pre><h3 id="sequence"><a href="#sequence">Sequence</a></h3>
<p>Sequence diagrams are ment to describe a sequence of
        events, specifically calling methods or remote API calls. I've
        tried to emphasize the horizontal arrows over vertical lines
        and keep visual effects to a minimum. For now there is only
        one arrow variation. I found that embedding information by the
        subtle head variations and arrow line styling is hard to
        read.</p>
<svg
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  font-family="Arial,Helvetica,sans-serif" width="634" height="298">
<rect stroke="black" stroke-width="0" fill="#ff9999" fill-opacity="0.1" x="228" y="24" width="380" height="273"/>
<text class="area-red-title" font-size="12px" x="234" y="42"></text>
<path stroke="#d3d3d3" d="M38,24 L38,255" />

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="10" y="18">app.Client</text>
<path stroke="#d3d3d3" d="M228,24 L228,255" />

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="198" y="18">app.Server</text>
<path stroke="#d3d3d3" d="M418,24 L418,255" />

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="400" y="18">sql.DB</text>
<path stroke="#d3d3d3" d="M608,24 L608,255" />

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="583" y="18">aws.SQS</text>
<text font-style="italic" font-family="Arial,Helvetica,sans-serif" font-size="12px" x="328" y="290">Private RPC using Gob encoding</text>
<path stroke="black" d="M38,57 L228,57" />
<g transform="rotate(90 228 57)"><path stroke="black" fill="#ffffff" d="M224,65 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="107" y="54">connect()</text>
<path stroke="red" d="M228,90 L418,90" />
<g transform="rotate(90 418 90)"><path stroke="red" fill="#ffffff" d="M414,98 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="299" y="87">SELECT</text>
<path stroke="black" d="M418,123 L228,123" />
<g transform="rotate(270 228 123)"><path stroke="black" fill="#ffffff" d="M224,131 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="307" y="120">Rows</text>
<path stroke="red" d="M228,156 L243,156" />

<path stroke="red" d="M243,156 L243,188" />

<path stroke="red" d="M243,188 L228,188" />
<g transform="rotate(270 228 188)"><path stroke="red" fill="#ffffff" d="M224,196 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="249" y="175">Transform to view model</text>
<path stroke="black" d="M228,211 L38,211" />
<g transform="rotate(270 38 211)"><path stroke="black" fill="#ffffff" d="M34,219 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="100" y="208">Send HTML</text>
<path stroke="black" d="M228,244 L608,244" />
<g transform="rotate(90 608 244)"><path stroke="black" fill="#ffffff" d="M604,252 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="381" y="241">Publish event</text></svg><pre class="srcfile"><code class="go">package docs

import (
    "database/sql"

    "github.com/gregoryv/draw/design"
    "github.com/gregoryv/draw/internal/app"
)

func ExampleSequenceDiagram() *design.SequenceDiagram {
    var (
        d   = design.NewSequenceDiagram()
        cli = d.AddStruct(app.Client{})
        srv = d.AddStruct(app.Server{})
        db  = d.AddStruct(sql.DB{})
        sqs = d.Add("aws.SQS")
    )
    d.Group(srv, sqs, "Private RPC using Gob encoding", "red")
    d.Link(cli, srv, "connect()")
    d.Link(srv, db, "SELECT").Class = "highlight"
    d.Link(db, srv, "Rows")
    d.Link(srv, srv, "Transform to view model").Class = "highlight"
    d.Link(srv, cli, "Send HTML")
    d.Link(srv, sqs, "Publish event")
    return d
}
</code></pre><h3 id="ganttchart"><a href="#ganttchart">Gantt chart</a></h3>
<svg
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  font-family="Arial,Helvetica,sans-serif" width="528" height="166">
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="16" y="26">2019</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="80" y="46">11</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="95" y="46">12</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="110" y="46">13</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="125" y="46">14</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="140" y="46">15</text>
<rect font-family="Arial,Helvetica,sans-serif" fill="#f3f3f3" x="153" y="34" width="30" height="78"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="159" y="52"></text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="155" y="46">16</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="170" y="46">17</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="185" y="46">18</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="200" y="46">19</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="215" y="46">20</text>
<path stroke="black" d="M215,30 L225,30" />

<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="230" y="46">21</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="245" y="46">22</text>
<rect font-family="Arial,Helvetica,sans-serif" fill="#f3f3f3" x="258" y="34" width="30" height="78"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="264" y="52"></text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="260" y="46">23</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="275" y="46">24</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="290" y="46">25</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="305" y="46">26</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="320" y="46">27</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="335" y="46">28</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="350" y="46">29</text>
<rect font-family="Arial,Helvetica,sans-serif" fill="#f3f3f3" x="363" y="34" width="30" height="78"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="369" y="52"></text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="365" y="46">30</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="380" y="46">01</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="380" y="26">December</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="395" y="46">02</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="410" y="46">03</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="425" y="46">04</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="440" y="46">05</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="455" y="46">06</text>
<rect font-family="Arial,Helvetica,sans-serif" fill="#f3f3f3" x="468" y="34" width="30" height="78"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="474" y="52"></text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="470" y="46">07</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="485" y="46">08</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="500" y="46">09</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="10px" x="515" y="46">10</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="16" y="69">Develop</text>
<rect stroke="#d3d3d3" fill="#ccff99" rx="5" ry="5" x="80" y="58" width="146" height="12"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="86" y="76"></text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="16" y="85">Release</text>
<rect stroke="#d3d3d3" fill="#ff9999" rx="5" ry="5" x="230" y="74" width="11" height="12"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="236" y="92"></text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="16" y="101">Vacation</text>
<rect stroke="#d3d3d3" fill="#99e6ff" rx="5" ry="5" x="290" y="90" width="206" height="12"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="296" y="108"></text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="168" y="159">Figure 1. Project estimated delivery</text></svg><h3 id="generic"><a href="#generic">Generic</a></h3>
<svg
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  font-family="Arial,Helvetica,sans-serif" width="253" height="374">
<rect stroke="#d3d3d3" fill="#ffffff" x="10" y="30" width="56" height="26"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="16" y="46">Record</text>
<path stroke="black" d="M130,80 L180,70" />
<g transform="rotate(79 180 70)"><path stroke="black" fill="#ffffff" d="M176,78 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M130,80 L100,70" />
<g transform="rotate(288 100 70)"><path stroke="black" fill="#ffffff" d="M96,78 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M130,80 L80,100" />
<g transform="rotate(249 80 100)"><path stroke="black" fill="#ffffff" d="M76,108 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M130,80 L170,100" />
<g transform="rotate(116 170 100)"><path stroke="black" fill="#ffffff" d="M166,108 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M130,80 L220,80" />
<g transform="rotate(90 220 80)"><path stroke="black" fill="#ffffff" d="M216,88 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M130,80 L80,80" />
<g transform="rotate(270 80 80)"><path stroke="black" fill="#ffffff" d="M76,88 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M130,80 L130,40" />
<g transform="rotate(0 130 40)"><path stroke="black" fill="#ffffff" d="M126,48 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M130,80 L130,120" />
<g transform="rotate(180 130 120)"><path stroke="black" fill="#ffffff" d="M126,128 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="216" y="46">Label</text>
<path stroke="black" d="M20,150 L150,150" />
<g transform="rotate(0 20 150)"><circle stroke="black" fill="#777777" cx="23" cy="150" r="3" />\n</g>
<g transform="rotate(90 150 150)"><path stroke="black" fill="#ffffff" d="M146,158 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M20,188 L150,188" />
<g transform="rotate(0 20 188)"><path stroke="black" fill="#777777" d="M20,188 l 6,-4 6,4 -6,4 -6,-4" /></g>
<g transform="rotate(90 150 188)"><path stroke="black" fill="#ffffff" d="M146,196 l4,-8 l 4,8 Z" /></g>

<path stroke="#d3d3d3" fill="#ffffcc" d="M20,226 v 41 h 96 v -31 l -10,-10 L 20,226 M116,236 h -10 v -10"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="30" y="242">Notes support</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="30" y="258">multilines</text>

<circle stroke="#d3d3d3" stroke-width="2" fill="#ffffff" cx="30" cy="307" r="10" />\n
<circle stroke="black" cx="76" cy="307" r="6" />\n
<circle stroke="black" stroke-width="2" fill="#ffffff" cx="124" cy="307" r="10" />\n<circle stroke="black" cx="124" cy="307" r="6" />\n
<path stroke="black" d="M40,307 L70,307" />
<g transform="rotate(90 70 307)"><path stroke="black" fill="#ffffff" d="M66,315 l4,-8 l 4,8 Z" /></g>

<path stroke="black" d="M82,307 L112,307" />
<g transform="rotate(90 112 307)"><path stroke="black" fill="#ffffff" d="M108,315 l4,-8 l 4,8 Z" /></g>

<rect stroke="#d3d3d3" fill="#ffffff" x="180" y="188" width="72" height="26"/>
<rect stroke="#d3d3d3" fill="#ffffff" x="175" y="193" width="10" height="5"/><rect stroke="#d3d3d3" fill="#ffffff" x="175" y="204" width="10" height="5"/><text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="191" y="206">database</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="20" y="347" width="41" height="26"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="26" y="365">Rect</text>
<rect stroke="#d3d3d3" fill="#ffffff" rx="10" ry="10" x="91" y="347" width="132" height="26"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="97" y="365">Waiting for go routine</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="186" y="244" width="60" height="26"/>
<rect stroke="#d3d3d3" fill="#ffffff" x="181" y="249" width="10" height="5"/><rect stroke="#d3d3d3" fill="#ffffff" x="181" y="260" width="10" height="5"/><text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="197" y="262">service</text>
<path stroke="black" d="M216,244 L216,214" />
<g transform="rotate(0 216 214)"><path stroke="black" fill="#ffffff" d="M212,222 l4,-8 l 4,8 Z" /></g>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="230" y="237"></text></svg><h2 id="shapes"><a href="#shapes">Shapes</a></h2>
<svg
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  font-family="Arial,Helvetica,sans-serif" width="209" height="1253">
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="36">Actor</text>
<circle stroke="black" stroke-width="2" fill="#ffffff" cx="158" cy="25" r="5" />
<path stroke="black" stroke-width="2" fill="#ffffff" d="M158,30 l 0,15 m -10,-10 l 20,0 m -10,10 l -10,10 m 10,-10 l 10,10 Z" />

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="112">Arrow</text>
<path stroke="black" d="M128,104 L188,104" />

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="188">Circle</text>
<circle stroke="#d3d3d3" stroke-width="2" fill="#ffffff" cx="158" cy="180" r="20" />\n
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="264">Component</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="116" y="243" width="85" height="26"/>
<rect stroke="#d3d3d3" fill="#ffffff" x="111" y="248" width="10" height="5"/><rect stroke="#d3d3d3" fill="#ffffff" x="111" y="259" width="10" height="5"/><text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="127" y="261">Component</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="340">Cylinder</text>
<path stroke="#d3d3d3" stroke-width="1" fill="#ffffff" d="M 127 318 L 127 340 C 127 352, 187 352, 187 340 L 187 318" />
<ellipse stroke="#d3d3d3" stroke-width="1" fill="#ffffff" cx="157" cy="318" rx="30" ry="6" />

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="416">Database</text>
<path stroke="#d3d3d3" stroke-width="1" fill="#ffffff" d="M 124 393 L 124 417 C 124 429, 190 429, 190 417 L 190 393" />
<ellipse stroke="#d3d3d3" stroke-width="1" fill="#ffffff" cx="157" cy="393" rx="33" ry="6" />
<text class="database-title" font-size="12px" x="130" y="413">database</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="492">Diamond</text>
<path stroke="#d3d3d3" fill="#333333" d="M152,484 l 6,-4 6,4 -6,4 -6,-4" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="568">Dot</text>
<circle stroke="black" cx="158" cy="560" r="6" />\n
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="644">ExitDot</text>
<circle stroke="black" stroke-width="2" fill="#ffffff" cx="158" cy="636" r="10" />\n<circle stroke="black" cx="158" cy="636" r="6" />\n
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="720">Internet</text>
<circle stroke="#d3d3d3" fill="#e2e2e2" cx="158" cy="712" r="40" />\n
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="137" y="718">Internet</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="796">Label</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="133" y="796">label-text</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="872">Line</text>
<path stroke="black" d="M128,864 L188,864" />

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="948">Note</text>
<path stroke="#d3d3d3" fill="#ffffcc" d="M109,920 v 41 h 99 v -31 l -10,-10 L 109,920 M208,930 h -10 v -10"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="119" y="936">This describes</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="119" y="952">something...</text>

<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="1024">Record</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="127" y="979" width="63" height="74"/>
<path stroke="#d3d3d3" d="M127,1005 L190,1005" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="133" y="1021">fields</text>
<path stroke="#d3d3d3" d="M127,1027 L190,1027" />
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="133" y="1043">methods</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="133" y="995">record</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="1100">Rect</text>
<rect stroke="#d3d3d3" fill="#ffffff" x="120" y="1079" width="77" height="26"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="126" y="1097">a rectangle</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="1176">State</text>
<rect stroke="#d3d3d3" fill="#ffffff" rx="10" ry="10" x="134" y="1155" width="48" height="26"/>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="140" y="1173">active</text>
<text font-family="Arial,Helvetica,sans-serif" font-size="12px" x="20" y="1252">Triangle</text>
<path stroke="black" d="M154,1248 l4,-8 l 4,8 Z" /></svg><h2 id="changelog"><a href="#changelog">Changelog</a></h2>
<pre class="srcfile"><code class="go">## [0.32.0] 2023-10-08

- Enable scaling of diagrams and shapes, e.g. Diagram.SetScale(1.5)
- Shapes no longer implement fmt.Stringer
- Hide field Note.Text

## [0.31.0] 2023-10-08

- Hide field Label.Text
- Remove aliased types and defaults in package shape
- Hide field Diagram.Caption

## [0.30.0] 2023-08-02

- Add shape.Labeled to simplify labeling any shape
- Group.WriteSVG writes all grouped shapes

## [0.29.0] 2023-08-02

- Add draw.DefaultFontFamily used in default classes
- Add shape.Hidden for hiding shapes
- Add shape.Anchor for linking shapes

## [0.28.0] 2023-08-25

- Add shape.Group and shape.Container
- shape.Card default width is 310px
- shape.Card takes optional note and text

## [0.27.0] 2023-08-20

- Add package draw/goviz for generating frame sequence diagrams

## [0.26.1] 2023-02-20

- Update dependencies

## [0.26.0] 2022-12-28

- Improve default link label positions
- Add shap.Card
- Consider a slice struct field of any type to be an
  aggregate. Ie. before []*Something was considered an aggregate
  whereas []Something was not. Now both are considered aggregates.
- Hide X, Y fields of shapes, use SetX, SetY and Position

## [0.25.0] 2022-04-21

- Draw relations of embedded interface fields

## [0.24.0] 2021-12-05

- Add Diagram.Note helper method
- Label shape supports linebreaks
- Add shapes Process, Store

## [0.23.0] 2021-09-04

- NewStyle does not take writer, defaults to ioutil.Discard.
  Use Style.SetOutput
- Add SequenceDiagram.Return method for drawing dashed arrows

## [0.22.1] 2021-06-14

- Fix arrows in sequence diagram, bug introduced in v0.22.0

## [0.22.0] 2021-06-10

- Update dependencies
- Remove func draw.Inline(), moved to design as private
- Remove type Arrow, use Line

## [0.21.2] 2021-04-21
## [0.21.1] 2021-04-21
## [0.21.0] 2021-04-21

- Line and arrow Height and Width methods consider head and tail shapes
- Diamond.Position returns top left
- Triangle points upwards and Position returns top left
- Replace ActivityDiagram.If with Or when switching decision
- Replace ActivityDiagram.Then with Trans and add TransRight methods
- Activity diagram default spacing increased from 40 to 60

## [0.20.0] 2021-04-16

- Add Label.SetHref and Component.SetHref
- Rename type xy.Position to xy.Point
- Show relations between slices and structs in ClassDiagram
- Add SequenceDiagram.Skip method for adding a dashed spacing
- Replace draw.TagWriter with nexus.Printer

## [0.19.0] 2021-04-05

- Add labeled hexagon shape
- Fix label alignment
- Adjuster respects diagram style.Spacing
- NewDiagram returns a pointer to diagram
- Diagram variations embed reference to diagram

## [0.18.0] 2021-01-23

- Include slice methods in VRecord
- Remove double padding for record titles
- Improve label alignment in Diagram.Link method

## [0.17.0] 2020-12-16

- Fix Class diagram to show pointer receiver methods
- Add SequenceDiagram.Group method for grouping columns with a labeled text area

## [0.16.0] 2020-10-30

- Diagrams Stringer implementations no longer inline css, use Inline method
- Add VRecord.Slice method for slice composition and aggregates

## [0.15.1] 2020-10-27

- Fix missing relations in inlined class diagrams

## [0.15.0] 2020-10-27

- Diagrams implement stringer interface
- AdaptSize makes width and height +1 pixel
- Add Inline method to diagrams
- Add type ClassAttributes with CSS method for easy inlining in HTML

## [0.14.0] 2020-10-06

- Fix VRecord to show pointer methods if pointer to struct given

## [0.13.0] 2020-09-12

- Add shape.Internet
- Add default spacing to shape.Adjuster
- Move type shape.Style to package draw
- Rename NewSvg to NewSVG

## [0.12.0] 2020-09-09
### Changed

- Moved draw/shape/design package to draw/design
- Renamed type Svg to SVG
- Renamed type SvgWriter to SVGWriter
- Renamed WriteSvg to WriteSVG

## [0.11.0] 2020-03-17
### Changed

- Generic design.NewVRecord for both structs and interfaces

### Removed

- Specific methods for creating struct and interface methods.

## [0.10.0] 2020-02-03
### Added

- Ganttchart weekly view
- Cylinder and database shapes
- Func shape.SetClass for setting class of many shapes

### Fixed

- Component and rect labels use class + "-title"

## [0.9.0] 2020-01-02
### Added

- ActivityDiagram helper methods, e.g Start, Then, If and Exit
- Mark current day by default in gantt chart

### Changed

- Renamed Direction constants LR and RL to RightDir and LeftDir
- NewGanttChart constructor uses date.String
- Exposed TagWriter
- shape.Svg moved to draw.Svg

### Fixed

- Label positioned correctly in activity diagram for vertical arrows

## [0.8.0] 2019-12-18
### Added

- Aggregate relation when pointer to specific type is used
- Gantt chart
- Actor shape

### Changed

- Label is optional when creating links with func Link
- Hide Height, Width attributes in Diagram
- shape.NewDot defaults to radius 10

## [0.7.0] - 2019-12-15
### Changed

- Namespace from gregoryv/go-design to gregoryv/draw. Fix your imports
  import "github.com/gregoryv/draw/shape/design"

## [0.6.0] - 2019-12-15
### Added

- Activity diagram examples
- Labeled links in plain diagrams
- State shape
- PlaceGrid to quickly place many shapes into a grid layout

## [0.5.0] - 2019-12-13
### Added

- Link method to generic diagram
- Rect, Dot, ExitDot and Component shapes

### Changed

- Label and circle has an edge
- Circle shape is stroked by default

## [0.4.0] - 2019-12-04
### Fixed

- Caption in sequence diagrams

### Changed

- Default color of records is white with pale lines


## [0.3.0] - 2019-10-12
### Fixed

- Arrows point to edge irrelevant of angle

### Added

- Diagrams have optional bottom centered caption
- Class diagram shows composition using diamond for tail
- Note shape with multiline support

### Changed

- Font size decoupled from class attributes
- Arrow for realizing interface is dashed
- Label and circle position is top left corner
- Hide methods realized by visible interfaces and structs


## [0.2.0] - 2019-10-03
### Changed

- All shapes can have a class
- Arrows in class diagrams attach to edge and point to center

### Fixed

- RightOf and LeftOf adjustments sets matching y position
- Use class for non self arrows

### Removed

- SvgWriterShape interface


## [0.1.0] - 2019-09-21
### Added

- Sequence diagram
- Class diagram
- Record shape with fields and methods
- Arrow, line and label shapes
</code></pre><h2 id="license"><a href="#license">License</a></h2>
<pre class="srcfile complete"><code class="go">MIT License

Copyright (c) 2019 Gregory Vinčić

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</code></pre></article>
</body>
</html>