Commit a3b581a5 by kay delaney Committed by GitHub

Chore: More robust identification of time/value fields in makeSeriesForLogs (#23392)

* Chore: More robust identification of time/value fields in makeSeriesForLogs
parent 2f7ba215
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment