Skip to content

Commit b23ea7d

Browse files
authored
[CHORE] - support optional legend width attribute (#49)
1 parent 359e9e8 commit b23ea7d

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

grafana_dashboards/schema/panel/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class Base(object):
129129
v.Optional("sortBy"): str,
130130
v.Optional("sortDesc"): bool,
131131
v.Required("calcs", default=[]): [str],
132+
v.Optional("width"): int,
132133
},
133134
}
134135

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"dashboard": {
3+
"new-dashboard": {
4+
"rows": [
5+
{
6+
"collapse": false,
7+
"editable": true,
8+
"height": "250px",
9+
"panels": [
10+
{
11+
"bars": false,
12+
"datasource": "graphite",
13+
"editable": true,
14+
"error": false,
15+
"fill": 1,
16+
"options": {
17+
"legend": {
18+
"alignAsTable": true,
19+
"avg": true,
20+
"current": true,
21+
"max": true,
22+
"min": true,
23+
"rightSide": true,
24+
"show": true,
25+
"total": false,
26+
"values": true,
27+
"width": 350
28+
}
29+
},
30+
"lines": true,
31+
"linewidth": 1,
32+
"minSpan": 4,
33+
"percentage": false,
34+
"pointradius": 5,
35+
"points": false,
36+
"repeat": "$hostname",
37+
"span": 12,
38+
"stack": false,
39+
"steppedLine": false,
40+
"targets": [
41+
{
42+
"target": "$hostname.Cpu.cpu_prct_used"
43+
}
44+
],
45+
"thresholds": [],
46+
"title": "no title (click here)",
47+
"type": "graph",
48+
"x-axis": true,
49+
"y-axis": true
50+
}
51+
],
52+
"showTitle": false,
53+
"title": "New row"
54+
}
55+
],
56+
"templating": {
57+
"enabled": true,
58+
"list": [
59+
{
60+
"datasource": "graphite",
61+
"hide": 0,
62+
"includeAll": false,
63+
"label": "",
64+
"multi": false,
65+
"name": "hostname",
66+
"query": "node*",
67+
"refresh": 1,
68+
"type": "query"
69+
}
70+
]
71+
},
72+
"timezone": "utc",
73+
"title": "New dashboard"
74+
}
75+
}
76+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
dashboard:
2+
templating:
3+
- name: hostname
4+
type: query
5+
datasource: graphite
6+
query: node*
7+
refresh: 1
8+
hide: 0
9+
title: New dashboard
10+
rows:
11+
- title: New row
12+
height: 250px
13+
panels:
14+
- title: no title (click here)
15+
type: graph
16+
datasource: graphite
17+
minSpan: 4
18+
repeat: $hostname
19+
targets:
20+
- target: $hostname.Cpu.cpu_prct_used
21+
options:
22+
legend:
23+
alignAsTable: true
24+
avg: true
25+
current: true
26+
max: true
27+
min: true
28+
rightSide: true
29+
show: true
30+
total: false
31+
values: true
32+
width: 350

0 commit comments

Comments
 (0)