pulling generate grid lines into its own function

This commit is contained in:
Will Charczuk 2016-07-12 19:22:02 -07:00
parent 249e9956d0
commit 1c3473f674
3 changed files with 35 additions and 35 deletions

View file

@ -71,33 +71,7 @@ func (ya YAxis) GetGridLines(ticks []Tick) []GridLine {
if len(ya.GridLines) > 0 {
return ya.GridLines
}
return ya.generateGridLines(ticks)
}
func (ya YAxis) generateGridLines(ticks []Tick) []GridLine {
var gl []GridLine
isMinor := false
minorStyle := Style{
StrokeColor: DefaultGridLineColor.WithAlpha(100),
StrokeWidth: 1.0,
}
majorStyle := Style{
StrokeColor: DefaultGridLineColor,
StrokeWidth: 1.0,
}
for _, t := range ticks {
s := majorStyle
if isMinor {
s = minorStyle
}
gl = append(gl, GridLine{
Style: s,
IsMinor: isMinor,
Value: t.Value,
})
isMinor = !isMinor
}
return gl
return GenerateGridLines(ticks, false)
}
// Measure returns the bounds of the axis.