mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 07:32:13 +08:00
Chore: Export closestIdx function from @grafana/data (#76176)
* export calculateFieldDisplayName function * export closestIdx function * Use getFieldDisplayName
This commit is contained in:
@ -8,4 +8,4 @@ export * from './ArrayDataFrame';
|
||||
export * from './DataFrameJSON';
|
||||
export * from './frameComparisons';
|
||||
export { anySeriesWithTimeField, isTimeSeriesFrame, isTimeSeriesFrames } from './utils';
|
||||
export { StreamingDataFrame, StreamingFrameAction, type StreamingFrameOptions } from './StreamingDataFrame';
|
||||
export { StreamingDataFrame, StreamingFrameAction, type StreamingFrameOptions, closestIdx } from './StreamingDataFrame';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { closestIdx } from '@grafana/data/src/dataframe/StreamingDataFrame';
|
||||
import { closestIdx } from '@grafana/data';
|
||||
|
||||
export type Table = [times: number[], ...values: any[][]];
|
||||
|
||||
|
@ -14,13 +14,13 @@ import {
|
||||
FieldType,
|
||||
formatLabels,
|
||||
getDisplayProcessor,
|
||||
getFieldDisplayName,
|
||||
Labels,
|
||||
renderLegendFormat,
|
||||
ScopedVars,
|
||||
TIME_SERIES_TIME_FIELD_NAME,
|
||||
TIME_SERIES_VALUE_FIELD_NAME,
|
||||
renderLegendFormat,
|
||||
} from '@grafana/data';
|
||||
import { calculateFieldDisplayName } from '@grafana/data/src/field/fieldState';
|
||||
import { config, FetchResponse, getDataSourceSrv, getTemplateSrv } from '@grafana/runtime';
|
||||
|
||||
import {
|
||||
@ -79,7 +79,7 @@ export function transformV2(
|
||||
f.fields.forEach((field) => {
|
||||
if (field.labels?.__name__ && field.labels?.__name__ === field.name) {
|
||||
const fieldCopy = { ...field, name: TIME_SERIES_VALUE_FIELD_NAME };
|
||||
field.config.displayNameFromDS = calculateFieldDisplayName(fieldCopy, f, response.data);
|
||||
field.config.displayNameFromDS = getFieldDisplayName(fieldCopy, f, response.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user