MCPcopy
hub / github.com/g3n/engine / SetTitle

Method SetTitle

gui/chart.go:89–111  ·  view source on GitHub ↗

SetTitle sets the chart title text and font size. To remove the title pass an empty string

(title string, size float64)

Source from the content-addressed store, hash-verified

87// SetTitle sets the chart title text and font size.
88// To remove the title pass an empty string
89func (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
114func (ch *Chart) SetMarginY(left float32) {

Callers 1

buildChartFunction · 0.95

Calls 9

recalcMethod · 0.95
NewColor4Function · 0.92
NewLabelFunction · 0.85
DisposeMethod · 0.65
RemoveMethod · 0.45
SetColor4Method · 0.45
AddMethod · 0.45
SetTextMethod · 0.45
SetFontSizeMethod · 0.45

Tested by

no test coverage detected