go-chart/examples/pie_chart/main.go

30 lines
497 B
Go
Raw Normal View History

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