2016-08-27 17:23:55 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
|
2024-10-27 22:52:38 -04:00
|
|
|
"git.smarteching.com/zeni/go-chart/v2"
|
2016-08-27 17:23:55 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
graph := chart.Chart{
|
|
|
|
Series: []chart.Series{
|
|
|
|
chart.ContinuousSeries{
|
|
|
|
XValues: []float64{1.0, 2.0, 3.0, 4.0, 5.0},
|
|
|
|
YValues: []float64{1.0, 2.0, 3.0, 4.0, 5.0},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
collector := &chart.ImageWriter{}
|
|
|
|
graph.Render(chart.PNG, collector)
|
|
|
|
|
|
|
|
image, err := collector.Image()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
fmt.Printf("Final Image: %dx%d\n", image.Bounds().Size().X, image.Bounds().Size().Y)
|
|
|
|
}
|