Add tooltip customization support
This is important for stacked graphs so that the tooltip can show individual, rather than cumulative values (which makes the most sense for our node graphs). Also, sort the elements in the schema. I think keeping them all in order makes more sense than required/optional sections. Change-Id: Ie542dc4d0e151a00e84cc970c2cfa8c02377d7bf
This commit is contained in:
parent
36682378fc
commit
cdc1df0e27
@ -85,23 +85,31 @@ class Graph(Base):
|
||||
y_formats = [y_format]
|
||||
|
||||
null_point_modes = v.Any('connected', 'null', 'null as zero')
|
||||
value_types = v.Any('individual', 'cumulative')
|
||||
|
||||
tooltip = {
|
||||
v.Required('query_as_alias', default=True): v.All(bool),
|
||||
v.Required('shared', default=True): v.All(bool),
|
||||
v.Required('value_type', default='cumulative'): v.All(value_types),
|
||||
}
|
||||
|
||||
graph = {
|
||||
v.Required('bars', default=False): v.All(bool),
|
||||
v.Required('fill', default=1): v.All(int),
|
||||
v.Optional('leftYAxisLabel'): v.All(str, v.Length(min=1)),
|
||||
v.Required('lines', default=True): v.All(bool),
|
||||
v.Required('linewidth', default=2): v.All(int),
|
||||
v.Optional('nullPointMode'): v.All(null_point_modes),
|
||||
v.Required('percentage', default=False): v.All(bool),
|
||||
v.Required('pointradius', default=5): v.All(int),
|
||||
v.Required('points', default=False): v.All(bool),
|
||||
v.Optional('rightYAxisLabel'): v.All(str, v.Length(min=1)),
|
||||
v.Required('stack', default=False): v.All(bool),
|
||||
v.Required('steppedLine', default=False): v.All(bool),
|
||||
v.Required('targets', default=[]): v.All(list),
|
||||
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('nullPointMode'): v.All(null_point_modes),
|
||||
v.Optional('leftYAxisLabel'): v.All(str, v.Length(min=1)),
|
||||
v.Optional('rightYAxisLabel'): v.All(str, v.Length(min=1)),
|
||||
v.Optional('y_formats'): v.All(y_formats, v.Length(min=2, max=2)),
|
||||
}
|
||||
graph.update(self.base)
|
||||
|
43
tests/schema/fixtures/dashboard-0012.json
Normal file
43
tests/schema/fixtures/dashboard-0012.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"dashboard": {
|
||||
"new-dashboard": {
|
||||
"rows": [
|
||||
{
|
||||
"collapse": false,
|
||||
"editable": true,
|
||||
"height": "250px",
|
||||
"panels": [
|
||||
{
|
||||
"bars": false,
|
||||
"editable": true,
|
||||
"error": false,
|
||||
"fill": 1,
|
||||
"lines": true,
|
||||
"linewidth": 2,
|
||||
"percentage": false,
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"span": 12,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [],
|
||||
"title": "no title (click here)",
|
||||
"tooltip": {
|
||||
"query_as_alias": true,
|
||||
"shared": true,
|
||||
"value_type": "individual"
|
||||
},
|
||||
"type": "graph",
|
||||
"x-axis": true,
|
||||
"y-axis": true
|
||||
}
|
||||
],
|
||||
"showTitle": false,
|
||||
"title": "New row"
|
||||
}
|
||||
],
|
||||
"timezone": "utc",
|
||||
"title": "New dashboard"
|
||||
}
|
||||
}
|
||||
}
|
12
tests/schema/fixtures/dashboard-0012.yaml
Normal file
12
tests/schema/fixtures/dashboard-0012.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
dashboard:
|
||||
title: New dashboard
|
||||
rows:
|
||||
- title: New row
|
||||
height: 250px
|
||||
panels:
|
||||
- title: no title (click here)
|
||||
type: graph
|
||||
tooltip:
|
||||
value_type: individual
|
Loading…
x
Reference in New Issue
Block a user