Merge "Add yaxes format for newer versions of Grafana"

This commit is contained in:
Zuul 2018-02-09 14:11:40 +00:00 committed by Gerrit Code Review
commit 1f7fcdd161
3 changed files with 84 additions and 3 deletions

View File

@ -81,8 +81,17 @@ class Graph(Base):
u'pressurehg',
u'pressurepsi',
)
y_formats = [y_format]
yaxes_format = [
{
v.Optional('decimals'): int,
v.Optional('format', default='short'): y_format,
v.Optional('label', default=''): v.All(str),
v.Optional('logBase', default=1): v.All(int, v.Range(min=1)),
v.Optional('max'): v.All(int, v.Range(min=1)),
v.Optional('min'): v.All(int, v.Range(min=1)),
v.Optional('show', default=True): v.All(bool),
}
]
legend = {
v.Optional('alignAsTable', default=False): v.All(bool),
@ -149,7 +158,8 @@ class Graph(Base):
v.Optional('tooltip'): v.All(tooltip),
v.Required('x-axis', default=True): v.All(bool),
v.Required('y-axis', default=True): v.All(bool),
v.Optional('y_formats'): v.All(y_formats, v.Length(min=2, max=2)),
v.Optional('y_formats'): v.All([y_format], v.Length(min=2, max=2)),
v.Optional('yaxes'): v.All(yaxes_format, v.Length(min=2, max=2)),
}
graph.update(self.base)
return v.Schema(graph)

View File

@ -0,0 +1,58 @@
{
"dashboard": {
"new-dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"bars": false,
"editable": true,
"error": false,
"fill": 1,
"leftYAxisLabel": "left label",
"lines": true,
"linewidth": 2,
"percentage": false,
"pointradius": 5,
"points": false,
"rightYAxisLabel": "right label",
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [],
"title": "no title (click here)",
"type": "graph",
"x-axis": true,
"y-axis": true,
"yaxes": [
{
"format": "hertz",
"label": "",
"logBase": 1,
"show": true
},
{
"format": "\u00b5s",
"label": "",
"logBase": 1,
"show": true
}
]
}
],
"showTitle": false,
"title": "New row"
}
],
"templating": {
"enabled": false,
"list": []
},
"timezone": "utc",
"title": "New dashboard"
}
}
}

View File

@ -0,0 +1,13 @@
dashboard:
title: New dashboard
rows:
- title: New row
height: 250px
panels:
- title: no title (click here)
type: graph
leftYAxisLabel: left label
rightYAxisLabel: right label
yaxes:
- format: hertz
- format: µs