@@ -262,20 +262,21 @@ func (a horizontalAxis) draw(c draw.Canvas) {
262262 x -= a .Label .Font .Width (a .Label .Text ) / 2
263263 }
264264 if a .Label .Text != "" {
265- y - = a .Label .Font .Extents ().Descent
266- c .FillText (a .Label .TextStyle , vg.Point {X : x , Y : y }, a .Label .Text )
265+ descent : = a .Label .Font .Extents ().Descent
266+ c .FillText (a .Label .TextStyle , vg.Point {X : x , Y : y - descent }, a .Label .Text )
267267 y += a .Label .Height (a .Label .Text )
268268 y += a .Label .Padding
269269 }
270270
271271 marks := a .Tick .Marker .Ticks (a .Min , a .Max )
272272 ticklabelheight := tickLabelHeight (a .Tick .Label , marks )
273+ descent := a .Tick .Label .Font .Extents ().Descent
273274 for _ , t := range marks {
274275 x := c .X (a .Norm (t .Value ))
275276 if ! c .ContainsX (x ) || t .IsMinor () {
276277 continue
277278 }
278- c .FillText (a .Tick .Label , vg.Point {X : x , Y : y + ticklabelheight }, t .Label )
279+ c .FillText (a .Tick .Label , vg.Point {X : x , Y : y + ticklabelheight - descent }, t .Label )
279280 }
280281
281282 if len (marks ) > 0 {
@@ -362,8 +363,9 @@ func (a verticalAxis) draw(c draw.Canvas) {
362363 y = c .Max .Y
363364 y -= a .Label .Font .Width (a .Label .Text ) / 2
364365 }
365- c .FillText (sty , vg.Point {X : x , Y : y }, a .Label .Text )
366- x += - a .Label .Font .Extents ().Descent
366+ descent := a .Label .Font .Extents ().Descent
367+ c .FillText (sty , vg.Point {X : x + descent , Y : y }, a .Label .Text )
368+ x -= descent
367369 x += a .Label .Padding
368370 }
369371 marks := a .Tick .Marker .Ticks (a .Min , a .Max )
@@ -372,12 +374,13 @@ func (a verticalAxis) draw(c draw.Canvas) {
372374 }
373375
374376 major := false
377+ descent := a .Tick .Label .Font .Extents ().Descent
375378 for _ , t := range marks {
376379 y := c .Y (a .Norm (t .Value ))
377380 if ! c .ContainsY (y ) || t .IsMinor () {
378381 continue
379382 }
380- c .FillText (a .Tick .Label , vg.Point {X : x , Y : y }, t .Label )
383+ c .FillText (a .Tick .Label , vg.Point {X : x , Y : y - descent }, t .Label )
381384 major = true
382385 }
383386 if major {
0 commit comments