From b0d81c97b2e8980c4bb5d2b155a31a7b0a47cedb Mon Sep 17 00:00:00 2001 From: Peter Darvasi <142215070+DP3t3r@users.noreply.github.com> Date: Fri, 18 Aug 2023 16:36:17 +0200 Subject: [PATCH] Added axisSoftMin and axisSoftMax options to TimeSeries (#617) * added axisSoftMin and axisSoftMax to TimeSeries * Update CHANGELOG.rst --------- Co-authored-by: JamesGibo <22477854+JamesGibo@users.noreply.github.com> --- CHANGELOG.rst | 1 + grafanalib/core.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0bd49d96..af9c2c7d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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/ diff --git a/grafanalib/core.py b/grafanalib/core.py index 42465d06..037ef7c1 100644 --- a/grafanalib/core.py +++ b/grafanalib/core.py @@ -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)) @@ -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( @@ -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,