Ciao,
Il mio obiettivo è trovare determinate colonne, raggrupparle e quindi impilarle in una nuova tabella di dati (ciascun gruppo separatamente) e quindi tracciare ciascun gruppo utilizzando il generatore di diagrammi utilizzando l'etichetta come X e il nome del gruppo come asse Y.
Il raggruppamento e l'impilamento funzionano bene, tuttavia, trovo difficile determinare come utilizzare il nome del gruppo come asse e incorporare il grafico che costruisce il disegno nel ciclo più grande. Ho esaminato e preso alcune parti del codice qui da varie discussioni nella comunità.
Se sostituisco il nome del gruppo con un nome di colonna noto, ottengo solo il generatore di grafici e ovviamente non la trama che sto cercando.
Names Default To Here( 1 );
dt = Current Data Table();
start = Tick Seconds();
// Columns
list = List();
dt = Current Data Table();
list << Get Column Names();
col_names = dt << get column names( string );
number_columns = N Cols( dt );
dt << Reorder By Name;
// Containing Keyword Column Grouping
// Empty list to be populated with found columns
found_list = {};
// Name of the groups based on the keyword that I'll look for later
keyword_group_list = {"Ahh", "Now" };
// Loop over columns and create groups
For( i = 1, i <= N Items( keyword_group_list ), i++,
// Empty list to be populated with found columns. Get's emptied for every new group/ keyword.
found_list = {};
one_group = keyword_group_list[i];
// Loop over all column names, looking for ones that start with "Ahh", "Now", etc from keyword_group_list
// Once found put into array "found_list"
For( k = 1, k <= N Items( col_names ), k++,
If( Starts With( col_names[k], one_group ),
Insert Into( found_list, col_names[k] )
);
// Move each column group to the front in original data table
dt << Move Column Group( To First, one_group );
);
If( N Items( found_list ) > 0,
dt << group columns( one_group, found_list );
Wait( 0.25 );
stkdata = dt << Stack(
columns( dt << get column group( one_group ) ),
Keep(
:DEVICE_NAME,
:OTHER_INFO
),
Wait( 1.5 ),
Invisible,
Output Table( "Stacked " || one_group ),
/*stkdatatable = Current Data Table(),
Wait( 1.5 ),*/
/*
stkdatatable << Graph Builder(
Variables( X( :Label ), Y( :one_group ) ),
Elements( Points( X, Y, Legend( 3 ) ) )
),*/
);
);
);
end = Tick Seconds();
runtime = end - start;
Puoi fornire una tabella di dati di esempio per questo script?