mirror of
https://github.com/grafana/grafana.git
synced 2025-09-23 13:54:04 +08:00

* Fix panel option bugs and make tooltip options work * Support multiple series in explicit mode. Rename XY/Explicit to Auto/Manual * Fixes * Fix * Legend improvements * Rewrite Pure Component to Function Component * Add datalinks support * Legend fixes and CR modifications * Fix bugs that crash panel
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { PanelPlugin } from '@grafana/data';
|
|
import { commonOptionsBuilder } from '@grafana/ui';
|
|
|
|
import { AutoEditor } from './AutoEditor';
|
|
import { ManualEditor } from './ManualEditor';
|
|
import { XYChartPanel2 } from './XYChartPanel2';
|
|
import { getScatterFieldConfig } from './config';
|
|
import { defaultScatterConfig, XYChartOptions, ScatterFieldConfig } from './models.gen';
|
|
|
|
export const plugin = new PanelPlugin<XYChartOptions, ScatterFieldConfig>(XYChartPanel2)
|
|
.useFieldConfig(getScatterFieldConfig(defaultScatterConfig))
|
|
.setPanelOptions((builder) => {
|
|
builder
|
|
.addRadio({
|
|
path: 'mode',
|
|
name: 'Mode',
|
|
defaultValue: 'auto',
|
|
settings: {
|
|
options: [
|
|
{ value: 'auto', label: 'Auto', description: 'No changes to saved model since 8.0' },
|
|
{ value: 'manual', label: 'Manual' },
|
|
],
|
|
},
|
|
})
|
|
.addCustomEditor({
|
|
id: 'xyPlotConfig',
|
|
path: 'dims',
|
|
name: '',
|
|
editor: AutoEditor,
|
|
showIf: (cfg) => cfg.mode === 'auto',
|
|
})
|
|
.addCustomEditor({
|
|
id: 'series',
|
|
path: 'series',
|
|
name: '',
|
|
defaultValue: [],
|
|
editor: ManualEditor,
|
|
showIf: (cfg) => cfg.mode === 'manual',
|
|
});
|
|
|
|
commonOptionsBuilder.addTooltipOptions(builder);
|
|
commonOptionsBuilder.addLegendOptions(builder);
|
|
});
|