grafana/public/app/plugins/panel/trend/module.tsx
2023-04-04 20:52:20 -07:00

31 lines
1.0 KiB
TypeScript

import { PanelPlugin } from '@grafana/data';
import { commonOptionsBuilder } from '@grafana/ui';
import { defaultGraphConfig, getGraphFieldConfig } from '../timeseries/config';
import { TrendPanel } from './TrendPanel';
import { PanelFieldConfig, PanelOptions } from './panelcfg.gen';
import { TrendSuggestionsSupplier } from './suggestions';
export const plugin = new PanelPlugin<PanelOptions, PanelFieldConfig>(TrendPanel)
.useFieldConfig(getGraphFieldConfig(defaultGraphConfig))
.setPanelOptions((builder) => {
const category = ['X Axis'];
builder.addFieldNamePicker({
path: 'xField',
name: 'X Field',
description: 'An increasing numeric value',
category,
defaultValue: undefined,
settings: {
isClearable: true,
placeholderText: 'First numeric value',
},
});
commonOptionsBuilder.addTooltipOptions(builder);
commonOptionsBuilder.addLegendOptions(builder);
})
.setSuggestionsSupplier(new TrendSuggestionsSupplier());
//.setDataSupport({ annotations: true, alertStates: true });