mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: More robust identification of time/value fields in makeSeriesForLogs (#23392)
* Chore: More robust identification of time/value fields in makeSeriesForLogs
This commit is contained in:
parent
2f7ba21593
commit
a3b581a5f3
@ -136,30 +136,30 @@ export function makeSeriesForLogs(rows: LogRowModel[], intervalMs: number, timeZ
|
||||
}
|
||||
|
||||
return seriesList.map((series, i) => {
|
||||
series.datapoints.sort((a: number[], b: number[]) => {
|
||||
return a[1] - b[1];
|
||||
});
|
||||
series.datapoints.sort((a: number[], b: number[]) => a[1] - b[1]);
|
||||
|
||||
// EEEP: converts GraphSeriesXY to DataFrame and back again!
|
||||
const data = toDataFrame(series);
|
||||
const points = getFlotPairs({
|
||||
xField: data.fields[1],
|
||||
yField: data.fields[0],
|
||||
nullValueMode: NullValueMode.Null,
|
||||
});
|
||||
const fieldCache = new FieldCache(data);
|
||||
|
||||
const timeField = data.fields[1];
|
||||
const timeField = fieldCache.getFirstFieldOfType(FieldType.time);
|
||||
timeField.display = getDisplayProcessor({
|
||||
field: timeField,
|
||||
timeZone,
|
||||
});
|
||||
|
||||
const valueField = data.fields[0];
|
||||
const valueField = fieldCache.getFirstFieldOfType(FieldType.number);
|
||||
valueField.config = {
|
||||
...valueField.config,
|
||||
color: series.color,
|
||||
};
|
||||
|
||||
const points = getFlotPairs({
|
||||
xField: timeField,
|
||||
yField: valueField,
|
||||
nullValueMode: NullValueMode.Null,
|
||||
});
|
||||
|
||||
const graphSeries: GraphSeriesXY = {
|
||||
color: series.color,
|
||||
label: series.alias,
|
||||
|
Loading…
Reference in New Issue
Block a user