Debian Codegraph @

examples/custom_padding/main.go

raw symbols SCIP
1 package main
2
3 //go:generate go run main.go
4
5 import (
6 "os"
7
8 "github.com/wcharczuk/go-chart/v2"
9 "github.com/wcharczuk/go-chart/v2/drawing"
10 )
11
12 func main() {
13 graph := chart.Chart{
14 Background: chart.Style{
15 Padding: chart.Box{
16 Top: 50,
17 Left: 25,
18 Right: 25,
19 Bottom: 10,
20 },
21 FillColor: drawing.ColorFromHex("efefef"),
22 },
23 Series: []chart.Series{
24 chart.ContinuousSeries{
25 XValues: chart.Seq{Sequence: chart.NewLinearSequence().WithStart(1.0).WithEnd(100.0)}.Values(),
26 YValues: chart.Seq{Sequence: chart.NewRandomSequence().WithLen(100).WithMin(100).WithMax(512)}.Values(),
27 },
28 },
29 }
30
31 f, _ := os.Create("output.png")
32 defer f.Close()
33 graph.Render(chart.PNG, f)
34 }