go-chart/legend_test.go
Zeni Kim cc8d36edd9
Some checks failed
Continuous Integration / Tests (push) Has been cancelled
update url
2024-10-27 21:52:38 -05:00

31 lines
635 B
Go

package chart
import (
"bytes"
"testing"
"git.smarteching.com/zeni/go-chart/v2/testutil"
)
func TestLegend(t *testing.T) {
// replaced new assertions helper
graph := Chart{
Series: []Series{
ContinuousSeries{
Name: "A test series",
XValues: []float64{1.0, 2.0, 3.0, 4.0, 5.0},
YValues: []float64{1.0, 2.0, 3.0, 4.0, 5.0},
},
},
}
//note we have to do this as a separate step because we need a reference to graph
graph.Elements = []Renderable{
Legend(&graph),
}
buf := bytes.NewBuffer([]byte{})
err := graph.Render(PNG, buf)
testutil.AssertNil(t, err)
testutil.AssertNotZero(t, buf.Len())
}