fixing sanity check test on gen ticks.

This commit is contained in:
Will Charczuk 2016-07-30 20:30:19 -07:00
parent 7a9d9e56a7
commit 200116c193

View file

@ -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),