我在脚本中将备用行底纹设置为 1,并且数据表中的行以灰色阴影着色,我想将使用的颜色更改为两种蓝色阴影。 在 jsl 中编写此代码的最佳方法是什么?
你的问题有点稀疏。如果您要询问 TableBox() 那么我相信无法设置行的阴影颜色,只能设置默认灰色。如果您正在谈论 DataBox()(就像您在打开“*.jmp”文件时会得到的那样),那么您可以将单元格颜色设置为您想要的任何颜色 - 只需在脚本索引。
此代码应该让您了解如何为数据表执行此操作。
dt = New Table( "Test Banding", Add Rows( 4 ),
New Column( "Column 1", Character, "Nominal",
Set Values( {"a", "b", "c", "d", "e"} ) ),
New Column( "Column 2", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [3, 2, 1, 0, -1] ) ),
New Column( "Column 3", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [4, 5, 6, 7, 8] ) )
);
// Create a list of every other row number
gray_rows = {};
for (i = 1, i <= nrows(dt), i+=2,
insertinto(gray_rows, i);
);
// Set every other row to gray
for (i = 1, i <= ncols(dt), i++,
column(dt, i) << Color Cells( {-14803425, gray_rows} );
);
