hit coverage min, but not quite done yet.
This commit is contained in:
parent
22e4431c82
commit
e4e2c846e3
4 changed files with 94 additions and 5 deletions
31
legend_test.go
Normal file
31
legend_test.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package chart
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/blendlabs/go-assert"
|
||||
)
|
||||
|
||||
func TestLegend(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
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)
|
||||
assert.Nil(err)
|
||||
assert.NotZero(buf.Len())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue