如何为图形生成器编写移动 Y 变量的脚本?大家好,
我正在做一个带有移动 Y 变量的图形生成器,图形的输出将如下所示:

但是,我正在努力在 JSL 中编写 Y 轴脚本。我怎样才能这样做呢?
For( i = 1, i <= N Items( NamesList ), i++,
obj = Graph Builder(
Size( 534, 464 ),
Show Control Panel( 0 ),
Variables(
X( :TETEST_MONTH ),
X( :TETEST_WEEK, Position( 1 ) ),
Y( :Name ("Y")) , // how do I insert the moving Y variable here ?
Y( :Name ("Y")), // how do I insert the moving Y variable here ?
Color( :TETEST_MONTH )
),
Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
Elements(
Position( 1, 2 ),
Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
));回复:如何为图形生成器编写移动 Y 变量的脚本?谢谢你,吉姆。 现在效果很好。回复:如何为图形生成器编写移动 Y 变量的脚本?我的错误......删除所有 gb[i] 引用并将它们更改为 gb。
回复:如何为图形生成器编写移动 Y 变量的脚本?谢谢,吉姆。 但我仍然遇到错误。 我想我的分割可能有问题。
/* Open a sample data table */
dt = Open( "C:\Users\1.jmp", invisible );
// Find the Y Columns
numericColNamesList = dt << get column names( string, numeric );
For( i = N Items( numericColNamesList ), i >= 1, i--,
If(
Not(
Is Missing( Num( Word( 1, numericColNamesList[i], ":" ) ) ) == 0 &
Word( 2, numericColNamesList[i], ":" ) != ""
),
numericColNamesList = Remove( numericColNamesList, i, 1 )
)
);
// Run the Variance Charts
// With dynamic Y columns and fixed X columns
Fo( i = 1, i <= N Items( numericColNamesList ), i++,
gb = dt << Graph Builder(
Invisible,
Size( 752, 508 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :Month ),
Y( Column ( numericColNamesList[i] ) ),
Overlay( :Month )
),
Elements(
Box Plot(
X,
Y,
Legend( 15 ),
Jitter( 0 ),
Outliers( 0 ),
Box Style( "Solid" )
),
Histogram( X, Y, Legend( 12 ) )
));
gb = LIST (gb[i]);
If( i == 1,
Report( gb ) << Save Presentation( "C:\Users\Ann Ann\1.pptx" ),
Report( gb[i] << Save Presentation( "C:\Users\Ann Ann\1.pptx", Append ) )
));
回复:如何为图形生成器编写移动 Y 变量的脚本?您正在使用
gb = dt << 图形生成器(.........
对于图形生成器平台的每次执行。它不是值的向量。每次运行图形生成器脚本时,您都会为变量“gb”创建一个新值。也就是说,指向 Graph Builder 的最后一个实例的指针被移动到指向 Graph Builder 的新实例。您的代码设置方式不存在 gb[1]、gb[2] 等。
解决这个问题的一种方法是将代码的保存演示区域移动到初始 For() 循环内。
解决此问题的另一种方法是在初始 For() 循环中,在创建后将“gb”的值保存到列表中。然后,在第二个 For() 循环中指向列表中的元素,而不是 gb[i] 等。
For( i = 1, i <= N Items( numericColNamesList ), i++,
gb = dt << Graph Builder(
Size( 900, 850 ),
Show Control Panel( 0 ),
Variables(
X( :MONTH ),
X( :WEEK, Position( 1 ) ),
Y( Column( numericColNamesList[i] ) ),
Y( Column( numericColNamesList[i] ) ),
Color( :MONTH )
),
Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
Elements(
Position( 1, 2 ),
Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
);
If( i == 1,
Report( gb ) << Save Presentation( "C:\Users\Ann Ann\1.pptx" ),
Report( gb[i] << Save Presentation( "C:\Users\Ann Ann\1.pptx", Append ) )
);
);
Open( "C:\Users\Ann Ann\1.pptx" );回复:如何为图形生成器编写移动 Y 变量的脚本?谢谢吉姆。
但我不知道为什么这个错误在调试过程中不断提示我。

For( i = 1, i <= N Items( numericColNamesList ), i++,
gb = dt << Graph Builder(
Size( 900, 850 ),
Show Control Panel( 0 ),
Variables(
X( :MONTH ),
X( :WEEK, Position( 1 ) ),
Y( Column( numericColNamesList[i])) ,
Y( Column( numericColNamesList[i])) ,
Color( :MONTH )
),
Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
Elements(
Position( 1, 2 ),
Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
));
Report(gb[1]) << Save Presentation( "C:\Users\Ann Ann\1.pptx" );
For( i = 2, i <= N Items( numericColNamesList ), i++,
Report (gb[i] << Save Presentation( "C:\Users\Ann Ann\1.pptx", Append )
));
Open( "C:\Users\Ann Ann\1.pptx" );
//wait(0);
//obj << close window();
回复:如何为图形生成器编写移动 Y 变量的脚本?假设“NamesList”包含您要用作 Y 列的 Y 列,然后替换
:名称(“Y”)
和:
作为列(NamesList[i])