adding validation.
This commit is contained in:
parent
3ea3c9ac10
commit
e735797037
20 changed files with 285 additions and 7 deletions
|
|
@ -1,6 +1,9 @@
|
|||
package chart
|
||||
|
||||
import "math"
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
// AnnotationSeries is a series of labels on the chart.
|
||||
type AnnotationSeries struct {
|
||||
|
|
@ -73,3 +76,11 @@ func (as AnnotationSeries) Render(r Renderer, canvasBox Box, xrange, yrange Rang
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate validates the series.
|
||||
func (as AnnotationSeries) Validate() error {
|
||||
if len(as.Annotations) == 0 {
|
||||
return fmt.Errorf("annotation series requires annotations to be set and not empty")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue