better handling of yaxis ticks.

This commit is contained in:
Will Charczuk 2016-07-11 23:43:22 -07:00
parent debd56f494
commit 771bfbd9fb

View File

@ -56,7 +56,10 @@ func (ya YAxis) getTickStep(r Renderer, ra Range, vf ValueFormatter) float64 {
}
func (ya YAxis) getTickCount(r Renderer, ra Range, vf ValueFormatter) int {
return DefaultTickCount
//given the domain, figure out how many ticks we can draw ...
label := vf(ra.Min)
tb := r.MeasureText(label)
return int(math.Ceil(float64(ra.Domain) / float64(tb.Height+DefaultMinimumTickVerticalSpacing)))
}
// Measure returns the bounds of the axis.