From f3479aad2b434611a759094b48f4bc06abe6448a Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Tue, 28 Sep 2021 03:51:14 -0400 Subject: [PATCH] Add orientation prop to Gauge panel (#39682) (#39698) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 0bb426ec336b83a4429150976cb3e4be80e61f9f) Co-authored-by: Torkel Ödegaard --- public/app/plugins/panel/gauge/GaugePanel.tsx | 7 ++++--- public/app/plugins/panel/gauge/module.tsx | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/public/app/plugins/panel/gauge/GaugePanel.tsx b/public/app/plugins/panel/gauge/GaugePanel.tsx index 54a09983a3c..950ae77e762 100644 --- a/public/app/plugins/panel/gauge/GaugePanel.tsx +++ b/public/app/plugins/panel/gauge/GaugePanel.tsx @@ -1,5 +1,5 @@ import React, { PureComponent } from 'react'; -import { FieldDisplay, getFieldDisplayValues, PanelProps, VizOrientation } from '@grafana/data'; +import { FieldDisplay, getFieldDisplayValues, PanelProps } from '@grafana/data'; import { DataLinksContextMenu, Gauge, VizRepeater, VizRepeaterRenderValueProps } from '@grafana/ui'; import { DataLinksContextMenuApi } from '@grafana/ui/src/components/DataLinks/DataLinksContextMenu'; @@ -63,7 +63,8 @@ export class GaugePanel extends PureComponent> { }; render() { - const { height, width, data, renderCounter } = this.props; + const { height, width, data, renderCounter, options } = this.props; + return ( > { source={data} autoGrid={true} renderCounter={renderCounter} - orientation={VizOrientation.Auto} + orientation={options.orientation} /> ); } diff --git a/public/app/plugins/panel/gauge/module.tsx b/public/app/plugins/panel/gauge/module.tsx index cecedb65132..5658c9d4569 100644 --- a/public/app/plugins/panel/gauge/module.tsx +++ b/public/app/plugins/panel/gauge/module.tsx @@ -1,7 +1,7 @@ import { PanelPlugin } from '@grafana/data'; import { GaugePanel } from './GaugePanel'; import { GaugeOptions } from './types'; -import { addStandardDataReduceOptions } from '../stat/types'; +import { addOrientationOption, addStandardDataReduceOptions } from '../stat/types'; import { gaugePanelMigrationHandler, gaugePanelChangedHandler } from './GaugeMigrations'; import { commonOptionsBuilder } from '@grafana/ui'; @@ -9,6 +9,7 @@ export const plugin = new PanelPlugin(GaugePanel) .useFieldConfig() .setPanelOptions((builder) => { addStandardDataReduceOptions(builder); + addOrientationOption(builder); builder .addBooleanSwitch({