From 9328febbabef7009bb84374a0bdbddef4d59b5ce Mon Sep 17 00:00:00 2001 From: Nathan Marrs Date: Fri, 4 Aug 2023 19:12:51 +0200 Subject: [PATCH] Trend: Fix x field matching logic (#72862) --- public/app/plugins/panel/trend/TrendPanel.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/public/app/plugins/panel/trend/TrendPanel.tsx b/public/app/plugins/panel/trend/TrendPanel.tsx index 541c72a0cb0..1241485acc1 100644 --- a/public/app/plugins/panel/trend/TrendPanel.tsx +++ b/public/app/plugins/panel/trend/TrendPanel.tsx @@ -1,6 +1,6 @@ import React, { useMemo } from 'react'; -import { DataFrame, FieldType, getFieldDisplayName, PanelProps, TimeRange } from '@grafana/data'; +import { DataFrame, FieldMatcherID, fieldMatchers, FieldType, PanelProps, TimeRange } from '@grafana/data'; import { isLikelyAscendingVector } from '@grafana/data/src/transformations/transformers/joinDataFrames'; import { config, PanelDataErrorView } from '@grafana/runtime'; import { @@ -38,9 +38,7 @@ export const TrendPanel = ({ const preparePlotFrameTimeless = (frames: DataFrame[], dimFields: XYFieldMatchers, timeRange?: TimeRange | null) => { dimFields = { ...dimFields, - x: (field, frame, frames) => { - return getFieldDisplayName(field, frame, frames) === trendXFieldName; - }, + x: fieldMatchers.get(FieldMatcherID.byName).get(trendXFieldName), }; return preparePlotFrame(frames, dimFields);