Skip to content

Commit b110aef

Browse files
alan-christopherAlan Christopher
andauthored
Add 'auto' to the list of accepted orientations for BarGauge. (#635)
Co-authored-by: Alan Christopher <alanchristopher@berkeley.edu>
1 parent 715cacd commit b110aef

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Changelog
3030
* Added unit parameter to the Table class in core
3131
* Added a hide parameter to ElasticsearchTarget
3232
* Fix value literal GAUGE_CALC_TOTAL to sum instead of total
33+
* Fix `BarGauge` orientation validation to accept `'auto'`
3334

3435
0.7.0 (2022-10-02)
3536
==================

grafanalib/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ def to_json_data(self):
289289

290290
ORIENTATION_HORIZONTAL = 'horizontal'
291291
ORIENTATION_VERTICAL = 'vertical'
292+
ORIENTATION_AUTO = 'auto'
292293

293294
GAUGE_DISPLAY_MODE_BASIC = 'basic'
294295
GAUGE_DISPLAY_MODE_LCD = 'lcd'
@@ -3371,7 +3372,9 @@ class BarGauge(Panel):
33713372
min = attr.ib(default=0)
33723373
orientation = attr.ib(
33733374
default=ORIENTATION_HORIZONTAL,
3374-
validator=in_([ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL]),
3375+
validator=in_([ORIENTATION_HORIZONTAL,
3376+
ORIENTATION_VERTICAL,
3377+
ORIENTATION_AUTO]),
33753378
)
33763379
rangeMaps = attr.ib(default=attr.Factory(list))
33773380
thresholdLabels = attr.ib(default=False, validator=instance_of(bool))

0 commit comments

Comments
 (0)