如何更新多个替换以将 Ns 添加到 GraphBuilder 脚本:包含的脚本大家好,
我想修改下面的脚本,通过将占位符“_text0_”替换为“_text5_”来将 Ns 添加到 GraphBuilder。
我知道如何为“_Yname_”占位符实现单个替换,但我遇到了一个心理障碍来找出多个替换。
另外,我不知道如何调用列统计信息来动态生成绘图上每个叠加层的 Ns(见脚本下图)
Names Default to Here (1);
dt = Current Data Table ();
Clist = dt << Get Column Names (String);
For (i = 932, i<= 935, i++,
gb = Expr ( Graph Builder(
Size( 789, 440 ),
Variables(
X( :Visit ),
Y( column (i) ),
Group X( :LEAD TAG ),
Overlay( :SHORT TAG )
),
Elements( Line( X, Y, Legend( 7 ), Error Bars( "Standard Error" ) ) ),
SendToReport(
Dispatch(
{},
_Yname_,
ScaleBox,
{Format( "Best", 12 ), Min( -1.8 ), Max( 1.0 ),
Inc( 0.2 ), Minor Ticks( 1 ),
Add Ref Line( 0, "Dotted", "Black", "", 2 )}
),
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
2,
Description( "Script" ),
Text( Center Justified, {0.5, -1.6}, "_text0_" )
), Add Graphics Script(
3,
Description( "Script" ),
Text( Center Justified, {0.5, -1.75}, "_text1_" )
), Grid Line Order( 5 ), Reference Line Order( 6 )}
),
Dispatch(
{},
"Graph Builder",
FrameBox( 2 ),
{Left( 1 ), Right( 0 ), Top( 0 ), Bottom( 1 ),
Add Graphics Script(
2,
Description( "Script" ),
Text( Center Justified, {0.5, -1.75}, "_text3_" )
), Add Graphics Script(
3,
Description( "Script" ),
Text( Center Justified, {0.5, -1.6}, "_text2_" )
), Grid Line Order( 5 ), Reference Line Order( 6 )}
),
Dispatch(
{},
"Graph Builder",
FrameBox( 3 ),
{Left( 1 ), Right( 1 ), Top( 0 ), Bottom( 1 ),
Add Graphics Script(
2,
Description( "Script" ),
Text( Center Justified, {0.5, -1.6}, "_text4_" )
), Add Graphics Script(
3,
Description( "Script" ),
Text( Center Justified, {0.5, -1.75}, "_text5_" )
), Grid Line Order( 5 ), Reference Line Order( 6 )}
)
)
)
);
gbe = Eval (substitute(Name Expr (gb), Expr (_Yname_), Clist [i]));
gbe << journal;
gbe << close window;
);
回复:如何更新多个替换以将 Ns 添加到 GraphBuilder 脚本:包含脚本嗨,txnelson,
非常感谢您的帮助。 正如您所预测的那样,脚本已经完成了 99%,我只需要向主表 (dt) 添加几个调用,如下所示。
For (i = 932, i<= 1115, i++,
try( close( dtSum, nosave ) );
dtSum = <FONT color="#FF0000">dt</FONT> << Summary(invisible,
Group( :LEAD TAG, :SHORT TAG ),
N( as column( Clist[i] ) ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" )
);
gb = Expr ( <FONT color="#FF0000">dt</FONT> << Graph Builder(
Size( 789, 440 ),
Variables(
X( :Visit ),
Y( column (i) ),
Group X( :LEAD TAG ),
Overlay( :SHORT TAG )
),
Elements( Line( X, Y, Legend( 7 ), Error Bars( "Standard Error" ) ) ),
SendToReport(
Dispatch(
{},
_Yname_,
ScaleBox,
{Format( "Best", 12 ), Min( -1.8 ), Max( 1.0 ),
Inc( 0.2 ), Minor Ticks( 1 ),
Add Ref Line( 0, "Dotted", "Black", "", 2 )}
),
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
2,
Description( "Script" ),
Text( Center Justified, {0.5, -1.6}, _text0_ )
), Add Graphics Script(
3,
Description( "Script" ),
Text( Center Justified, {0.5, -1.75}, _text1_ )
), Grid Line Order( 5 ), Reference Line Order( 6 )}
),
Dispatch(
{},
"Graph Builder",
FrameBox( 2 ),
{Left( 1 ), Right( 0 ), Top( 0 ), Bottom( 1 ),
Add Graphics Script(
2,
Description( "Script" ),
Text( Center Justified, {0.5, -1.75}, _text3_ )
), Add Graphics Script(
3,
Description( "Script" ),
Text( Center Justified, {0.5, -1.6}, _text2_ )
), Grid Line Order( 5 ), Reference Line Order( 6 )}
),
Dispatch(
{},
"Graph Builder",
FrameBox( 3 ),
{Left( 1 ), Right( 1 ), Top( 0 ), Bottom( 1 ),
Add Graphics Script(
2,
Description( "Script" ),
Text( Center Justified, {0.5, -1.6}, _text4_ )
), Add Graphics Script(
3,
Description( "Script" ),
Text( Center Justified, {0.5, -1.75}, _text5_ )
), Grid Line Order( 5 ), Reference Line Order( 6 )}
)
)
)
);
gbe = Eval (substitute(Name Expr (gb), Expr (_Yname_), Clist [i],
Expr ( _text0_ ), char( column( dtSum, Clist[i] )[1] ),
Expr ( _text1_ ), char( column( dtSum, Clist[i] )[2] ),
Expr ( _text2_ ), char( column( dtSum, Clist[i] )[3] ),
Expr ( _text3_ ), char( column( dtSum, Clist[i] )[4] ),
Expr ( _text4_ ), char( column( dtSum, Clist[i] )[5] ),
Expr ( _text5_ ), char( column( dtSum, Clist[i] )[6] )
));
gbe << journal;
gbe << close window;
);回复:如何更新多个替换以将 Ns 添加到 GraphBuilder 脚本:包含脚本您可以通过一次调用 Substitute() 函数来执行多个替换。
gbe = Eval(
Substitute( Name Expr( gb ),
Expr( _Yname_ ), Clist[i],
Expr( "_text0_"), "actual text",
...
)
);
回复:如何更新多个替换以将 Ns 添加到 GraphBuilder 脚本:包含脚本这是执行此操作的一种方法。我不能保证代码在第一次尝试时就可以工作,因为它是未经测试的代码,因为我没有示例数据表。但是,它应该非常接近。
Names Default to Here (1);
dt = Current Data Table ();
Clist = dt << Get Column Names (String);
For (i = 932, i<= 935, i++,
try( close( dtsum, nosave ) );
dtSum = << Summary(invisible,
Group( :LEAD TAG, :SHORT TAG ),
N( as column( Clist[i] ) ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" ),
Link to original data table( 0 )
);
gb = Expr ( dt << Graph Builder(
Size( 789, 440 ),
Variables(
X( :Visit ),
Y( column (i) ),
Group X( :LEAD TAG ),
Overlay( :SHORT TAG )
),
Elements( Line( X, Y, Legend( 7 ), Error Bars( "Standard Error" ) ) ),
SendToReport(
Dispatch(
{},
_Yname_,
ScaleBox,
{Format( "Best", 12 ), Min( -1.8 ), Max( 1.0 ),
Inc( 0.2 ), Minor Ticks( 1 ),
Add Ref Line( 0, "Dotted", "Black", "", 2 )}
),
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
2,
Description( "Script" ),
Text( Center Justified, {0.5, -1.6}, _text0_ )
), Add Graphics Script(
3,
Description( "Script" ),
Text( Center Justified, {0.5, -1.75}, _text1_ )
), Grid Line Order( 5 ), Reference Line Order( 6 )}
),
Dispatch(
{},
"Graph Builder",
FrameBox( 2 ),
{Left( 1 ), Right( 0 ), Top( 0 ), Bottom( 1 ),
Add Graphics Script(
2,
Description( "Script" ),
Text( Center Justified, {0.5, -1.75}, _text3_ )
), Add Graphics Script(
3,
Description( "Script" ),
Text( Center Justified, {0.5, -1.6}, _text2_ )
), Grid Line Order( 5 ), Reference Line Order( 6 )}
),
Dispatch(
{},
"Graph Builder",
FrameBox( 3 ),
{Left( 1 ), Right( 1 ), Top( 0 ), Bottom( 1 ),
Add Graphics Script(
2,
Description( "Script" ),
Text( Center Justified, {0.5, -1.6}, _text4_ )
), Add Graphics Script(
3,
Description( "Script" ),
Text( Center Justified, {0.5, -1.75}, _text5_ )
), Grid Line Order( 5 ), Reference Line Order( 6 )}
)
)
)
);
gbe = Eval (substitute(Name Expr (gb), Expr (_Yname_), Clist [i],
Expr ( _text0_ ), char( column( dtSum, Clist[i] )[1] ),
Expr ( _text1_ ), char( column( dtSum, Clist[i] )[2] ),
Expr ( _text2_ ), char( column( dtSum, Clist[i] )[3] ),
Expr ( _text3_ ), char( column( dtSum, Clist[i] )[4] ),
Expr ( _text4_ ), char( column( dtSum, Clist[i] )[5] ),
Expr ( _text5_ ), char( column( dtSum, Clist[i] )[6] )
));
gbe << journal;
gbe << close window;