refactor: change project structure and package name
This commit is contained in:
parent
c1468e8ae4
commit
ad10e9a062
163 changed files with 104 additions and 135 deletions
31
pkg/chart/legend_test.go
Normal file
31
pkg/chart/legend_test.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package chart
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/d-Rickyy-b/go-chart-x/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())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue