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"
|
||||
)
|
||||
|
||||
// MinSeries draws a horizontal line at the minimum value of the inner series.
|
||||
type MinSeries struct {
|
||||
|
|
@ -60,6 +63,14 @@ func (ms *MinSeries) ensureMinValue() {
|
|||
}
|
||||
}
|
||||
|
||||
// Validate validates the series.
|
||||
func (ms *MinSeries) Validate() error {
|
||||
if ms.InnerSeries == nil {
|
||||
return fmt.Errorf("min series requires InnerSeries to be set")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MaxSeries draws a horizontal line at the maximum value of the inner series.
|
||||
type MaxSeries struct {
|
||||
Name string
|
||||
|
|
@ -117,3 +128,11 @@ func (ms *MaxSeries) ensureMaxValue() {
|
|||
ms.maxValue = &maxValue
|
||||
}
|
||||
}
|
||||
|
||||
// Validate validates the series.
|
||||
func (ms *MaxSeries) Validate() error {
|
||||
if ms.InnerSeries == nil {
|
||||
return fmt.Errorf("max series requires InnerSeries to be set")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue