mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
VizTooltips: Fix series labels after zooming (#82985)
This commit is contained in:
parent
a02519895e
commit
94a274635b
@ -56,6 +56,11 @@ export interface JoinOptions {
|
|||||||
*/
|
*/
|
||||||
keepOriginIndices?: boolean;
|
keepOriginIndices?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal -- keep any pre-cached state.displayName
|
||||||
|
*/
|
||||||
|
keepDisplayNames?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal -- Optionally specify a join mode (outer or inner)
|
* @internal -- Optionally specify a join mode (outer or inner)
|
||||||
*/
|
*/
|
||||||
@ -223,8 +228,10 @@ export function joinDataFrames(options: JoinOptions): DataFrame | undefined {
|
|||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
a.push(field.values);
|
a.push(field.values);
|
||||||
originalFields.push(field);
|
originalFields.push(field);
|
||||||
// clear field displayName state
|
if (!options.keepDisplayNames) {
|
||||||
delete field.state?.displayName;
|
// clear field displayName state
|
||||||
|
delete field.state?.displayName;
|
||||||
|
}
|
||||||
// store frame field order for tabular data join
|
// store frame field order for tabular data join
|
||||||
frameFieldsOrder.push(fieldsOrder);
|
frameFieldsOrder.push(fieldsOrder);
|
||||||
fieldsOrder++;
|
fieldsOrder++;
|
||||||
|
@ -110,6 +110,11 @@ export function preparePlotFrame(frames: DataFrame[], dimFields: XYFieldMatchers
|
|||||||
joinBy: dimFields.x,
|
joinBy: dimFields.x,
|
||||||
keep: dimFields.y,
|
keep: dimFields.y,
|
||||||
keepOriginIndices: true,
|
keepOriginIndices: true,
|
||||||
|
|
||||||
|
// the join transformer force-deletes our state.displayName cache unless keepDisplayNames: true
|
||||||
|
// https://github.com/grafana/grafana/pull/31121
|
||||||
|
// https://github.com/grafana/grafana/pull/71806
|
||||||
|
keepDisplayNames: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (alignedFrame) {
|
if (alignedFrame) {
|
||||||
|
@ -21,6 +21,7 @@ import {
|
|||||||
getFieldConfigWithMinMax,
|
getFieldConfigWithMinMax,
|
||||||
ThresholdsMode,
|
ThresholdsMode,
|
||||||
TimeRange,
|
TimeRange,
|
||||||
|
cacheFieldDisplayNames,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { maybeSortFrame } from '@grafana/data/src/transformations/transformers/joinDataFrames';
|
import { maybeSortFrame } from '@grafana/data/src/transformations/transformers/joinDataFrames';
|
||||||
import { applyNullInsertThreshold } from '@grafana/data/src/transformations/transformers/nulls/nullInsertThreshold';
|
import { applyNullInsertThreshold } from '@grafana/data/src/transformations/transformers/nulls/nullInsertThreshold';
|
||||||
@ -437,6 +438,9 @@ export function prepareTimelineFields(
|
|||||||
if (!series?.length) {
|
if (!series?.length) {
|
||||||
return { warn: 'No data in response' };
|
return { warn: 'No data in response' };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cacheFieldDisplayNames(series);
|
||||||
|
|
||||||
let hasTimeseries = false;
|
let hasTimeseries = false;
|
||||||
const frames: DataFrame[] = [];
|
const frames: DataFrame[] = [];
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
isBooleanUnit,
|
isBooleanUnit,
|
||||||
SortedVector,
|
SortedVector,
|
||||||
TimeRange,
|
TimeRange,
|
||||||
|
cacheFieldDisplayNames,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { convertFieldType } from '@grafana/data/src/transformations/transformers/convertFieldType';
|
import { convertFieldType } from '@grafana/data/src/transformations/transformers/convertFieldType';
|
||||||
import { applyNullInsertThreshold } from '@grafana/data/src/transformations/transformers/nulls/nullInsertThreshold';
|
import { applyNullInsertThreshold } from '@grafana/data/src/transformations/transformers/nulls/nullInsertThreshold';
|
||||||
@ -82,6 +83,8 @@ export function prepareGraphableFields(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cacheFieldDisplayNames(series);
|
||||||
|
|
||||||
let useNumericX = xNumFieldIdx != null;
|
let useNumericX = xNumFieldIdx != null;
|
||||||
|
|
||||||
// Make sure the numeric x field is first in the frame
|
// Make sure the numeric x field is first in the frame
|
||||||
|
Loading…
Reference in New Issue
Block a user