Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Unable to generate graph #196

Open
wengooooo opened this issue Apr 24, 2022 · 0 comments
Open

Unable to generate graph #196

wengooooo opened this issue Apr 24, 2022 · 0 comments

Comments

@wengooooo
Copy link

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))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant