Cleans up makeHistoryCHart()

This commit is contained in:
A. Svensson 2017-09-09 14:03:29 +02:00
parent 6cc20e337d
commit 946737d563
2 changed files with 3 additions and 4 deletions

View File

@ -49,7 +49,7 @@ func (a *App) renderChart(w http.ResponseWriter, c renderableChart) error {
return nil
}
func makeHistoryChart(showLegend bool, points []ServerPoint) chart.Chart {
func makeHistoryChart(points []ServerPoint, showLegend bool) chart.Chart {
// TODO BUG: one day is missing randomly (usually the 3rd day in the range) in the chart
var xVals []time.Time
var yVals []float64
@ -98,7 +98,6 @@ func makeHistoryChart(showLegend bool, points []ServerPoint) chart.Chart {
},
}
if showLegend {
// Add a legend
c.Elements = []chart.Renderable{
chart.LegendThin(&c),
}

View File

@ -71,7 +71,7 @@ func (a *App) pageDailyChart(w http.ResponseWriter, r *http.Request, vars handle
}
}
c := makeHistoryChart(true, points)
c := makeHistoryChart(points, true)
return a.renderChart(w, c)
}
@ -88,7 +88,7 @@ func (a *App) pageWeeklyChart(w http.ResponseWriter, r *http.Request, vars handl
}
}
c := makeHistoryChart(false, points)
c := makeHistoryChart(points, false)
return a.renderChart(w, c)
}