Implement the algorithm

This commit is contained in:
Alexey Kirpichnikov 2019-05-16 17:04:37 +05:00
parent 9852fce5a1
commit f79e1f3446
No known key found for this signature in database
GPG key ID: AB57039A418CA645
4 changed files with 328 additions and 9 deletions

View file

@ -3,7 +3,7 @@ package chart
import (
"math"
util "github.com/wcharczuk/go-chart/util"
"github.com/wcharczuk/go-chart/util"
)
// YAxis is a veritcal rule of the range.
@ -22,8 +22,9 @@ type YAxis struct {
ValueFormatter ValueFormatter
Range Range
TickStyle Style
Ticks []Tick
TickStyle Style
Ticks []Tick
EnablePrettyTicks bool
GridLines []GridLine
GridMajorStyle Style
@ -71,6 +72,9 @@ func (ya YAxis) GetTicks(r Renderer, ra Range, defaults Style, vf ValueFormatter
return tp.GetTicks(r, defaults, vf)
}
tickStyle := ya.Style.InheritFrom(defaults)
if ya.EnablePrettyTicks {
return GeneratePrettyContinuousTicks(r, ra, true, tickStyle, vf)
}
return GenerateContinuousTicks(r, ra, true, tickStyle, vf)
}