PanelPlugin.useFieldConfig does not behave as expected

Hi everybody,

I am trying to use standard panel plugin configuration in a custom plugin (Grafana 8.3.1). The .setPanelOptions(builder => ...) way shown in the tutorial works fine, but I need standard settings as well (specifically the ValueMapper). So I tried to invoke (based on the tutorial primer)

export const plugin = new PanelPlugin<SimpleOptions>(SimplePanel).useFieldConfig({
standardOptions: [FieldConfigProperty.Mappings],
});

but it did not work this way: (1) I expected only mappings to be shown, but instead all standard settings are there; (2) the settings are not passed as options to the panel. The only thing I see is {"seriesCountSize":"sm","showSeriesCount":false,"text":"Default value of text input option"}

What is missing?

What Grafana version is your plugin targeting? Specifying standardOptions as an array has been deprecated in recent versions.

In recent versions (I believe since Grafana 7.3), standard options now accepts an object, like this:

standardOptions: {
  [FieldConfigProperty.Decimals]: {
    defaultValue: 3
  }
}

If you could point to where you saw standardOptions accepting an array, I’ll make sure that it gets updated.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.