do actually need to check that the ranges are set

This commit is contained in:
Will Charczuk 2017-03-05 23:28:35 -08:00
parent 7a3d6a6915
commit ee78cf8f2f
2 changed files with 7 additions and 5 deletions

View file

@ -315,6 +315,10 @@ func (c Chart) checkRanges(xr, yr, yra Range) error {
return errors.New("nan y-range delta") return errors.New("nan y-range delta")
} }
if yDelta == 0 {
return errors.New("zero y-range delta")
}
if c.hasSecondarySeries() { if c.hasSecondarySeries() {
yraDelta := yra.GetDelta() yraDelta := yra.GetDelta()
if math.IsInf(yraDelta, 0) { if math.IsInf(yraDelta, 0) {
@ -323,6 +327,9 @@ func (c Chart) checkRanges(xr, yr, yra Range) error {
if math.IsNaN(yraDelta) { if math.IsNaN(yraDelta) {
return errors.New("nan secondary y-range delta") return errors.New("nan secondary y-range delta")
} }
if yraDelta == 0 {
return errors.New("zero secondary y-range delta")
}
} }
return nil return nil

View file

@ -183,11 +183,6 @@ var (
DashArrayDashesLarge = []int{10, 10} DashArrayDashesLarge = []int{10, 10}
) )
// NewColor returns a new color.
func NewColor(r, g, b, a uint8) drawing.Color {
return drawing.Color{R: r, G: g, B: b, A: a}
}
// GetDefaultColor returns a color from the default list by index. // GetDefaultColor returns a color from the default list by index.
// NOTE: the index will wrap around (using a modulo). // NOTE: the index will wrap around (using a modulo).
func GetDefaultColor(index int) drawing.Color { func GetDefaultColor(index int) drawing.Color {