example tweaks.

This commit is contained in:
Will Charczuk 2016-08-11 20:38:53 -07:00
parent 7885ca4d69
commit 3735edb5be

View File

@ -26,18 +26,13 @@ func readData() ([]time.Time, []float64) {
} }
func releases() []chart.GridLine { func releases() []chart.GridLine {
lineStyle := chart.Style{
Show: true,
StrokeColor: chart.ColorAlternateGray,
StrokeWidth: 1.0,
}
return []chart.GridLine{ return []chart.GridLine{
{Value: chart.TimeToFloat64(time.Date(2016, 8, 1, 9, 30, 0, 0, time.UTC)), IsVertical: true, Style: lineStyle}, {Value: chart.TimeToFloat64(time.Date(2016, 8, 1, 9, 30, 0, 0, time.UTC))},
{Value: chart.TimeToFloat64(time.Date(2016, 8, 2, 9, 30, 0, 0, time.UTC)), IsVertical: true, Style: lineStyle}, {Value: chart.TimeToFloat64(time.Date(2016, 8, 2, 9, 30, 0, 0, time.UTC))},
{Value: chart.TimeToFloat64(time.Date(2016, 8, 3, 9, 30, 0, 0, time.UTC)), IsVertical: true, Style: lineStyle}, {Value: chart.TimeToFloat64(time.Date(2016, 8, 3, 9, 30, 0, 0, time.UTC))},
{Value: chart.TimeToFloat64(time.Date(2016, 8, 4, 9, 30, 0, 0, time.UTC)), IsVertical: true, Style: lineStyle}, {Value: chart.TimeToFloat64(time.Date(2016, 8, 4, 9, 30, 0, 0, time.UTC))},
{Value: chart.TimeToFloat64(time.Date(2016, 8, 5, 9, 30, 0, 0, time.UTC)), IsVertical: true, Style: lineStyle}, {Value: chart.TimeToFloat64(time.Date(2016, 8, 5, 9, 30, 0, 0, time.UTC))},
{Value: chart.TimeToFloat64(time.Date(2016, 8, 6, 9, 30, 0, 0, time.UTC)), IsVertical: true, Style: lineStyle}, {Value: chart.TimeToFloat64(time.Date(2016, 8, 6, 9, 30, 0, 0, time.UTC))},
} }
} }
@ -103,15 +98,17 @@ func drawChart(res http.ResponseWriter, req *http.Request) {
XAxis: chart.XAxis{ XAxis: chart.XAxis{
Style: chart.StyleShow(), Style: chart.StyleShow(),
ValueFormatter: chart.TimeHourValueFormatter, ValueFormatter: chart.TimeHourValueFormatter,
GridMajorStyle: chart.StyleShow(), GridMajorStyle: chart.Style{
GridLines: releases(), Show: true,
StrokeColor: chart.ColorAlternateGray,
StrokeWidth: 1.0,
},
GridLines: releases(),
}, },
Series: []chart.Series{ Series: []chart.Series{
mainSeries, mainSeries,
minSeries, minSeries,
maxSeries, maxSeries,
chart.LastValueAnnotation(minSeries),
chart.LastValueAnnotation(maxSeries),
linreg, linreg,
chart.LastValueAnnotation(linreg), chart.LastValueAnnotation(linreg),
sma, sma,