import React from 'react'; import { LegendOptions, PanelOptionsGroup, Switch, Input, StatsPicker } from '@grafana/ui'; export interface GraphLegendEditorLegendOptions extends LegendOptions { stats?: string[]; decimals?: number; sortBy?: string; sortDesc?: boolean; } interface GraphLegendEditorProps { options: GraphLegendEditorLegendOptions; onChange: (options: GraphLegendEditorLegendOptions) => void; } export const GraphLegendEditor: React.FunctionComponent = props => { const { options, onChange } = props; const onStatsChanged = (stats: string[]) => { onChange({ ...options, stats, }); }; const onOptionToggle = (option: keyof LegendOptions) => (event?: React.SyntheticEvent) => { const newOption = {}; if (!event) { return; } // TODO: fix the ignores // @ts-ignore newOption[option] = event.target.checked; if (option === 'placement') { // @ts-ignore newOption[option] = event.target.checked ? 'right' : 'under'; } onChange({ ...options, ...newOption, }); }; const labelWidth = 8; return (

Options

Show

Decimals
{ onChange({ ...options, decimals: parseInt(event.target.value, 10), }); }} />

Hidden series

{/* */}
); };