「値の色」プロパティの作成実際の色を指定せずに、データ テーブル列の一連の値の色を作成するスクリプトを作成するにはどうすればよいですか?
選択した列に関連付けられた「値の色」プロパティを見つけることを期待しているアプリケーションがあり、そのプロパティが存在しない場合はクラッシュするため、私は尋ねています。 実際の色は無関係なので、自分で定義する必要はありません。なれ値の色プロパティ。
問題の列を右クリックし、プロパティのリストから [値の色] を選択するだけで、対話的にこれを非常に簡単に行うことができます。これにより、既定のセットが自動的に定義されます。 基本的にこの操作なので、スクリプトを作成する必要があります。解決策は 1 行のコードで済むと思いますが、残念ながらそれが見えません。 誰でも助けることができますか?
Re: 「Value Colors」プロパティの作成完全!得ようとするよりも専門家に尋ねる方が常に良いそれ一種の建設権:)
どうもありがとう、ジム!
Re: 「Value Colors」プロパティの作成ExprList が正しく構築されていません。計算値ではなく、リテラル値をリストに含める必要があります。これを実現する1つの方法を次に示します
// Start of script;
Names Default To Here( 1 );
Clear Log();
dt = Open( "$SAMPLE_DATA/Big Class.JMP" );
Summarize( NamesList = by( :Name ) );
Show( NamesList );
// Build the ExprLIst to be exactly what the Value Colors
// list needs to be
ExprList = {};
For( i = 1, i <= N Items( NamesList ), i++,
Eval(
Substitute(
Expr(
Insert Into( ExprList, Expr( __Names__ = __color__ ) )
),
Expr( __Names__ ), NamesList[i],
Expr( __color__ ), 2 + i
)
)
);
Show( ExprList );
// Then insert the resulting expression as the Value Colors property of the :Names column, and I should get what I want.
:Name << set property( "Value Colors", ExprList );
// The Value Colors property is correct;
Show( :Name << get property( "Value Colors" ) );Re: 「Value Colors」プロパティの作成Peter と CWillden の助けに感謝します。残念ながら、私はまだそこにいません - しかし、私は問題を少し具体化することができました.添付のスクリプトは、私が今どこにいるのかを示しています。値の色プロパティに入力できる式のリストを作成する方法に関する最後の困難を解決できれば、必要なものを取得できるはずです。
// Start of script;
clear log();
dt = Open( "$SAMPLE_DATA/Big Class.JMP" );
// The Value Colors property of the first column is initially empty;
show(:Name << get property("Value Colors"));
/*
I now want to create a Value Colors property for this column,
but I'd prefer to do it without having to identify all the names
beforehand if possible. Try CWillden's suggestion...
*/
:Name << set property("Value Colors", {});
// If I now try to color the cells by value, it DOES actually seem to have worked;
:Name << color cell by value(1);
// But the Value Colors property STILL only contains an empty list;
show(:Name << get property("Value Colors"));
/*
Unfortunately I do actually need a populated list - and it looks like I can't do it
without extracting the names explicity. Here's one way I think I COULD do it...
*/
summarize(NamesList=by(:Name));
show(NamesList);
/*
I now need to put those names into a list of expressions that follow the syntax
shown in PMRoz's post, and use that list to define the Value Colors property I need.
This next bit is WRONG - but you can see what I'm trying to do here.
What I need inside ExprList is a list of names, each coupled with an integer from 3 onwards
(to get some colors starting at red). I suspect I should probably be using the Substitute
and/or Eval Expr functions at this point, but I can't get the correct syntax.
*/
ExprList = {};
for(i=1, i<=nItems(NamesList), i++,
insert into(ExprList, expr(NamesList[i] = (2+i)))
);
show(ExprList);
// Then insert the resulting expression as the Value Colors property of the :Names column, and I should get what I want.
:Name << set property("Value Colors", ExprList);
// End of script.Re: 「Value Colors」プロパティの作成これを行う列に BS 値の色のプロパティを入れることができました。
:Column 1 << Set Property("Value Colors",{});ただし、より堅牢に動作するようにアプリケーションを更新する必要があるようです。奇妙な要件。
Re: 「Value Colors」プロパティの作成次のように JSL を使用できます。
column(dt, "Column 1") << Set Property( "Value Colors", {2 = 45, 3 = 46, 4 = 47} );
これを見分ける方法は、
1. 単一の数値列を持つ小さなダミー テーブルを作成します。
2. 手動で値の色属性
3. テーブル名の横にある小さな赤い三角形をクリックして、テーブル スクリプトのコピー
4. JSL スクリプト ウィンドウを開き、結果のコードを貼り付けます。
次のようになります。
New Table( "Untitled 14",
Add Rows( 3 ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Property( "Value Colors", {1 = -13977687, 2 = -3780931, 3 = -4222943} ),
Set Selected,
Set Values( [1, 2, 3] )
)
);