[v9.3.x] StateTimeline: Show correct legend label when value mappings set (#62312)

StateTimeline: Show correct legend label when value mappings set (#62282)

* StateTimeline: Show correct legend label when value mappings set

* Add test dashboard for thresholds and value mappings

* run stripnulls.sh

(cherry picked from commit 846acd28ff)

Co-authored-by: Victor Marin <36818606+mdvictor@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2023-01-27 14:53:45 +00:00
committed by GitHub
co-authored by Victor Marin
parent 12ddd7294a
commit 6e8be826ba
@@ -522,9 +522,10 @@ export function getFieldLegendItem(fields: Field[], theme: GrafanaTheme2): VizLe
const items: VizLegendItem[] = [];
const fieldConfig = fields[0].config;
const colorMode = fieldConfig.color?.mode ?? FieldColorModeId.Fixed;
const thresholds = fieldConfig.thresholds;
// If thresholds are enabled show each step in the legend
if (colorMode === FieldColorModeId.Thresholds) {
if (colorMode === FieldColorModeId.Thresholds && thresholds?.steps && thresholds.steps.length > 1) {
return getThresholdItems(fieldConfig, theme);
}