diff --git a/box_2d.go b/box_2d.go index 3adf53e..434bda3 100644 --- a/box_2d.go +++ b/box_2d.go @@ -118,7 +118,7 @@ func (bc Box2d) Overlaps(other Box2d) bool { } 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 diff --git a/box_2d_test.go b/box_2d_test.go index 07a01dc..7cb541a 100644 --- a/box_2d_test.go +++ b/box_2d_test.go @@ -61,6 +61,6 @@ func TestBox2dOverlaps(t *testing.T) { assert.True(bc.Overlaps(bc5)) bcr := bc.Rotate(45) - bcr2 := bc.Rotate(45).Shift(bc.Height(), 0) - assert.False(bcr.Overlaps(bcr2), fmt.Sprintf("%v\n\t\tshould not overlap\n\t%v", bcr, bcr2)) + bcr2 := bc.Rotate(45).Shift(bc.Width()/2.0, 0) + assert.True(bcr.Overlaps(bcr2), fmt.Sprintf("%v\n\t\tshould overlap\n\t%v", bcr, bcr2)) } diff --git a/candlestick_series.go b/candlestick_series.go index 55cfeee..83b5d80 100644 --- a/candlestick_series.go +++ b/candlestick_series.go @@ -78,6 +78,10 @@ func (cs CandlestickSeries) GetCandleValues() []CandleValue { // GenerateCandleValues returns the candlestick values for each day represented by the inner series. func (cs CandlestickSeries) GenerateCandleValues() []CandleValue { + if cs.InnerSeries == nil { + return nil + } + totalValues := cs.InnerSeries.Len() if totalValues == 0 { return nil @@ -105,7 +109,7 @@ func (cs CandlestickSeries) GenerateCandleValues() []CandleValue { lv = v for i := 1; i < totalValues; i++ { - tv, v = cs.InnerSeries.GetValues(0) + tv, v = cs.InnerSeries.GetValues(i) t = util.Time.FromFloat64(tv) year, month, day = t.Year(), int(t.Month()), t.Day() diff --git a/debug.test b/debug.test new file mode 100755 index 0000000..8ac0d3f Binary files /dev/null and b/debug.test differ