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
|
||||
*.test
|
||||
*.prof
|
||||
|
||||
download/win64/gochart/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/zieckey/goini"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -54,5 +55,9 @@ func LookupChartFiles(dir string) ([]string, error) {
|
|||
return nil
|
||||
})
|
||||
|
||||
if len(files) == 0 {
|
||||
return files, errors.New("Not found any *.chart files")
|
||||
}
|
||||
|
||||
return files, err
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
//"fmt"
|
||||
"net/http"
|
||||
"text/template"
|
||||
|
@ -19,7 +18,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
|||
w.Write([]byte(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Index++
|
||||
Index = Index % len(ChartFiles)
|
||||
|
||||
|
@ -41,10 +40,8 @@ func ListenAndServe(addr string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(ChartFiles) == 0 {
|
||||
return errors.New("No chart data.")
|
||||
}
|
||||
|
||||
// Register chart handlders
|
||||
ChartHandlers["spline"] = new(SplineChart)
|
||||
ChartHandlers["column"] = new(SplineChart)
|
||||
ChartHandlers["area"] = new(SplineChart)
|
||||
|
|
|
@ -7,7 +7,7 @@ var TemplatePieHtml = `{{define "T"}}
|
|||
<html>
|
||||
<head>
|
||||
<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">
|
||||
|
|
|
@ -8,7 +8,7 @@ var TemplateSplineHtml = `{{define "T"}}
|
|||
<html>
|
||||
<head>
|
||||
<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">
|
||||
|
@ -49,6 +49,7 @@ var TemplateSplineHtml = `{{define "T"}}
|
|||
}]
|
||||
},
|
||||
tooltip: {
|
||||
shared: true,
|
||||
// valueSuffix: '°C'
|
||||
valueSuffix: '{{.ValueSuffix}}'
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue