fixing sanity check test on gen ticks.
This commit is contained in:
parent
7a9d9e56a7
commit
200116c193
1 changed files with 3 additions and 2 deletions
5
tick.go
5
tick.go
|
@ -55,13 +55,14 @@ func GenerateContinuousTicks(r Renderer, ra Range, isVertical bool, style Style,
|
||||||
domainRemainder := (ra.GetDomain()) - (tickSize * 2)
|
domainRemainder := (ra.GetDomain()) - (tickSize * 2)
|
||||||
intermediateTickCount := int(math.Floor(float64(domainRemainder) / float64(tickSize)))
|
intermediateTickCount := int(math.Floor(float64(domainRemainder) / float64(tickSize)))
|
||||||
|
|
||||||
rangeDelta := math.Floor(max - min)
|
rangeDelta := max - min
|
||||||
tickStep := rangeDelta / float64(intermediateTickCount)
|
tickStep := rangeDelta / float64(intermediateTickCount)
|
||||||
|
|
||||||
roundTo := Math.GetRoundToForDelta(rangeDelta) / 10
|
roundTo := Math.GetRoundToForDelta(rangeDelta) / 10
|
||||||
|
intermediateTickCount = Math.MinInt(intermediateTickCount, 1<<10)
|
||||||
|
|
||||||
for x := 1; x < intermediateTickCount; x++ {
|
for x := 1; x < intermediateTickCount; x++ {
|
||||||
tickValue := min + Math.RoundDown(tickStep*float64(x), roundTo)
|
tickValue := min + Math.RoundUp(tickStep*float64(x), roundTo)
|
||||||
ticks = append(ticks, Tick{
|
ticks = append(ticks, Tick{
|
||||||
Value: tickValue,
|
Value: tickValue,
|
||||||
Label: vf(tickValue),
|
Label: vf(tickValue),
|
||||||
|
|
Loading…
Reference in a new issue