feat: support top setting for title
This commit is contained in:
parent
25e9984ad8
commit
72896d1c3f
5 changed files with 379 additions and 4 deletions
5
title.go
5
title.go
|
|
@ -88,6 +88,11 @@ func NewTitleCustomize(title Title) chart.Renderable {
|
|||
}
|
||||
|
||||
titleY := cb.Top + title.Style.Padding.GetTop(chart.DefaultTitleTop) + (textHeight >> 1)
|
||||
// TOP 暂只支持数值
|
||||
if title.Top != "" {
|
||||
value, _ := strconv.Atoi(title.Top)
|
||||
titleY += value
|
||||
}
|
||||
|
||||
for _, item := range measureOptions {
|
||||
x := titleX + (textWidth-item.width)>>1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue