Add orientation prop to Gauge panel (#39682)

This commit is contained in:
Torkel Ödegaard 2021-09-28 08:21:46 +02:00 committed by GitHub
parent 9a178e7ba9
commit 0bb426ec33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -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}
/>
);
}

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({