안녕하세요,
내 목표는 특정 열을 찾아서 그룹화 한 다음 새 데이터 테이블 (각 그룹을 따로 따로)에 쌓은 다음 레이블을 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;
이 스크립트에 대한 샘플 데이터 테이블을 제공 할 수 있습니까?