go-chart/last_value_annotation_series_test.go

23 lines
443 B
Go
Raw Normal View History

2018-09-07 15:52:30 -04:00
package chart
import (
"testing"
"github.com/blend/go-sdk/assert"
)
2019-02-13 22:13:29 -05:00
func TestLastValueAnnotationSeries(t *testing.T) {
2018-09-07 15:52:30 -04:00
assert := assert.New(t)
series := ContinuousSeries{
XValues: []float64{1.0, 2.0, 3.0, 4.0, 5.0},
YValues: []float64{5.0, 3.0, 3.0, 2.0, 1.0},
}
2019-02-13 22:13:29 -05:00
lva := LastValueAnnotationSeries(series)
2018-09-07 15:52:30 -04:00
assert.NotEmpty(lva.Annotations)
lvaa := lva.Annotations[0]
assert.Equal(5, lvaa.XValue)
assert.Equal(1, lvaa.YValue)
}