From ad5f1c953b7ec08f139a3e53f30ceb358850b777 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Thu, 23 Jul 2020 11:00:19 -0700 Subject: [PATCH] Graph: support setting field units (#26529) --- public/app/plugins/panel/graph/axes_editor.html | 5 ++++- public/app/plugins/panel/graph/module.ts | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/panel/graph/axes_editor.html b/public/app/plugins/panel/graph/axes_editor.html index 5dba3d0a87f..fe2541eb627 100644 --- a/public/app/plugins/panel/graph/axes_editor.html +++ b/public/app/plugins/panel/graph/axes_editor.html @@ -13,7 +13,10 @@
- +
diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index de7a863dcb8..9821720218e 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -305,6 +305,7 @@ export class GraphCtrl extends MetricsPanelCtrl { for (const series of this.seriesList) { series.applySeriesOverrides(this.panel.seriesOverrides); + // Always use the configured field unit if (series.unit) { this.panel.yaxes[series.yaxis - 1].format = series.unit; } @@ -378,6 +379,7 @@ export const plugin = new PanelPlugin(null) .useFieldConfig({ standardOptions: [ FieldConfigProperty.DisplayName, + FieldConfigProperty.Unit, FieldConfigProperty.Links, // previously saved as dataLinks on options ], })