feat: support radar chart

This commit is contained in:
vicanso 2022-03-02 23:20:41 +08:00
parent 6209a9ce63
commit 570828d35f
9 changed files with 337 additions and 35 deletions

13
draw.go
View file

@ -309,3 +309,16 @@ func (d *Draw) setBackground(width, height int, color drawing.Color) {
r.LineTo(0, 0)
r.FillStroke()
}
func (d *Draw) polygon(center Point, radius float64, sides int) {
points := getPolygonPoints(center, radius, sides)
for i, p := range points {
if i == 0 {
d.moveTo(p.X, p.Y)
} else {
d.lineTo(p.X, p.Y)
}
}
d.lineTo(points[0].X, points[0].Y)
d.Render.Stroke()
}