added testdata scenario for null data and stacking, also updated testdata dashbord, #2912

This commit is contained in:
Torkel Ödegaard
2016-10-06 10:53:42 +02:00
parent bf4c3f3ae6
commit cc1452277b
4 changed files with 357 additions and 104 deletions
+8 -3
View File
@@ -6,6 +6,8 @@ import (
"strings"
"time"
"gopkg.in/guregu/null.v3"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/tsdb"
)
@@ -88,10 +90,13 @@ func init() {
queryRes := tsdb.NewQueryResult()
stringInput := query.Model.Get("stringInput").MustString()
values := []float64{}
values := []null.Float{}
for _, strVal := range strings.Split(stringInput, ",") {
if strVal == "null" {
values = append(values, null.FloatFromPtr(nil))
}
if val, err := strconv.ParseFloat(strVal, 64); err == nil {
values = append(values, val)
values = append(values, null.FloatFrom(val))
}
}
@@ -105,7 +110,7 @@ func init() {
step := (endTime - startTime) / int64(len(values)-1)
for _, val := range values {
series.Points = append(series.Points, tsdb.NewTimePoint(val, float64(startTime)))
series.Points = append(series.Points, tsdb.TimePoint{val, null.FloatFrom(float64(startTime))})
startTime += step
}