-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbulletgraph_test.go
73 lines (71 loc) · 2.46 KB
/
bulletgraph_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package bulletgraph
import (
//"fmt"
"github.com/ajstarks/svgo"
"os"
//"testing"
)
func ExampleBulletGraph() {
canvas := svg.New(os.Stdout)
canvas.Start(1024, 800)
canvas.Rect(0, 0, 1024, 800, "fill:white")
canvas.Gstyle("font-family:Calibri;font-size:18px")
bg := New(canvas)
bg.Data = append(bg.Data, Bdata{Title: "Test", Subtitle: "subtitle", Scale: "0,60,2", Qmeasure: "27,29", Cmeasure: 27.5, Measure: 28.5})
bg.Drawbg(canvas)
canvas.Gend()
canvas.End()
// Output:
//<?xml version="1.0"?>
//<!-- Generated by SVGo -->
//<svg width="1024" height="800"
// xmlns="http://www.w3.org/2000/svg"
// xmlns:xlink="http://www.w3.org/1999/xlink">
//<rect x="0" y="0" width="1024" height="800" style="fill:white"/>
//<g style="font-family:Calibri;font-size:18px">
//<title></title>
//<text x="232" y="66" style="text-anchor:end;font-weight:bold">Test (28.5)</text>
//<text x="232" y="84" style="text-anchor:end;font-size:75%">subtitle</text>
//<g style="text-anchor:middle;font-size:75%">
//<text x="250" y="111" >0</text>
//<text x="274" y="111" >2</text>
//<text x="298" y="111" >4</text>
//<text x="322" y="111" >6</text>
//<text x="346" y="111" >8</text>
//<text x="370" y="111" >10</text>
//<text x="394" y="111" >12</text>
//<text x="418" y="111" >14</text>
//<text x="443" y="111" >16</text>
//<text x="467" y="111" >18</text>
//<text x="491" y="111" >20</text>
//<text x="515" y="111" >22</text>
//<text x="539" y="111" >24</text>
//<text x="563" y="111" >26</text>
//<text x="587" y="111" >28</text>
//<text x="612" y="111" >30</text>
//<text x="636" y="111" >32</text>
//<text x="660" y="111" >34</text>
//<text x="684" y="111" >36</text>
//<text x="708" y="111" >38</text>
//<text x="732" y="111" >40</text>
//<text x="756" y="111" >42</text>
//<text x="780" y="111" >44</text>
//<text x="805" y="111" >46</text>
//<text x="829" y="111" >48</text>
//<text x="853" y="111" >50</text>
//<text x="877" y="111" >52</text>
//<text x="901" y="111" >54</text>
//<text x="925" y="111" >56</text>
//<text x="949" y="111" >58</text>
//<text x="974" y="111" >60</text>
//</g>
//<g style="fill-opacity:0.5;fill:rgb(200,200,200)">
//<rect x="250" y="50" width="724" height="48" />
//<rect x="250" y="50" width="325" height="48" />
//<rect x="250" y="50" width="349" height="48" />
//</g>
//<rect x="250" y="66" width="343" height="16" style="fill:darkgray"/>
//<line x1="581" y1="62" x2="581" y2="86" style="stroke-width:3;stroke:black"/>
//</g>
//</svg>
}