From 771bfbd9fb821d1cf28e165ad10496f6148c9def Mon Sep 17 00:00:00 2001 From: Will Charczuk Date: Mon, 11 Jul 2016 23:43:22 -0700 Subject: [PATCH] better handling of yaxis ticks. --- yaxis.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yaxis.go b/yaxis.go index 0eb7c66..60a6934 100644 --- a/yaxis.go +++ b/yaxis.go @@ -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.