Transformations: Allow Timeseries to table transformation to handle multiple time series (#76801)
* Initial fix up of getLabelFields * Update time series to table code * Cleanup and allow merging * Support merge and non-merge scenarios * Update editor * Fix case with merge true for multiple queries * Update time series detection, fix tests * Remove spurious console.log * Prettier plus remove test console.log * Remove type assertion * Add options migration * Add type export * Sentence casing * Make sure current options are preserved when making changes * Add disabled image * DashboardMigrator prettier * Add type assertion explanation and exception * Fix schema version test * Prettier * Fix genAI tests and make them more robust so they dont break on every new schema version --------- Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
This commit is contained in:
co-authored by
nmarrs
parent
470d879c80
commit
71e3814c46
@@ -3,10 +3,16 @@ import { DataFrame, FieldType } from '../types/dataFrame';
|
||||
import { getTimeField } from './processDataFrame';
|
||||
|
||||
export function isTimeSeriesFrame(frame: DataFrame) {
|
||||
if (frame.fields.length > 2) {
|
||||
// If we have less than two frames we can't have a timeseries
|
||||
if (frame.fields.length < 2) {
|
||||
return false;
|
||||
}
|
||||
return Boolean(frame.fields.find((field) => field.type === FieldType.time));
|
||||
|
||||
// In order to have a time series we need a time field
|
||||
// and at least one number field
|
||||
const timeField = frame.fields.find((field) => field.type === FieldType.time);
|
||||
const numberField = frame.fields.find((field) => field.type === FieldType.number);
|
||||
return timeField !== undefined && numberField !== undefined;
|
||||
}
|
||||
|
||||
export function isTimeSeriesFrames(data: DataFrame[]) {
|
||||
|
||||
Reference in New Issue
Block a user