mirror of https://github.com/zieckey/gochart.git
Fix a bug : trim spaces of the data
This commit is contained in:
parent
35014aec6e
commit
7ac81fe784
|
@ -5,6 +5,7 @@ import (
|
|||
"github.com/zieckey/goini"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"log"
|
||||
)
|
||||
|
||||
const DataPrefix = "Data|"
|
||||
|
@ -50,6 +51,7 @@ func LookupChartFiles(dir string) ([]string, error) {
|
|||
if ok, err := filepath.Match("*.chart", f.Name()); err != nil {
|
||||
return err
|
||||
} else if ok {
|
||||
log.Printf("Add chart file %v", path)
|
||||
files = append(files, path)
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -29,6 +29,7 @@ func (c *SplineChart) Parse(ini *goini.INI) (map[string]string, error) {
|
|||
dd := strings.Split(v, ",")
|
||||
jd := make([]interface{}, 0)
|
||||
for _, d := range dd {
|
||||
d = strings.TrimSpace(d)
|
||||
val, err := strconv.ParseFloat(d, 64)
|
||||
if err == nil {
|
||||
jd = append(jd, val)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
package: github.com/zieckey/gochart
|
||||
import:
|
||||
- package: github.com/bitly/go-simplejson
|
||||
- package: github.com/zieckey/goini
|
Loading…
Reference in New Issue