go-chart/examples/donut_chart/main.go

29 lines
473 B
Go
Raw Permalink Normal View History

2019-09-10 00:02:48 -04:00
package main
//go:generate go run main.go
import (
"os"
2024-10-27 22:52:38 -04:00
"git.smarteching.com/zeni/go-chart/v2"
2019-09-10 00:02:48 -04:00
)
func main() {
pie := chart.DonutChart{
Width: 512,
Height: 512,
Values: []chart.Value{
{Value: 5, Label: "Blue"},
{Value: 5, Label: "Green"},
{Value: 4, Label: "Gray"},
{Value: 4, Label: "Orange"},
{Value: 3, Label: "Deep Blue"},
{Value: 3, Label: "test"},
},
}
f, _ := os.Create("output.png")
defer f.Close()
pie.Render(chart.PNG, f)
}