tweaks
This commit is contained in:
parent
2c9a9218e5
commit
046daf94fb
6 changed files with 13 additions and 8 deletions
|
|
@ -23,7 +23,7 @@ func parseFloat64(str string) float64 {
|
|||
func readData() ([]time.Time, []float64) {
|
||||
var xvalues []time.Time
|
||||
var yvalues []float64
|
||||
chart.File.ReadByLines("requests.csv", func(line string) {
|
||||
err := chart.File.ReadByLines("requests.csv", func(line string) {
|
||||
parts := strings.Split(line, ",")
|
||||
year := parseInt(parts[0])
|
||||
month := parseInt(parts[1])
|
||||
|
|
@ -33,6 +33,9 @@ func readData() ([]time.Time, []float64) {
|
|||
xvalues = append(xvalues, time.Date(year, time.Month(month), day, hour, 0, 0, 0, time.UTC))
|
||||
yvalues = append(yvalues, elapsedMillis)
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return xvalues, yvalues
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/wcharczuk/go-chart"
|
||||
"github.com/wcharczuk/go-chart/drawing"
|
||||
)
|
||||
|
||||
func drawChart(res http.ResponseWriter, req *http.Request) {
|
||||
|
|
@ -17,7 +16,6 @@ func drawChart(res http.ResponseWriter, req *http.Request) {
|
|||
Show: true,
|
||||
StrokeWidth: chart.Disabled,
|
||||
DotWidth: 3,
|
||||
DotColor: drawing.ColorRed,
|
||||
},
|
||||
XValues: chart.Sequence.Random(32, 1024),
|
||||
YValues: chart.Sequence.Random(32, 1024),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue