| 1 |
package main |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
import ( |
| 6 |
"os" |
| 7 |
|
| 8 |
"github.com/wcharczuk/go-chart/v2" |
| 9 |
) |
| 10 |
|
| 11 |
func main() { |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
graph := chart.Chart{ |
| 18 |
YAxis: chart.YAxis{ |
| 19 |
Range: &chart.ContinuousRange{ |
| 20 |
Min: 0.0, |
| 21 |
Max: 4.0, |
| 22 |
}, |
| 23 |
Ticks: []chart.Tick{ |
| 24 |
{Value: 0.0, Label: "0.00"}, |
| 25 |
{Value: 2.0, Label: "2.00"}, |
| 26 |
{Value: 4.0, Label: "4.00"}, |
| 27 |
{Value: 6.0, Label: "6.00"}, |
| 28 |
{Value: 8.0, Label: "Eight"}, |
| 29 |
{Value: 10.0, Label: "Ten"}, |
| 30 |
}, |
| 31 |
}, |
| 32 |
Series: []chart.Series{ |
| 33 |
chart.ContinuousSeries{ |
| 34 |
XValues: []float64{1.0, 2.0, 3.0, 4.0, 5.0}, |
| 35 |
YValues: []float64{1.0, 2.0, 3.0, 4.0, 5.0}, |
| 36 |
}, |
| 37 |
}, |
| 38 |
} |
| 39 |
f, _ := os.Create("output.png") |
| 40 |
defer f.Close() |
| 41 |
graph.Render(chart.PNG, f) |
| 42 |
} |