Add orientation prop to Gauge panel (#39682) (#39698)

(cherry picked from commit 0bb426ec33)

Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
This commit is contained in:
Grot (@grafanabot)
2021-09-28 09:51:14 +02:00
committed by GitHub
co-authored by Torkel Ödegaard
parent 6c92beb7fe
commit f3479aad2b
2 changed files with 6 additions and 4 deletions
@@ -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<PanelProps<GaugeOptions>> {
};
render() {
const { height, width, data, renderCounter } = this.props;
const { height, width, data, renderCounter, options } = this.props;
return (
<VizRepeater
getValues={this.getValues}
@@ -73,7 +74,7 @@ export class GaugePanel extends PureComponent<PanelProps<GaugeOptions>> {
source={data}
autoGrid={true}
renderCounter={renderCounter}
orientation={VizOrientation.Auto}
orientation={options.orientation}
/>
);
}
+2 -1
View File
@@ -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<GaugeOptions>(GaugePanel)
.useFieldConfig()
.setPanelOptions((builder) => {
addStandardDataReduceOptions(builder);
addOrientationOption(builder);
builder
.addBooleanSwitch({