mirror of https://github.com/zieckey/gochart.git
modify the title. and add the chart type to the title
This commit is contained in:
parent
9d8d8ed634
commit
01b8443b41
|
@ -22,3 +22,5 @@ _testmain.go
|
||||||
*.exe
|
*.exe
|
||||||
*.test
|
*.test
|
||||||
*.prof
|
*.prof
|
||||||
|
|
||||||
|
download/win64/gochart/
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"github.com/zieckey/goini"
|
"github.com/zieckey/goini"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -54,5 +55,9 @@ func LookupChartFiles(dir string) ([]string, error) {
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if len(files) == 0 {
|
||||||
|
return files, errors.New("Not found any *.chart files")
|
||||||
|
}
|
||||||
|
|
||||||
return files, err
|
return files, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
//"fmt"
|
//"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
@ -19,7 +18,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Write([]byte(err.Error()))
|
w.Write([]byte(err.Error()))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
Index++
|
Index++
|
||||||
Index = Index % len(ChartFiles)
|
Index = Index % len(ChartFiles)
|
||||||
|
|
||||||
|
@ -41,10 +40,8 @@ func ListenAndServe(addr string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(ChartFiles) == 0 {
|
|
||||||
return errors.New("No chart data.")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Register chart handlders
|
||||||
ChartHandlers["spline"] = new(SplineChart)
|
ChartHandlers["spline"] = new(SplineChart)
|
||||||
ChartHandlers["column"] = new(SplineChart)
|
ChartHandlers["column"] = new(SplineChart)
|
||||||
ChartHandlers["area"] = new(SplineChart)
|
ChartHandlers["area"] = new(SplineChart)
|
||||||
|
|
|
@ -7,7 +7,7 @@ var TemplatePieHtml = `{{define "T"}}
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Highcharts Example</title>
|
<title>Gochart - {{.ChartType}} | CodeG.cn</title>
|
||||||
|
|
||||||
<script type="text/javascript" src="http://cdn.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
|
<script type="text/javascript" src="http://cdn.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
@ -8,7 +8,7 @@ var TemplateSplineHtml = `{{define "T"}}
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Highcharts Example</title>
|
<title>Gochart - {{.ChartType}} | CodeG.cn</title>
|
||||||
|
|
||||||
<script type="text/javascript" src="http://cdn.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
|
<script type="text/javascript" src="http://cdn.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -49,6 +49,7 @@ var TemplateSplineHtml = `{{define "T"}}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
|
shared: true,
|
||||||
// valueSuffix: '°C'
|
// valueSuffix: '°C'
|
||||||
valueSuffix: '{{.ValueSuffix}}'
|
valueSuffix: '{{.ValueSuffix}}'
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue