refactor: adjust label padding of axis

This commit is contained in:
vicanso 2022-07-07 20:50:29 +08:00
parent 0a3ac7096a
commit c220b10ae6
4 changed files with 5 additions and 4 deletions

View file

@ -154,7 +154,8 @@ func (a *axisPainter) Render() (Box, error) {
textMaxWidth, textMaxHeight := top.MeasureTextMaxWidthHeight(data) textMaxWidth, textMaxHeight := top.MeasureTextMaxWidthHeight(data)
textFillWidth := float64(textMaxWidth) * 1.3 // 增加30px来计算文本展示区域
textFillWidth := float64(textMaxWidth + 20)
textCount := ceilFloatToInt(float64(top.Width()) / textFillWidth) textCount := ceilFloatToInt(float64(top.Width()) / textFillWidth)
unit := ceilFloatToInt(float64(dataCount) / float64(chart.MaxInt(textCount, opt.SplitNumber))) unit := ceilFloatToInt(float64(dataCount) / float64(chart.MaxInt(textCount, opt.SplitNumber)))
// 偶数 // 偶数

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long