refactor: adjust axis function
This commit is contained in:
parent
5068828ca7
commit
7e80e9a848
7 changed files with 134 additions and 107 deletions
4
util.go
4
util.go
|
|
@ -76,11 +76,11 @@ func autoDivide(max, size int) []int {
|
|||
}
|
||||
|
||||
// measureTextMaxWidthHeight returns maxWidth and maxHeight of text list
|
||||
func measureTextMaxWidthHeight(textList []string, r chart.Renderer) (int, int) {
|
||||
func measureTextMaxWidthHeight(textList []string, p *Painter) (int, int) {
|
||||
maxWidth := 0
|
||||
maxHeight := 0
|
||||
for _, text := range textList {
|
||||
box := r.MeasureText(text)
|
||||
box := p.MeasureText(text)
|
||||
maxWidth = chart.MaxInt(maxWidth, box.Width())
|
||||
maxHeight = chart.MaxInt(maxHeight, box.Height())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue