嗨,
我的目標是找到某些列,將它們分組,然後將它們堆疊到一個新的數據表(每個組分別)中,然後使用圖形構建器使用Label作為X並將組名稱作為Y軸繪製每個組。
分組和堆疊工作正常,但是,我發現很難確定如何使用組名作為軸並將圖形構建器繪圖合併到更大的循環中。 我已經從社區的各種討論中審閱並獲取了部分代碼。
如果我用已知的列名替換組名,我只得到圖構建器,顯然不是我正在尋找的圖。
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;