处理 JSL 中 Y 轴变量的条件显示以进行图形构建使用`graphbuilt`时,如何用JSL描述某些Y轴变量(可能不总是出现)有值时显示,无值时不显示的要求?以下两种方法均无效。
1.
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :sex ), try(Y( :bbb )), Y( :height ), Y( :weight ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 13 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 14 ) ) ),
Elements( Position( 1, 3 ), Points( X, Y, Legend( 15 ) ) )
);2.
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :sex ), Y( :bbb ), Y( :height ), Y( :weight ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 13 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 14 ) ) ),
Elements( Position( 1, 3 ), Points( X, Y, Legend( 15 ) ) )
);自动化和脚本回复:处理 JSL 中 Y 轴变量的条件显示以进行图形构建你好@BabyDoragon ,bbb 是一个存在或不存在的列,这是我们需要检查的,或者 bbb 一直存在,但缺少一些值(行)?
回复:处理 JSL 中 Y 轴变量的条件显示以进行图形构建bbb的默认值为{},有时也可能以变量形式存储,例如以下两种情况。
1.
dt = Open("$SAMPLE_DATA/Big Class.jmp");
bbb={};
bbb="age";
Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :sex ), Y( as column(bbb)), Y( :height ), Y( :weight ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 13 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 14 ) ) ),
Elements( Position( 1, 3 ), Points( X, Y, Legend( 15 ) ) )
);2.
dt = Open("$SAMPLE_DATA/Big Class.jmp");
bbb={};
//bbb="age";
Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :sex ), Y( as column(bbb)), Y( :height ), Y( :weight ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 13 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 14 ) ) ),
Elements( Position( 1, 3 ), Points( X, Y, Legend( 15 ) ) )
);我希望能够根据 bbb 中当前是否存在任何变量来使图表自动包含或排除此项。
回复:处理 JSL 中 Y 轴变量的条件显示以进行图形构建您可以稍后构建表达式或添加变量
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(534, 450),
Show Control Panel(0),
Variables(X(:sex), Y(:height), Y(:weight)),
Elements(Position(1, 1), Points(X, Y, Legend(13))),
Elements(Position(1, 2), Points(X, Y, Legend(14)))
);
dt << new column("A", Numeric, Continuous, Formula(Row()));
extra_cols = {"height", "A"};
For Each({extra_col}, extra_cols,
Eval(EvalExpr(
gb << Add Variable({Expr(NameExpr(AsColumn(dt, extra_col))), Role("Y")});
));
);
根据您要做的事情,可能会有很多事情需要考虑(顺序、情节类型、图例......)
如果我没记错的话,这可能与这个主题Scripters Club 录音:Graph Builder 中的 JSL有关