fix: fix pie chart legend

This commit is contained in:
vicanso 2022-07-14 20:14:32 +08:00
parent b5b2d37e87
commit 3af0d4d445
3 changed files with 8 additions and 3 deletions

View file

@ -136,9 +136,14 @@ func defaultRender(p *Painter, opt defaultRenderOption) (*defaultRenderResult, e
return nil, err
}
top := chart.MaxInt(legendHeight, titleBox.Height())
// 如果是垂直方式则不计算legend高度
if opt.LegendOption.Orient == OrientVertical {
top = titleBox.Height()
}
p = p.Child(PainterPaddingOption(Box{
// 标题下留白
Top: chart.MaxInt(legendHeight, titleBox.Height()) + 20,
Top: top + 20,
}))
}