Skip to content

Commit

Permalink
Added axisSoftMin and axisSoftMax options to TimeSeries (#617)
Browse files Browse the repository at this point in the history
* added axisSoftMin and axisSoftMax to TimeSeries

* Update CHANGELOG.rst

---------

Co-authored-by: JamesGibo <[email protected]>
  • Loading branch information
DP3t3r and JamesGibo authored Aug 18, 2023
1 parent 1fa5421 commit b0d81c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Changelog
* Extended SqlTarget to support parsing queries from files
* Fix AlertCondition backwards compatibility (``useNewAlerts`` default to ``False``)
* Added RateMetricAgg_ for ElasticSearch
* added axisSoftMin and axisSoftMax options for TimeSeries
* Added support for Azure Data Explorer datasource plugin (https://github.com/grafana/azure-data-explorer-datasource)

.. _`Bar_Chart`: https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/bar-chart/
Expand Down
6 changes: 6 additions & 0 deletions grafanalib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2222,6 +2222,8 @@ class TimeSeries(Panel):
:param valueMin: Minimum value for Panel
:param valueMax: Maximum value for Panel
:param valueDecimals: Number of display decimals
:param axisSoftMin: soft minimum Y axis value
:param axisSoftMax: soft maximum Y axis value
"""

axisPlacement = attr.ib(default='auto', validator=instance_of(str))
Expand Down Expand Up @@ -2278,6 +2280,8 @@ class TimeSeries(Panel):
valueMin = attr.ib(default=None, validator=attr.validators.optional(instance_of(int)))
valueMax = attr.ib(default=None, validator=attr.validators.optional(instance_of(int)))
valueDecimals = attr.ib(default=None, validator=attr.validators.optional(instance_of(int)))
axisSoftMin = attr.ib(default=None, validator=attr.validators.optional(instance_of(int)))
axisSoftMax = attr.ib(default=None, validator=attr.validators.optional(instance_of(int)))

def to_json_data(self):
return self.panel_json(
Expand Down Expand Up @@ -2312,6 +2316,8 @@ def to_json_data(self):
'thresholdsStyle': {
'mode': self.thresholdsStyleMode
},
'axisSoftMin': self.axisSoftMin,
'axisSoftMax': self.axisSoftMax
},
'mappings': self.mappings,
"min": self.valueMin,
Expand Down

0 comments on commit b0d81c9

Please sign in to comment.