Trend: Fix x field matching logic (#72862)

This commit is contained in:
Nathan Marrs 2023-08-04 19:12:51 +02:00 committed by GitHub
parent 92e7829e7a
commit 9328febbab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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