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 (
"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
}
......
{
"revision": 4,
"revision": 5,
"title": "TestData - Graph Panel Last 1h",
"tags": [
"grafana-test"
......@@ -320,124 +320,376 @@
]
},
{
"title": "",
"error": false,
"span": 4,
"content": "Just verify that the tooltip time has millisecond resolution ",
"editable": true,
"type": "text",
"isNew": true,
"error": false,
"id": 6,
"isNew": true,
"links": [],
"mode": "markdown",
"content": "Just verify that the tooltip time has millisecond resolution ",
"links": []
"span": 4,
"title": "",
"type": "text"
}
],
"title": "New row"
},
{
"title": "New row",
"height": 336,
"editable": true,
"collapse": false,
"editable": true,
"height": 336,
"panels": [
{
"title": "2 yaxis and axis lables",
"error": false,
"span": 7.99561403508772,
"aliasColors": {},
"bars": false,
"datasource": "Grafana TestData",
"editable": true,
"type": "graph",
"isNew": true,
"error": false,
"fill": 1,
"id": 5,
"isNew": true,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "B-series",
"yaxis": 2
}
],
"span": 7.99561403508772,
"stack": false,
"steppedLine": false,
"targets": [
{
"target": "",
"refId": "A",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,90,30,5,0"
"stringInput": "1,20,90,30,5,0",
"target": ""
},
{
"target": "",
"refId": "B",
"scenarioId": "csv_metric_values",
"stringInput": "2000,3000,4000,1000,3000,10000"
"stringInput": "2000,3000,4000,1000,3000,10000",
"target": ""
}
],
"datasource": "Grafana TestData",
"renderer": "flot",
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "2 yaxis and axis lables",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "percent",
"label": "Perecent",
"show": true,
"logBase": 1,
"min": null,
"max": null,
"format": "percent"
"min": null,
"show": true
},
{
"format": "short",
"label": "Pressure",
"show": true,
"logBase": 1,
"min": null,
"max": null,
"format": "short"
"min": null,
"show": true
}
]
},
{
"content": "Verify that axis labels look ok",
"editable": true,
"error": false,
"id": 7,
"isNew": true,
"links": [],
"mode": "markdown",
"span": 4.00438596491228,
"title": "",
"type": "text"
}
],
"title": "New row"
},
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"aliasColors": {},
"bars": false,
"datasource": "Grafana TestData",
"editable": true,
"error": false,
"fill": 1,
"id": 8,
"isNew": true,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 4,
"stack": false,
"steppedLine": false,
"targets": [
{
"refId": "B",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,null,null,null,null,null,null,100,10,10,20,30,40,10",
"target": ""
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "null value connected",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"show": true,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"lines": true,
"fill": 1,
"linewidth": 2,
"points": false,
"pointradius": 5,
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"stack": false,
"percentage": false,
"datasource": "Grafana TestData",
"editable": true,
"error": false,
"fill": 1,
"id": 10,
"isNew": true,
"legend": {
"show": true,
"values": false,
"min": false,
"max": false,
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"avg": false
"values": false
},
"nullPointMode": "connected",
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "null as zero",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 3,
"stack": false,
"steppedLine": false,
"targets": [
{
"refId": "B",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,null,null,null,null,null,null,100,10,10,20,30,40,10",
"target": ""
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "null value null as zero",
"tooltip": {
"value_type": "cumulative",
"msResolution": false,
"shared": true,
"sort": 0,
"msResolution": false
"value_type": "cumulative"
},
"timeFrom": null,
"timeShift": null,
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"datasource": "Grafana TestData",
"editable": true,
"error": false,
"fill": 1,
"id": 9,
"isNew": true,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "B-series",
"yaxis": 2
"zindex": -3
}
],
"span": 5,
"stack": true,
"steppedLine": false,
"targets": [
{
"hide": false,
"refId": "B",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,null,null,null,null,null,null,100,10,10,20,30,40,10",
"target": ""
},
{
"alias": "",
"hide": false,
"refId": "A",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,90,30,5,10,20,30,40,40,40,100,10,20,20",
"target": ""
},
{
"alias": "",
"hide": false,
"refId": "C",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,90,30,5,10,20,30,40,40,40,100,10,20,20",
"target": ""
}
],
"thresholds": [],
"links": []
},
{
"title": "",
"error": false,
"span": 4.00438596491228,
"editable": true,
"type": "text",
"isNew": true,
"id": 7,
"mode": "markdown",
"content": "Verify that axis labels look ok",
"links": []
"timeFrom": null,
"timeShift": null,
"title": "Stacking value ontop of nulls",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
]
],
"title": "New row"
}
],
"time": {
......@@ -477,7 +729,7 @@
},
"refresh": false,
"schemaVersion": 13,
"version": 3,
"version": 13,
"links": [],
"gnetId": null
}
......@@ -9,7 +9,7 @@
"name": "Grafana Project",
"url": "http://grafana.org"
},
"version": "1.0.13",
"version": "1.0.14",
"updated": "2016-09-26"
},
......
......@@ -71,13 +71,9 @@
<div class="section gf-form-group">
<h5 class="section-heading">Stacking & Null value</h5>
<gf-form-switch class="gf-form"
label="Stack" label-class="width-7"
checked="ctrl.panel.stack" on-change="ctrl.render()">
<gf-form-switch class="gf-form" label="Stack" label-class="width-7" checked="ctrl.panel.stack" on-change="ctrl.render()">
</gf-form-switch>
<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()">
<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()">
</gf-form-switch>
<div class="gf-form">
<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