Add Height parameter

This commit is contained in:
weizili.build9 2017-03-12 21:51:02 +08:00
parent fb65459fb8
commit 95e5cb30ed
5 changed files with 7 additions and 2 deletions

View File

@ -41,6 +41,9 @@ Title = Source: WorldClimate.com
SubTitle = Monthly Average Temperature
ValueSuffix = °C
# The height (px) of the chart
Height = 400
# The x Axis numbers. The count this numbers MUST be the same with the data series
XAxisNumbers = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12

View File

@ -21,6 +21,7 @@ type TemplateArgs struct {
}
func Parse(file string) (tt TemplateArgs, err error) {
log.Printf("Rendering %v", file)
ini := goini.New()
err = ini.ParseFile(file)
if err != nil {

View File

@ -17,6 +17,7 @@ func (c *SplineChart) Parse(ini *goini.INI) (map[string]string, error) {
args["YAxisText"], _ = ini.Get("YAxisText")
args["XAxisNumbers"], _ = ini.Get("XAxisNumbers")
args["ValueSuffix"], _ = ini.Get("ValueSuffix")
args["Height"], _ = ini.Get("Height")
datas := make([]interface{}, 0)

View File

@ -71,7 +71,7 @@ var TemplatePieHtml = `{{define "T"}}
<script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/4.0.1/highcharts.js"></script>
<script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/4.0.1/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
<div id="container" style="min-width: 310px; height: {{.Height}}px; max-width: 600px; margin: 0 auto"></div>
</body>
</html>

View File

@ -90,7 +90,7 @@ var TemplateSplineHtml = `{{define "T"}}
<script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/4.0.1/highcharts.js"></script>
<script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/4.0.1/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<div id="container" style="min-width: 310px; height: {{.Height}}px; margin: 0 auto"></div>
</body>
</html>