mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Legend/GraphNG: Refactoring legend types and options (#29067)
* Legend/GraphNG: Refactoring legend types and options * Rename label * Minor update * Fixed legend placement crash issue * remove unused * Minor tweaks and fixes
This commit is contained in:
@@ -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',
|
||||
.addRadio({
|
||||
path: 'legend.displayMode',
|
||||
name: 'Legend mode',
|
||||
description: '',
|
||||
defaultValue: true,
|
||||
})
|
||||
.addBooleanSwitch({
|
||||
category: ['Legend'],
|
||||
path: 'legend.asTable',
|
||||
name: 'Display legend as table',
|
||||
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,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user