tickLabelWidth returns the width of the widest tick mark label.
(sty text.Style, ticks []Tick)
| 712 | |
| 713 | // tickLabelWidth returns the width of the widest tick mark label. |
| 714 | func tickLabelWidth(sty text.Style, ticks []Tick) vg.Length { |
| 715 | maxWidth := vg.Length(0) |
| 716 | for _, t := range ticks { |
| 717 | if t.IsMinor() { |
| 718 | continue |
| 719 | } |
| 720 | r := sty.Rectangle(t.Label) |
| 721 | w := r.Max.X - r.Min.X |
| 722 | if w > maxWidth { |
| 723 | maxWidth = w |
| 724 | } |
| 725 | } |
| 726 | return maxWidth |
| 727 | } |
| 728 | |
| 729 | // formatFloatTick returns a g-formated string representation of v |
| 730 | // to the specified precision. |
no test coverage detected