sanity check tests.

This commit is contained in:
Will Charczuk 2017-03-05 16:52:34 -08:00
parent 10950a3bf2
commit 8b34cb3bd7
8 changed files with 138 additions and 35 deletions

View file

@ -48,7 +48,33 @@ func drawChart(res http.ResponseWriter, req *http.Request) {
}
func unit(res http.ResponseWriter, req *http.Request) {
graph := chart.Chart{
Height: 50,
Width: 50,
Canvas: chart.Style{
Padding: chart.Box{IsSet: true},
},
Background: chart.Style{
Padding: chart.Box{IsSet: true},
},
Series: []chart.Series{
chart.ContinuousSeries{
XValues: chart.Sequence.Float64(0, 4, 1),
YValues: chart.Sequence.Float64(0, 4, 1),
},
},
}
res.Header().Set("Content-Type", "image/png")
err := graph.Render(chart.PNG, res)
if err != nil {
log.Println(err.Error())
}
}
func main() {
http.HandleFunc("/", drawChart)
http.HandleFunc("/unit", unit)
log.Fatal(http.ListenAndServe(":8080", nil))
}