Import

Constructors

Properties

PropertyModifiersTypeDescription
angularPanelCtrlanyLegacy angular ctrl. If this exists it will be used instead of the panel
PanelPluginDataSupport
defaults{} | null
ComponentClass<PanelEditorProps<TOptions>>
fieldConfigDefaultsFieldConfigSource<TFieldConfigOptions>
FieldConfigOptionsRegistry
noPaddingboolean
PanelMigrationHandler<TOptions>
onPanelTypeChangedPanelTypeChangedHandler<TOptions>
PanelOptionEditorsRegistry
panelComponentType<PanelProps<TOptions>> | null

Methods

MethodModifiersDescription
Tells Grafana if the plugin should subscribe to annotation and alertState results.
setDefaults(defaults)
setMigrationHandler(handler)This function is called before the panel first loads if the current version is different than the version that was saved.This is a good place to support any changes to the options model
setPanelChangeHandler(handler)This function is called when the visualization was changed. This passes in the panel model for previous visualisation options inspection and panel model updates.This is useful for supporting PanelModel API updates when changing between Angular and React panels.
Enables panel options editor creation
useFieldConfig(config)Allows specifying which standard field config options panel should use and defining default values

Constructs a new instance of the PanelPlugin class

Signature

    Parameters

    angularPanelCtrl property

    Legacy angular ctrl. If this exists it will be used instead of the panel

    Signature

    1. angularPanelCtrl?: any;

    dataSupport property

    Signature

    1. dataSupport: PanelPluginDataSupport;

    defaults property

    Signature

    1. get defaults(): {} | null;

    editor property

    Signature

    1. editor?: ComponentClass<PanelEditorProps<TOptions>>;

    fieldConfigDefaults property

    Signature

    1. get fieldConfigDefaults(): FieldConfigSource<TFieldConfigOptions>;

    Signature

    noPadding property

    Signature

    1. noPadding?: boolean;

    onPanelMigration property

    Signature

    1. onPanelMigration?: PanelMigrationHandler<TOptions>;

    onPanelTypeChanged property

    Signature

    1. onPanelTypeChanged?: PanelTypeChangedHandler<TOptions>;

    optionEditors property

    Signature

    1. get optionEditors(): PanelOptionEditorsRegistry;

    panel property

    1. panel: ComponentType<PanelProps<TOptions>> | null;

    Tells Grafana if the plugin should subscribe to annotation and alertState results.

    Signature

    1. setDataSupport(support: Partial<PanelPluginDataSupport>): this;

    Parameters

    ParameterTypeDescription
    support

    Returns:

    this

    1. import { ShapePanel } from './ShapePanel';
    2. interface ShapePanelOptions {}
    3. export const plugin = new PanelPlugin<ShapePanelOptions>(ShapePanel)
    4. .useFieldConfig({})
    5. ...
    6. ...
    7. .setDataSupport({
    8. annotations: true,
    9. alertStates: true,
    10. });

    setDefaults method

    Signature

    Parameters

    ParameterTypeDescription
    defaultsTOptions

    Returns:

    this

    setEditor method

    Signature

      Parameters

      Returns:

      this

      setMigrationHandler method

      This function is called before the panel first loads if the current version is different than the version that was saved.

      This is a good place to support any changes to the options model

      Signature

      1. setMigrationHandler(handler: PanelMigrationHandler<TOptions>): this;

      Parameters

      ParameterTypeDescription
      handlerPanelMigrationHandler<TOptions>

      Returns:

      setNoPadding method

      Signature

      1. setNoPadding(): this;

      Returns:

      this

      setPanelChangeHandler method

      This function is called when the visualization was changed. This passes in the panel model for previous visualisation options inspection and panel model updates.

      This is useful for supporting PanelModel API updates when changing between Angular and React panels.

      Signature

      1. setPanelChangeHandler(handler: PanelTypeChangedHandler): this;

      Parameters

      ParameterTypeDescription
      handlerPanelTypeChangedHandler

      Returns:

      Enables panel options editor creation

      Signature

      1. setPanelOptions(builder: (builder: PanelOptionsEditorBuilder<TOptions>) => void): this;

      Parameters

      Returns:

      this

      1. import { ShapePanel } from './ShapePanel';
      2. interface ShapePanelOptions {}
      3. export const plugin = new PanelPlugin<ShapePanelOptions>(ShapePanel)
      4. .setPanelOptions(builder => {
      5. builder
      6. .addSelect({
      7. id: 'shape',
      8. name: 'Shape',
      9. description: 'Select shape to render'
      10. settings: {
      11. options: [
      12. {value: 'circle', label: 'Circle' },
      13. {value: 'square', label: 'Square },
      14. {value: 'triangle', label: 'Triangle }
      15. ]
      16. },
      17. })

      useFieldConfig method

      Allows specifying which standard field config options panel should use and defining default values

      Signature

      1. useFieldConfig(config?: SetFieldConfigOptionsArgs<TFieldConfigOptions>): this;

      Parameters

      ParameterTypeDescription
      configSetFieldConfigOptionsArgs<TFieldConfigOptions>

      Returns: