mirror of
https://github.com/grafana/grafana.git
synced 2025-01-16 11:42:35 -06:00
Cleans up piechart options (#33375)
Cuts thresholds Cuts display all values
This commit is contained in:
parent
45fa5fdf48
commit
83d24b5aee
@ -1,13 +1,13 @@
|
||||
import { FieldColorModeId, FieldConfigProperty, PanelPlugin } from '@grafana/data';
|
||||
import { FieldColorModeId, FieldConfigProperty, PanelPlugin, ReducerID, standardEditorsRegistry } from '@grafana/data';
|
||||
import { PieChartPanel } from './PieChartPanel';
|
||||
import { PieChartOptions } from './types';
|
||||
import { addStandardDataReduceOptions } from '../stat/types';
|
||||
import { LegendDisplayMode, PieChartType, PieChartLabels, PieChartLegendValues } from '@grafana/ui';
|
||||
import { PieChartPanelChangedHandler } from './migrations';
|
||||
|
||||
export const plugin = new PanelPlugin<PieChartOptions>(PieChartPanel)
|
||||
.setPanelChangeHandler(PieChartPanelChangedHandler)
|
||||
.useFieldConfig({
|
||||
disableStandardOptions: [FieldConfigProperty.Thresholds],
|
||||
standardOptions: {
|
||||
[FieldConfigProperty.Color]: {
|
||||
settings: {
|
||||
@ -22,9 +22,17 @@ export const plugin = new PanelPlugin<PieChartOptions>(PieChartPanel)
|
||||
},
|
||||
})
|
||||
.setPanelOptions((builder) => {
|
||||
addStandardDataReduceOptions(builder);
|
||||
|
||||
builder
|
||||
.addCustomEditor({
|
||||
id: 'reduceOptions.calcs',
|
||||
path: 'reduceOptions.calcs',
|
||||
name: 'Calculation',
|
||||
description: 'Choose a reducer function / calculation',
|
||||
editor: standardEditorsRegistry.get('stats-picker').editor as any,
|
||||
defaultValue: [ReducerID.lastNotNull],
|
||||
// Hides it when all values mode is on
|
||||
showIf: (currentConfig) => currentConfig.reduceOptions.values === false,
|
||||
})
|
||||
.addRadio({
|
||||
name: 'Piechart type',
|
||||
description: 'How the piechart should be rendered',
|
||||
|
Loading…
Reference in New Issue
Block a user