SetTitle sets the chart title text and font size. To remove the title pass an empty string
(title string, size float64)
| 87 | // SetTitle sets the chart title text and font size. |
| 88 | // To remove the title pass an empty string |
| 89 | func (ch *Chart) SetTitle(title string, size float64) { |
| 90 | |
| 91 | // Remove title |
| 92 | if title == "" { |
| 93 | if ch.title != nil { |
| 94 | ch.Remove(ch.title) |
| 95 | ch.title.Dispose() |
| 96 | ch.title = nil |
| 97 | ch.recalc() |
| 98 | } |
| 99 | return |
| 100 | } |
| 101 | |
| 102 | // Sets title |
| 103 | if ch.title == nil { |
| 104 | ch.title = NewLabel(title) |
| 105 | ch.title.SetColor4(math32.NewColor4("black")) |
| 106 | ch.Add(ch.title) |
| 107 | } |
| 108 | ch.title.SetText(title) |
| 109 | ch.title.SetFontSize(size) |
| 110 | ch.recalc() |
| 111 | } |
| 112 | |
| 113 | // SetMarginY sets the y scale margin |
| 114 | func (ch *Chart) SetMarginY(left float32) { |
no test coverage detected