feat: support legend render function
This commit is contained in:
parent
ffbda8f214
commit
c4b5ac3f42
5 changed files with 140 additions and 10 deletions
18
util.go
18
util.go
|
|
@ -22,7 +22,12 @@
|
|||
|
||||
package charts
|
||||
|
||||
import "github.com/wcharczuk/go-chart/v2"
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/wcharczuk/go-chart/v2"
|
||||
)
|
||||
|
||||
func TrueFlag() *bool {
|
||||
t := true
|
||||
|
|
@ -90,3 +95,14 @@ func reverseIntSlice(intList []int) {
|
|||
intList[i], intList[j] = intList[j], intList[i]
|
||||
}
|
||||
}
|
||||
|
||||
func convertPercent(value string) float64 {
|
||||
if !strings.HasSuffix(value, "%") {
|
||||
return -1
|
||||
}
|
||||
v, err := strconv.Atoi(strings.ReplaceAll(value, "%", ""))
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
return float64(v) / 100
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue