updates
This commit is contained in:
parent
04a4edcb46
commit
5cf4f5f0d7
4 changed files with 8 additions and 4 deletions
|
@ -118,7 +118,7 @@ func (bc Box2d) Overlaps(other Box2d) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc Box2d) String() string {
|
func (bc Box2d) String() string {
|
||||||
return fmt.Sprintf("BoxC{%s,%s,%s,%s}", bc.TopLeft.String(), bc.TopRight.String(), bc.BottomRight.String(), bc.BottomLeft.String())
|
return fmt.Sprintf("Box2d{%s,%s,%s,%s}", bc.TopLeft.String(), bc.TopRight.String(), bc.BottomRight.String(), bc.BottomLeft.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Point is an X,Y pair
|
// Point is an X,Y pair
|
||||||
|
|
|
@ -61,6 +61,6 @@ func TestBox2dOverlaps(t *testing.T) {
|
||||||
assert.True(bc.Overlaps(bc5))
|
assert.True(bc.Overlaps(bc5))
|
||||||
|
|
||||||
bcr := bc.Rotate(45)
|
bcr := bc.Rotate(45)
|
||||||
bcr2 := bc.Rotate(45).Shift(bc.Height(), 0)
|
bcr2 := bc.Rotate(45).Shift(bc.Width()/2.0, 0)
|
||||||
assert.False(bcr.Overlaps(bcr2), fmt.Sprintf("%v\n\t\tshould not overlap\n\t%v", bcr, bcr2))
|
assert.True(bcr.Overlaps(bcr2), fmt.Sprintf("%v\n\t\tshould overlap\n\t%v", bcr, bcr2))
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,10 @@ func (cs CandlestickSeries) GetCandleValues() []CandleValue {
|
||||||
|
|
||||||
// GenerateCandleValues returns the candlestick values for each day represented by the inner series.
|
// GenerateCandleValues returns the candlestick values for each day represented by the inner series.
|
||||||
func (cs CandlestickSeries) GenerateCandleValues() []CandleValue {
|
func (cs CandlestickSeries) GenerateCandleValues() []CandleValue {
|
||||||
|
if cs.InnerSeries == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
totalValues := cs.InnerSeries.Len()
|
totalValues := cs.InnerSeries.Len()
|
||||||
if totalValues == 0 {
|
if totalValues == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
@ -105,7 +109,7 @@ func (cs CandlestickSeries) GenerateCandleValues() []CandleValue {
|
||||||
lv = v
|
lv = v
|
||||||
|
|
||||||
for i := 1; i < totalValues; i++ {
|
for i := 1; i < totalValues; i++ {
|
||||||
tv, v = cs.InnerSeries.GetValues(0)
|
tv, v = cs.InnerSeries.GetValues(i)
|
||||||
t = util.Time.FromFloat64(tv)
|
t = util.Time.FromFloat64(tv)
|
||||||
year, month, day = t.Year(), int(t.Month()), t.Day()
|
year, month, day = t.Year(), int(t.Month()), t.Day()
|
||||||
|
|
||||||
|
|
BIN
debug.test
Executable file
BIN
debug.test
Executable file
Binary file not shown.
Loading…
Reference in a new issue