mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -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;
|
||||
|
||||
/**
|
||||
* @internal -- keep any pre-cached state.displayName
|
||||
*/
|
||||
keepDisplayNames?: boolean;
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
a.push(field.values);
|
||||
originalFields.push(field);
|
||||
if (!options.keepDisplayNames) {
|
||||
// clear field displayName state
|
||||
delete field.state?.displayName;
|
||||
}
|
||||
// store frame field order for tabular data join
|
||||
frameFieldsOrder.push(fieldsOrder);
|
||||
fieldsOrder++;
|
||||
|
@ -110,6 +110,11 @@ export function preparePlotFrame(frames: DataFrame[], dimFields: XYFieldMatchers
|
||||
joinBy: dimFields.x,
|
||||
keep: dimFields.y,
|
||||
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) {
|
||||
|
@ -21,6 +21,7 @@ import {
|
||||
getFieldConfigWithMinMax,
|
||||
ThresholdsMode,
|
||||
TimeRange,
|
||||
cacheFieldDisplayNames,
|
||||
} from '@grafana/data';
|
||||
import { maybeSortFrame } from '@grafana/data/src/transformations/transformers/joinDataFrames';
|
||||
import { applyNullInsertThreshold } from '@grafana/data/src/transformations/transformers/nulls/nullInsertThreshold';
|
||||
@ -437,6 +438,9 @@ export function prepareTimelineFields(
|
||||
if (!series?.length) {
|
||||
return { warn: 'No data in response' };
|
||||
}
|
||||
|
||||
cacheFieldDisplayNames(series);
|
||||
|
||||
let hasTimeseries = false;
|
||||
const frames: DataFrame[] = [];
|
||||
|
||||
|
@ -10,6 +10,7 @@ import {
|
||||
isBooleanUnit,
|
||||
SortedVector,
|
||||
TimeRange,
|
||||
cacheFieldDisplayNames,
|
||||
} from '@grafana/data';
|
||||
import { convertFieldType } from '@grafana/data/src/transformations/transformers/convertFieldType';
|
||||
import { applyNullInsertThreshold } from '@grafana/data/src/transformations/transformers/nulls/nullInsertThreshold';
|
||||
@ -82,6 +83,8 @@ export function prepareGraphableFields(
|
||||
return null;
|
||||
}
|
||||
|
||||
cacheFieldDisplayNames(series);
|
||||
|
||||
let useNumericX = xNumFieldIdx != null;
|
||||
|
||||
// Make sure the numeric x field is first in the frame
|
||||
|
Loading…
Reference in New Issue
Block a user