diff --git a/public/app/plugins/panel/piechart/module.tsx b/public/app/plugins/panel/piechart/module.tsx index a9d542cafc5..3408e524b0c 100644 --- a/public/app/plugins/panel/piechart/module.tsx +++ b/public/app/plugins/panel/piechart/module.tsx @@ -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(PieChartPanel) .setPanelChangeHandler(PieChartPanelChangedHandler) .useFieldConfig({ + disableStandardOptions: [FieldConfigProperty.Thresholds], standardOptions: { [FieldConfigProperty.Color]: { settings: { @@ -22,9 +22,17 @@ export const plugin = new PanelPlugin(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',