Hi there,
Can we assign default thresholds by the plugin function useFieldConfig? I tried but didn’t work.
I found if I assign FieldConfigProperty.Thresholds in standardOptions, the UI will only display Threshold editor. Not sure if it is possible to configure default threshold in custom panel plugin
Bump. Ran into the same issue the other day. useFieldConfig won’t let me change default settings for Thresholds, but it does allow to add arbitrary values. For example this configuration will not have any effect whatsoever:
.useFieldConfig(
{
standardOptions: {
[FieldConfigProperty.Thresholds]: {
defaultValue: {
mode: ThresholdsMode.Absolute,
steps: [
{
color: “green”,
value: -1000,
},
{
color: “red”,
value: 1,
}
],
}
},
}
}
)
but if you specify any other field in the default value object, it will be available. It looks like mode and steps fields are read-only. I have no problem changing other properties (Decimals for example). Package versions in the package.json:
“@grafana/data”: “10.3.3”,
“@grafana/runtime”: “10.3.3”,
“@grafana/schema”: “10.3.3”,
“@grafana/ui”: “10.3.3”,