fix: fix multi line label
This commit is contained in:
parent
c220b10ae6
commit
959377542e
3 changed files with 9 additions and 6 deletions
File diff suppressed because one or more lines are too long
|
|
@ -146,6 +146,8 @@ func (l *legendPainter) Render() (Box, error) {
|
||||||
width += item.Width()
|
width += item.Width()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 增加padding
|
||||||
|
itemMaxHeight += 10
|
||||||
if opt.Orient == OrientVertical {
|
if opt.Orient == OrientVertical {
|
||||||
width = maxTextWidth + textOffset + legendWidth
|
width = maxTextWidth + textOffset + legendWidth
|
||||||
height = offset * len(opt.Data)
|
height = offset * len(opt.Data)
|
||||||
|
|
@ -207,9 +209,10 @@ func (l *legendPainter) Render() (Box, error) {
|
||||||
FillColor: color,
|
FillColor: color,
|
||||||
StrokeColor: color,
|
StrokeColor: color,
|
||||||
})
|
})
|
||||||
if x0+measureList[index].Width() > p.Width() {
|
if x0+measureList[index].Width()+textOffset+offset+legendWidth > p.Width() {
|
||||||
x0 = 0
|
x0 = 0
|
||||||
y0 += itemMaxHeight
|
y += itemMaxHeight
|
||||||
|
y0 = y
|
||||||
}
|
}
|
||||||
if opt.Align != AlignRight {
|
if opt.Align != AlignRight {
|
||||||
x0 = drawIcon(y0, x0)
|
x0 = drawIcon(y0, x0)
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue