go-chart/last_value_annotation_series_test.go

23 lines
501 B
Go
Raw Normal View History

2018-09-07 15:52:30 -04:00
package chart
import (
"testing"
2024-10-27 22:52:38 -04:00
"git.smarteching.com/zeni/go-chart/v2/testutil"
2018-09-07 15:52:30 -04:00
)
2019-02-13 22:13:29 -05:00
func TestLastValueAnnotationSeries(t *testing.T) {
// replaced new assertions helper
2018-09-07 15:52:30 -04:00
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)
testutil.AssertNotEmpty(t, lva.Annotations)
2018-09-07 15:52:30 -04:00
lvaa := lva.Annotations[0]
testutil.AssertEqual(t, 5, lvaa.XValue)
testutil.AssertEqual(t, 1, lvaa.YValue)
2018-09-07 15:52:30 -04:00
}