example tweak.

This commit is contained in:
Will Charczuk 2017-02-03 10:47:48 -08:00
parent 7776c351a8
commit 3ea3c9ac10

View file

@ -1,6 +1,7 @@
package main package main
import ( import (
"fmt"
"net/http" "net/http"
"github.com/wcharczuk/go-chart" "github.com/wcharczuk/go-chart"
@ -19,6 +20,12 @@ func drawChart(res http.ResponseWriter, req *http.Request) {
Style: chart.Style{ Style: chart.Style{
Show: true, //enables / displays the x-axis Show: true, //enables / displays the x-axis
}, },
TickPosition: chart.TickPositionBetweenTicks,
ValueFormatter: func(v interface{}) string {
typed := v.(float64)
typedDate := chart.Time.FromFloat64(typed)
return fmt.Sprintf("%d-%d\n%d", typedDate.Month(), typedDate.Day(), typedDate.Year())
},
}, },
YAxis: chart.YAxis{ YAxis: chart.YAxis{
Style: chart.Style{ Style: chart.Style{