File tree Expand file tree Collapse file tree 4 files changed +9
-5
lines changed Expand file tree Collapse file tree 4 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -36,3 +36,5 @@ and you won't find some functionalities yet such as
3636 d.Render()
3737
3838```
39+ Result PNG file:
40+ ![ image description] ( ./examples/user_starts_chatting.png )
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package main
33import "go-uml/sequence"
44
55func main () {
6- d := sequence .NewDiagram ()
6+ d := sequence .NewDiagram ("user_starts_chatting" )
77
88 client := "Client"
99 backend := "Backend"
Original file line number Diff line number Diff line change @@ -27,15 +27,17 @@ type Diagram struct {
2727 renderedParticipants []* participant
2828 participantsCoordMap map [string ]participantCoord
2929
30- dc * gg.Context
31- title string
30+ dc * gg.Context
31+ title string
32+ filename string
3233}
3334
34- func NewDiagram () * Diagram {
35+ func NewDiagram (filename string ) * Diagram {
3536 coordMap := make (map [string ]participantCoord )
3637
3738 return & Diagram {
3839 participantsCoordMap : coordMap ,
40+ filename : filename ,
3941 }
4042}
4143
@@ -49,7 +51,7 @@ func (d *Diagram) Render() {
4951 d .renderParticipants ()
5052 d .renderEdges ()
5153
52- d .dc .SavePNG ("out .png" )
54+ d .dc .SavePNG (fmt . Sprintf ( "%s .png", d . filename ) )
5355}
5456
5557func (d * Diagram ) renderTitle () {
You can’t perform that action at this time.
0 commit comments