2016-07-28 19:36:30 -04:00
|
|
|
package chart
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
assert "github.com/blendlabs/go-assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestHistogramSeries(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
|
|
|
|
|
|
|
cs := ContinuousSeries{
|
|
|
|
Name: "Test Series",
|
2017-04-28 19:07:36 -04:00
|
|
|
XValues: Generate.Float64(1.0, 20.0),
|
|
|
|
YValues: Generate.Float64(10.0, -10.0),
|
2016-07-28 19:36:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
hs := HistogramSeries{
|
|
|
|
InnerSeries: cs,
|
|
|
|
}
|
|
|
|
|
|
|
|
for x := 0; x < hs.Len(); x++ {
|
2017-04-28 19:07:36 -04:00
|
|
|
csx, csy := cs.GetValues(0)
|
|
|
|
hsx, hsy1, hsy2 := hs.GetBoundedValues(0)
|
2016-07-28 19:36:30 -04:00
|
|
|
assert.Equal(csx, hsx)
|
|
|
|
assert.True(hsy1 > 0)
|
|
|
|
assert.True(hsy2 <= 0)
|
|
|
|
assert.True(csy < 0 || (csy > 0 && csy == hsy1))
|
|
|
|
assert.True(csy > 0 || (csy < 0 && csy == hsy2))
|
|
|
|
}
|
|
|
|
}
|