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"
// HistogramSeries is a special type of series that draws as a histogram.
// Some peculiarities; it will always be lower bounded at 0 (at the very least).
// This may alter ranges a bit and generally you want to put a histogram series on it's own y-axis.
@ -55,3 +57,11 @@ func (hs HistogramSeries) Render(r Renderer, canvasBox Box, xrange, yrange Range
style := hs.Style.InheritFrom(defaults)
Draw.HistogramSeries(r, canvasBox, xrange, yrange, style, hs)
}
// Validate validates the series.
func (hs HistogramSeries) Validate() error {
if hs.InnerSeries == nil {
return fmt.Errorf("histogram series requires InnerSeries to be set")
}
return nil
}