diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8aa74ed8..1fbbe8fd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,7 @@ Changelog .. _`docs`: https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/manage-dashboard-links/#dashboard-links * Added ... +* Add Unit option for Graph panel * Added Minimum option for Timeseries * Added Maximum option for Timeseries * Added Number of decimals displays option for Timeseries diff --git a/grafanalib/core.py b/grafanalib/core.py index cf7826a1..e1d68890 100644 --- a/grafanalib/core.py +++ b/grafanalib/core.py @@ -2104,7 +2104,7 @@ class Graph(Panel): :param stack: Each series is stacked on top of another :param percentage: Available when Stack is selected. Each series is drawn as a percentage of the total of all series :param thresholds: List of GraphThresholds - Only valid when alert not defined - + :param unit: Set Y Axis Unit """ alert = attr.ib(default=None) @@ -2138,6 +2138,7 @@ class Graph(Panel): validator=instance_of(Tooltip), ) thresholds = attr.ib(default=attr.Factory(list)) + unit = attr.ib(default='', validator=instance_of(str)) xAxis = attr.ib(default=attr.Factory(XAxis), validator=instance_of(XAxis)) try: yAxes = attr.ib( @@ -2157,6 +2158,11 @@ def to_json_data(self): 'aliasColors': self.aliasColors, 'bars': self.bars, 'error': self.error, + 'fieldConfig': { + 'defaults': { + 'unit': self.unit + }, + }, 'fill': self.fill, 'grid': self.grid, 'isNew': self.isNew,