The script below loads some data and should create twice the same plot.<BR />The first one by referring to the column name by using a variable (test1), the second one by calling the column name directly.
The second one works fine, but for the first one I get an empty plot area. I guess there is a problem with how I define or call test1. I have tried different approaches, but so far nothing worked.
Names Default To Here( 1 );
// Import the Excel file with specified settings
dt = Open(
"/Y:/.../file.xlsx",
Worksheets( "Pivot table for JMP" ),
Worksheet Settings(
1,
Has Column Headers( 1 ),
Headers Start on Row( 2 ),
Data Starts on Row( 3 )
)
);
// Filter rows to include only "AAA" in "Common Designation"
dt_AAA = dt << Subset(
Rows( :Common Designation == "AAA" ),
Include All Columns,
Name( "Filtered AAA" )
);
size = "AAA" ;
Match( size,
"AAA", test1 = column ("PL (min)"),
);
New Window( size,
V List Box(
Graph Builder(
Size( 500, 297 ),
Show Control Panel( 0 ),
Variables( X( :test1 ), Y( :Chemistry ), Color( :Chemistry ) ),
Elements( Points( X, Y, Legend( 106 ) ) )
),
Graph Builder(
Size( 500, 297 ),
Show Control Panel( 0 ),
Variables( X( :"PL (min)"n ), Y( :Chemistry ), Color( :Chemistry ) ),
Elements( Points( X, Y, Legend( 106 ) ) )
),
),
);
如果我理解正确,您只需要删除第一个 Graph Builder 脚本中 test1 前面的冒号即可。以下是一个可运行的示例脚本:
Names Default To Here (1);
dt = open ("$SAMPLE_DATA/big class.jmp");
test1 = column ("weight");
Graph Builder (
Variables (X(test1), Y(:height), color (:sex))
);
一个查找这类漏洞的好方法:
从有问题的脚本中不断删除代码行,直到只剩下足以重现错误的代码行为止。
重要提示:代码应包含产生错误所需的所有要素——对所有执行该代码的人都适用*)
这样做有两个优点:
大多数情况下,错误都能自动找到。删除一行代码,错误就消失了。
- 剩余的代码非常短,这使得查找错误变得容易得多。
*)在我的系统上,它崩溃并出现以下错误信息:

更好的办法是:使用示例文件之一,例如@Jed_Campbell的示例。
这样做还有另一个好处:你可以区分以下几点:
我的数据表中存在错误(而示例数据中没有此错误)。
我的脚本有错误(因为我可以用示例数据重现该错误)。