Import

Constructors

Properties

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

Methods

MethodModifiersDescription
hasPluginId(pluginId)
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

    ParameterTypeDescription
    panelComponentType<PanelProps<TOptions>> | null

    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(): {};

    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>;

    panel property

    Signature

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

    hasPluginId method

    Signature

    1. hasPluginId(pluginId: string): boolean;

    Returns:

    boolean

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

    Signature

    Parameters

    ParameterTypeDescription
    supportPartial<PanelPluginDataSupport>

    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

      ParameterTypeDescription
      editorComponentClass<PanelEditorProps<TOptions>>

      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

      this

      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
      handler

      Returns:

      this

      Enables panel options editor creation

      Signature

      1. setPanelOptions(builder: PanelOptionsSupplier<TOptions>): this;

      Parameters

      ParameterTypeDescription
      builderPanelOptionsSupplier<TOptions>

      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
      config

      Returns: