size returns the width of the axis.
()
| 354 | |
| 355 | // size returns the width of the axis. |
| 356 | func (a verticalAxis) size() (w vg.Length) { |
| 357 | if a.Label.Text != "" { // We assume that the label isn't rotated. |
| 358 | w += a.Label.TextStyle.FontExtents().Descent |
| 359 | w += a.Label.TextStyle.Height(a.Label.Text) |
| 360 | w += a.Label.Padding |
| 361 | } |
| 362 | |
| 363 | marks := a.Tick.Marker.Ticks(a.Min, a.Max) |
| 364 | if len(marks) > 0 { |
| 365 | if lwidth := tickLabelWidth(a.Tick.Label, marks); lwidth > 0 { |
| 366 | w += lwidth |
| 367 | w += a.Label.TextStyle.Width(" ") |
| 368 | } |
| 369 | if a.drawTicks() { |
| 370 | w += a.Tick.Length |
| 371 | } |
| 372 | } |
| 373 | w += a.Width / 2 |
| 374 | w += a.Padding |
| 375 | |
| 376 | return w |
| 377 | } |
| 378 | |
| 379 | // draw draws the axis along the left side of a draw.Canvas. |
| 380 | func (a verticalAxis) draw(c draw.Canvas) { |
no test coverage detected