自定义列中的值颜色我有一个名为 Rejects 的数字列,它被设置为名义上的。 大多数值都是零,但也有从 1 到 N 的值范围(N 是可变的,具体取决于数据集)。 我用这些来绘制拒绝位置的地图,并用颜色表示拒绝数量。
我想利用 JMP 内置的彩色主题,但任何 0 值都以浅灰色显示(因此很容易看出哪里有拒绝)。 但是,我不能两者都做。
我试过:
dt:Rejects << Set Property( "Value Colors", Color Theme( "Jet" ) );
dt:Rejects << Set Property( "Value Colors", {0 = 32} );但第二个命令覆盖第一个并将颜色主题设置回默认值。 我可以通过设置颜色主题然后在列属性对话框中单击 0 的颜色来交互式地完成它,但我想编写脚本。
我可以将默认的分类颜色 threme 更改为 Jet,但我不想依赖它,而且我在报告的其他地方也只是其他颜色主题。 我也不想对颜色进行硬编码,因为无论 N 是 5 还是 25,我都想使用所有颜色(蓝色到红色)。
非常感谢您的帮助,
马修。
回复:自定义列中的值颜色谢谢伊恩,效果很好!
问候,
马修。
回复:自定义列中的值颜色也许是这样的?
NamesDefaultToHere(1);
// Make a table with defect counts
dt = NewTable("Defects", NewColumn("Rejects", Numeric, Ordinal, Formula(RandomInteger(0, 5))));
dt << addRows(30);
dt << runFormulas;
// Set some default colours . . .
dt:Rejects << Set Property( "Value Colors", Color Theme( "Jet" ) );
// Make a graph
gb = dt << Graph Builder(
Size( 529, 447 ),
Show Control Panel( 0 ),
Variables( X( :Rejects ), Color( :Rejects ) ),
Elements( Bar( X, Legend( 5 ) ) )
);
// Get the default colors
defaultColours = dt:Rejects << getProperty("Value Colors");
// Update the colour for 0 defects
Wait(2);
defaultColours[1] = Expr(0 = 32);
// Renistate updated colours
dt:Rejects << Set Property( "Value Colors", defaultColours);