adding validation.

This commit is contained in:
Will Charczuk 2017-02-03 11:26:53 -08:00
parent 3ea3c9ac10
commit e735797037
20 changed files with 285 additions and 7 deletions

View file

@ -1,5 +1,7 @@
package chart
import "fmt"
const (
// DefaultMACDPeriodPrimary is the long window.
DefaultMACDPeriodPrimary = 26
@ -287,3 +289,11 @@ func (macdl *MACDLineSeries) Render(r Renderer, canvasBox Box, xrange, yrange Ra
style := macdl.Style.InheritFrom(defaults)
Draw.LineSeries(r, canvasBox, xrange, yrange, style, macdl)
}
// Validate validates the series.
func (macdl *MACDLineSeries) Validate() error {
if macdl.InnerSeries == nil {
return fmt.Errorf("macd line series requires InnerSeries to be set")
}
return nil
}