prototyped svg reports
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package svg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
func ExampleSVG() {
|
||||
s := NewSVG().
|
||||
Attr(
|
||||
NewLength(10).
|
||||
AsX(),
|
||||
NewLength(20).
|
||||
AsY(),
|
||||
Style{
|
||||
"font-size": "8px",
|
||||
},
|
||||
).
|
||||
Child(
|
||||
Rect{
|
||||
Attributes: []RectAttribute{
|
||||
NewLength(30).
|
||||
AsX(),
|
||||
Percentage(40).
|
||||
AsY(),
|
||||
},
|
||||
},
|
||||
NewText("abc 123"),
|
||||
)
|
||||
|
||||
b, err := io.ReadAll(s.GetMarkupReader())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(string(b))
|
||||
// Output: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="10" y="20" style="font-size: 8px"><rect x="30" y="40%"/><text>abc 123</text></svg>
|
||||
}
|
||||
Reference in New Issue
Block a user