Commit cc145227 by Torkel Ödegaard

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

parent bf4c3f3a
...@@ -6,6 +6,8 @@ import ( ...@@ -6,6 +6,8 @@ import (
"strings" "strings"
"time" "time"
"gopkg.in/guregu/null.v3"
"github.com/grafana/grafana/pkg/log" "github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/tsdb" "github.com/grafana/grafana/pkg/tsdb"
) )
...@@ -88,10 +90,13 @@ func init() { ...@@ -88,10 +90,13 @@ func init() {
queryRes := tsdb.NewQueryResult() queryRes := tsdb.NewQueryResult()
stringInput := query.Model.Get("stringInput").MustString() stringInput := query.Model.Get("stringInput").MustString()
values := []float64{} values := []null.Float{}
for _, strVal := range strings.Split(stringInput, ",") { for _, strVal := range strings.Split(stringInput, ",") {
if strVal == "null" {
values = append(values, null.FloatFromPtr(nil))
}
if val, err := strconv.ParseFloat(strVal, 64); err == 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() { ...@@ -105,7 +110,7 @@ func init() {
step := (endTime - startTime) / int64(len(values)-1) step := (endTime - startTime) / int64(len(values)-1)
for _, val := range values { 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 startTime += step
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"name": "Grafana Project", "name": "Grafana Project",
"url": "http://grafana.org" "url": "http://grafana.org"
}, },
"version": "1.0.13", "version": "1.0.14",
"updated": "2016-09-26" "updated": "2016-09-26"
}, },
......
...@@ -71,13 +71,9 @@ ...@@ -71,13 +71,9 @@
<div class="section gf-form-group"> <div class="section gf-form-group">
<h5 class="section-heading">Stacking & Null value</h5> <h5 class="section-heading">Stacking & Null value</h5>
<gf-form-switch class="gf-form" <gf-form-switch class="gf-form" label="Stack" label-class="width-7" checked="ctrl.panel.stack" on-change="ctrl.render()">
label="Stack" label-class="width-7"
checked="ctrl.panel.stack" on-change="ctrl.render()">
</gf-form-switch> </gf-form-switch>
<gf-form-switch class="gf-form" ng-show="ctrl.panel.stack" <gf-form-switch class="gf-form" ng-show="ctrl.panel.stack" label="Percent" label-class="width-7" checked="ctrl.panel.percentage" on-change="ctrl.render()">
label="Percent" label-class="width-7"
checked="ctrl.panel.percentage" on-change="ctrl.render()">
</gf-form-switch> </gf-form-switch>
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label width-7">Null value</label> <label class="gf-form-label width-7">Null value</label>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment