mirror of
https://github.com/zieckey/gochart.git
synced 2025-04-24 13:48:57 +08:00
Add Height parameter
This commit is contained in:
parent
fb65459fb8
commit
95e5cb30ed
@ -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
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user