mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TimeSeries: Replace fieldName with fieldIndex (#19030)
This commit is contained in:
parent
c66a23ea31
commit
0607189ed5
@ -77,11 +77,8 @@ export default class TimeSeries {
|
||||
id: string;
|
||||
// Represents index of original data frame in the quey response
|
||||
dataFrameIndex: number;
|
||||
/**
|
||||
* Name of the field the time series was created from
|
||||
* Used in graph panel to retrieve value from the original data frame
|
||||
*/
|
||||
fieldName: string;
|
||||
// Represents index of field in the data frame
|
||||
fieldIndex: number;
|
||||
label: string;
|
||||
alias: string;
|
||||
aliasEscaped: string;
|
||||
@ -122,8 +119,8 @@ export default class TimeSeries {
|
||||
this.stats = {};
|
||||
this.legend = true;
|
||||
this.unit = opts.unit;
|
||||
this.fieldName = opts.fieldName;
|
||||
this.dataFrameIndex = opts.dataFrameIndex;
|
||||
this.fieldIndex = opts.fieldIndex;
|
||||
this.hasMsResolution = this.isMsResolutionNeeded();
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,8 @@ export class DataProcessor {
|
||||
}
|
||||
|
||||
const seriesName = series.name ? series.name : series.refId;
|
||||
for (const field of series.fields) {
|
||||
for (let j = 0; j < series.fields.length; j++) {
|
||||
const field = series.fields[j];
|
||||
if (field.type !== FieldType.number) {
|
||||
continue;
|
||||
}
|
||||
@ -43,8 +44,7 @@ export class DataProcessor {
|
||||
for (let r = 0; r < series.length; r++) {
|
||||
datapoints.push([field.values.get(r), timeField.values.get(r)]);
|
||||
}
|
||||
|
||||
list.push(this.toTimeSeries(field, name, i, datapoints, list.length, range));
|
||||
list.push(this.toTimeSeries(field, name, i, j, datapoints, list.length, range));
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +65,7 @@ export class DataProcessor {
|
||||
field: Field,
|
||||
alias: string,
|
||||
dataFrameIndex: number,
|
||||
fieldIndex: number,
|
||||
datapoints: any[][],
|
||||
index: number,
|
||||
range?: TimeRange
|
||||
@ -77,8 +78,8 @@ export class DataProcessor {
|
||||
alias: alias,
|
||||
color: getColorFromHexRgbOrName(color, config.theme.type),
|
||||
unit: field.config ? field.config.unit : undefined,
|
||||
fieldName: field.name,
|
||||
dataFrameIndex,
|
||||
fieldIndex,
|
||||
});
|
||||
|
||||
if (datapoints && datapoints.length > 0 && range) {
|
||||
|
@ -24,7 +24,7 @@ Array [
|
||||
1003,
|
||||
],
|
||||
],
|
||||
"fieldName": "Value",
|
||||
"fieldIndex": 0,
|
||||
"hasMsResolution": false,
|
||||
"id": "Value",
|
||||
"label": "Value",
|
||||
@ -55,7 +55,7 @@ Array [
|
||||
1003,
|
||||
],
|
||||
],
|
||||
"fieldName": "v1",
|
||||
"fieldIndex": 1,
|
||||
"hasMsResolution": false,
|
||||
"id": "table_data v1",
|
||||
"label": "table_data v1",
|
||||
@ -86,7 +86,7 @@ Array [
|
||||
1003,
|
||||
],
|
||||
],
|
||||
"fieldName": "v2",
|
||||
"fieldIndex": 2,
|
||||
"hasMsResolution": false,
|
||||
"id": "table_data v2",
|
||||
"label": "table_data v2",
|
||||
@ -117,7 +117,7 @@ Array [
|
||||
1003,
|
||||
],
|
||||
],
|
||||
"fieldName": "v1",
|
||||
"fieldIndex": 0,
|
||||
"hasMsResolution": false,
|
||||
"id": "series v1",
|
||||
"label": "series v1",
|
||||
@ -148,7 +148,7 @@ Array [
|
||||
1003,
|
||||
],
|
||||
],
|
||||
"fieldName": "v2",
|
||||
"fieldIndex": 1,
|
||||
"hasMsResolution": false,
|
||||
"id": "series v2",
|
||||
"label": "series v2",
|
||||
@ -232,7 +232,7 @@ Array [
|
||||
1003,
|
||||
],
|
||||
],
|
||||
"fieldName": "Value",
|
||||
"fieldIndex": 0,
|
||||
"hasMsResolution": false,
|
||||
"id": "Value",
|
||||
"label": "Value",
|
||||
|
Loading…
Reference in New Issue
Block a user