mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
@@ -29,8 +29,7 @@ export const TrendPanel = ({
|
||||
const { dataLinkPostProcessor } = usePanelContext();
|
||||
// Need to fallback to first number field if no xField is set in options otherwise panel crashes 😬
|
||||
const trendXFieldName =
|
||||
options.xField ?? data.series[0].fields.find((field) => field.type === FieldType.number)?.name;
|
||||
|
||||
options.xField ?? data.series[0]?.fields.find((field) => field.type === FieldType.number)?.name;
|
||||
const preparePlotFrameTimeless = (frames: DataFrame[], dimFields: XYFieldMatchers, timeRange?: TimeRange | null) => {
|
||||
dimFields = {
|
||||
...dimFields,
|
||||
@@ -61,7 +60,7 @@ export const TrendPanel = ({
|
||||
} else {
|
||||
// first number field
|
||||
// Perhaps we can/should support any ordinal rather than an error here
|
||||
xFieldIdx = frames[0].fields.findIndex((f) => f.type === FieldType.number);
|
||||
xFieldIdx = frames[0] ? frames[0].fields.findIndex((f) => f.type === FieldType.number) : -1;
|
||||
if (xFieldIdx === -1) {
|
||||
return {
|
||||
warning: 'No numeric fields found for X axis',
|
||||
|
||||
Reference in New Issue
Block a user