/*
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 << Color Cells( clr, rows)コラムメッセージです。 このメッセージは、テーブル列の属性に格納されます。 また、ジャーナリング時にセルの色が維持されます。
スクリプトと結果の両方が下に表示されます。 別の方法 (より直接的かもしれません) は、各グループ (年齢) の一意のキーを取得し、各年齢の行を取得してから、色を選択して各列の行に適用することです。
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;
