refactor: adjust text render of axis
This commit is contained in:
parent
eef3a2f97b
commit
0a3ac7096a
2 changed files with 9 additions and 2 deletions
8
axis.go
8
axis.go
|
|
@ -153,8 +153,14 @@ func (a *axisPainter) Render() (Box, error) {
|
|||
top.SetDrawingStyle(style).OverrideTextStyle(style)
|
||||
|
||||
textMaxWidth, textMaxHeight := top.MeasureTextMaxWidthHeight(data)
|
||||
textCount := ceilFloatToInt(float64(top.Width()) / float64(textMaxWidth))
|
||||
|
||||
textFillWidth := float64(textMaxWidth) * 1.3
|
||||
textCount := ceilFloatToInt(float64(top.Width()) / textFillWidth)
|
||||
unit := ceilFloatToInt(float64(dataCount) / float64(chart.MaxInt(textCount, opt.SplitNumber)))
|
||||
// 偶数
|
||||
if unit%2 == 0 && dataCount%(unit+1) == 0 {
|
||||
unit++
|
||||
}
|
||||
|
||||
width := 0
|
||||
height := 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue