Cleans up makeHistoryCHart()
This commit is contained in:
parent
6cc20e337d
commit
946737d563
@ -49,7 +49,7 @@ func (a *App) renderChart(w http.ResponseWriter, c renderableChart) error {
|
|||||||
return nil
|
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
|
// TODO BUG: one day is missing randomly (usually the 3rd day in the range) in the chart
|
||||||
var xVals []time.Time
|
var xVals []time.Time
|
||||||
var yVals []float64
|
var yVals []float64
|
||||||
@ -98,7 +98,6 @@ func makeHistoryChart(showLegend bool, points []ServerPoint) chart.Chart {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
if showLegend {
|
if showLegend {
|
||||||
// Add a legend
|
|
||||||
c.Elements = []chart.Renderable{
|
c.Elements = []chart.Renderable{
|
||||||
chart.LegendThin(&c),
|
chart.LegendThin(&c),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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)
|
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)
|
return a.renderChart(w, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user