Open wengooooo opened 2 years ago
Reproduction code
x1 := time.Now().Add(10 * time.Second) x2 := time.Now().Add(15 * time.Second) x3 := time.Now().Add(20 * time.Second) graph := chart.Chart{ Series: []chart.Series{ chart.TimeSeries{ XValues: []time.Time{x1, x2, x3}, YValues: []float64{1.0, 1.0, 1.0}, }, chart.AnnotationSeries{ Annotations: []chart.Value2{ {XValue: chart.TimeToFloat64(x1), YValue: 1.0, Label: "first"}, {XValue: chart.TimeToFloat64(x2), YValue: 1.0, Label: "second"}, {XValue: chart.TimeToFloat64(x3), YValue: 1.0, Label: "last"}, }, }, }, } f, _ := os.Create("output.png") defer f.Close() fmt.Println(graph.Render(chart.PNG, f))
Reproduction code