/*
After save dt into Journal, the cell color from data data table was changed into the font color in the journal
*/
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Color by Column( :age);
Wait( 0 );
dt << Color Rows by Row State;
dt<<SAVE></SAVE>
어떤 버전의 JMP를 사용하고 있나요?이 스크립트를 사용하셨나요, 아니면 수정된 스크립트를 사용하셨나요? 수정된 경우 첨부해주세요.
테이블 메시지 dt << 행 상태별로 행 색상 지정() "보기"진술인 것 같습니다. 테이블 보기는 변경되지만 테이블을 저장하고 열거나 저널링을 하면 색상이 지정된 셀이 유지되지 않습니다.해당 테이블을 저널링하면 행 상태 색상과 일치하는 테이블 글꼴 색상으로 저널에 보고서가 생성됩니다.
하지만, col << 색상 셀( clr, 행) 열 메시지입니다. 이 메시지는 테이블 열의 속성에 저장됩니다. 저널링 시에도 셀 색상이 유지됩니다.
아래에는 스크립트와 결과가 모두 표시됩니다. 또 다른 방법(더 직접적일 수 있음)은 각 그룹(연령)에 대한 고유 키를 가져오고 각 연령에 대한 행을 가져온 다음 색상을 선택하고 이를 각 열의 해당 행에 적용하는 것입니다.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Color by Column( :age );
Wait( 0 );
//This next command does not save the cell colors.
//dt << Color Rows by Row State;
dt << Clear column selection();
dt << clear select;
//get the unique colors
nr = N Row( dt );
//make a list the size of the table to get the row colors and locate rows of a given color
_clr = As List( J( nr, 1, 0 ) );
For( i = 1, i <= N Row( dt ), i++,
_clr[i] = Color To RGB( Color Of( Row State( i ) ) )
);
//creates a list of unique colors
clr_keys = Associative Array( _clr ) << get keys;
//for each color (j), locate which rows are assigned that color using Loc( _clr, ...)
For( j = 1, j <= N Items( clr_keys ), j++,
idx = Loc( _clr, clr_keys[j] );
//Color the cells in rows idx and each coloumn
For( i = 1, i <= N Col( dt ), i++,
Column( dt, i ) << color cells( RGB Color( clr_keys[j] ), idx )
);
);
//now journal the table
dt << journal;
