Cleanup the code a bit.
This commit is contained in:
parent
13dbd6f3e6
commit
e17004c9d3
1 changed files with 5 additions and 12 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
// Usage: http://localhost:8080?series=100&values=1000
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -15,28 +16,20 @@ func random(min, max float64) float64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func drawLargeChart(res http.ResponseWriter, r *http.Request) {
|
func drawLargeChart(res http.ResponseWriter, r *http.Request) {
|
||||||
/*
|
numSeriesInt64, err := strconv.ParseInt(r.FormValue("series"), 10, 64)
|
||||||
Usage: http://localhost:8080?series=100&values=1000
|
|
||||||
*/
|
|
||||||
|
|
||||||
numSeriesString := r.FormValue("series")
|
|
||||||
|
|
||||||
numSeriesInt64, err := strconv.ParseInt(numSeriesString, 10, 64)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
numSeriesInt64 = int64(1)
|
numSeriesInt64 = int64(1)
|
||||||
}
|
}
|
||||||
numSeries := int(numSeriesInt64)
|
numSeries := int(numSeriesInt64)
|
||||||
|
|
||||||
series := make([]chart.Series, numSeries)
|
numValuesInt64, err := strconv.ParseInt(r.FormValue("values"), 10, 64)
|
||||||
|
|
||||||
numValuesString := r.FormValue("values")
|
|
||||||
|
|
||||||
numValuesInt64, err := strconv.ParseInt(numValuesString, 10, 64)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
numValuesInt64 = int64(100)
|
numValuesInt64 = int64(100)
|
||||||
}
|
}
|
||||||
numValues := int(numValuesInt64)
|
numValues := int(numValuesInt64)
|
||||||
|
|
||||||
|
series := make([]chart.Series, numSeries)
|
||||||
|
|
||||||
for i := 0; i < numSeries; i++ {
|
for i := 0; i < numSeries; i++ {
|
||||||
xValues := make([]time.Time, numValues)
|
xValues := make([]time.Time, numValues)
|
||||||
yValues := make([]float64, numValues)
|
yValues := make([]float64, numValues)
|
||||||
|
|
Loading…
Reference in a new issue