|
|
|
|
@ -1,10 +1,9 @@ |
|
|
|
|
import { FieldColorModeId, FieldConfigProperty, PanelPlugin } from '@grafana/data'; |
|
|
|
|
import { AxisSide, GraphCustomFieldConfig } from '@grafana/ui'; |
|
|
|
|
import { AxisSide, GraphCustomFieldConfig, LegendDisplayMode } from '@grafana/ui'; |
|
|
|
|
import { GraphPanel } from './GraphPanel'; |
|
|
|
|
import { Options } from './types'; |
|
|
|
|
|
|
|
|
|
export const plugin = new PanelPlugin<Options, GraphCustomFieldConfig>(GraphPanel) |
|
|
|
|
.setNoPadding() |
|
|
|
|
.useFieldConfig({ |
|
|
|
|
standardOptions: { |
|
|
|
|
[FieldConfigProperty.Color]: { |
|
|
|
|
@ -133,29 +132,26 @@ export const plugin = new PanelPlugin<Options, GraphCustomFieldConfig>(GraphPane |
|
|
|
|
defaultValue: 'single', |
|
|
|
|
settings: { |
|
|
|
|
options: [ |
|
|
|
|
{ value: 'single', label: 'Single series' }, |
|
|
|
|
{ value: 'multi', label: 'All series' }, |
|
|
|
|
{ value: 'none', label: 'No tooltip' }, |
|
|
|
|
{ value: 'single', label: 'Single' }, |
|
|
|
|
{ value: 'multi', label: 'All' }, |
|
|
|
|
{ value: 'none', label: 'Hidden' }, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
.addBooleanSwitch({ |
|
|
|
|
category: ['Legend'], |
|
|
|
|
path: 'legend.isVisible', |
|
|
|
|
name: 'Show legend', |
|
|
|
|
description: '', |
|
|
|
|
defaultValue: true, |
|
|
|
|
}) |
|
|
|
|
.addBooleanSwitch({ |
|
|
|
|
category: ['Legend'], |
|
|
|
|
path: 'legend.asTable', |
|
|
|
|
name: 'Display legend as table', |
|
|
|
|
.addRadio({ |
|
|
|
|
path: 'legend.displayMode', |
|
|
|
|
name: 'Legend mode', |
|
|
|
|
description: '', |
|
|
|
|
defaultValue: false, |
|
|
|
|
showIf: c => c.legend.isVisible, |
|
|
|
|
defaultValue: LegendDisplayMode.List, |
|
|
|
|
settings: { |
|
|
|
|
options: [ |
|
|
|
|
{ value: LegendDisplayMode.List, label: 'List' }, |
|
|
|
|
{ value: LegendDisplayMode.Table, label: 'Table' }, |
|
|
|
|
{ value: LegendDisplayMode.Hidden, label: 'Hidden' }, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
.addRadio({ |
|
|
|
|
category: ['Legend'], |
|
|
|
|
path: 'legend.placement', |
|
|
|
|
name: 'Legend placement', |
|
|
|
|
description: '', |
|
|
|
|
@ -166,6 +162,6 @@ export const plugin = new PanelPlugin<Options, GraphCustomFieldConfig>(GraphPane |
|
|
|
|
{ value: 'right', label: 'Right' }, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
showIf: c => c.legend.isVisible, |
|
|
|
|
showIf: c => c.legend.displayMode !== LegendDisplayMode.Hidden, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|