每次使用新创建的图例列,为给定的列列表创建多个 varchart,每个 var 图表具有不同的图例。// I want to create journal of varcharts for a list of columns in a dataset with different legends. a legend column is mentioned which would change in reality for each loop. everything works expect the new column formula does not work. <BR />//In this example, i have used a static legend value of "ABC" but this would change for every loop in reality. the issue is the new formula column does not evaluate the column name <BR /><BR />dt = current data table();
mycolumnList = {"species","subject","season"};
For( i = 1, i <= N Items(mycolumnList), i++,
Try(dt << delete column("LegendCol"));
legend = "ABC";
Try( dt << New Column( "LegendCol", Formula( If(Column(mycolumnList[i])[Row()] == legend, "first", "rest" ) ) ) );
myvarChart = vlb << append(
dt << Variability Chart(
Y( :miles ),
X( eval(mycolumnList[i]) ),
Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
Connect Cell Means( 1 ),
Variability Summary Report( 1 ),
Std Dev Chart( 0 ),
Points Jittered( 1 ),
Show Box Plots( 1 ),
Name( "Show Gauge R&R Specifications Dialog" )(0),
Automatic Recalc( 1 ),
SendToReport(
Dispatch(
{"Variability Chart for SORT@WAFER@T_GOOD"},
"Variability Chart",
FrameBox,
{Row Legend(
Name( "LegendCol" ),
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 1 ),
Marker Theme( "Solid" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
));
);安莫尔@1996
自动化和脚本编写基础数据分析和建模数据混合和清理数据探索和可视化回复:每次使用新创建的图例列为每个 var 图表具有不同图例的给定列列表创建多个 varchart。我对你的脚本进行了一些修改。我不确定它是否能为您提供完整的解决方案。但是,它似乎适用于您的示例数据。
Names Default To Here( 1 );
// I want to create journal of varcharts for a list of columns in a dataset
// with different legends. a legend column is mentioned which would change in
// reality for each loop. everything works expect the new column formula does not work.
//In this example, i have used a static legend value of "ABC" but this would change
// for every loop in reality. the issue is the new formula column does not evaluate
// the column name dt = current data table();
nw = New Window( "test", vlb = V List Box() );
dt = Current Data Table();
mycolumnList = {"species", "subject", "season"};
For( i = 1, i <= N Items( mycolumnList ), i++,
Try( dt << delete column( "LegendCol" ) );
legend = "ABC";
Eval(
Substitute(
Expr(
Try(
dt << New Column( "LegendCol", Formula( If( Char( As Column( _mycolumnList_ ) ) == _legend_, "first", "rest" ) ) )
)
),
Expr( _mycolumnList_ ), mycolumnlist[i],
Expr( _legend_ ), legend
)
);
myvarChart = vlb << append(
dt << Variability Chart(
Y( :miles ),
X( Eval( mycolumnList[i] ) ),
Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
Connect Cell Means( 1 ),
Variability Summary Report( 1 ),
Std Dev Chart( 0 ),
Points Jittered( 1 ),
Show Box Plots( 1 ),
Name( "Show Gauge R&R Specifications Dialog" )(0),
Automatic Recalc( 1 ),
SendToReport(
Dispatch(
{"Variability Gauge Analysis for miles", "Variability Chart for miles"},
"Variability Chart",
FrameBox,
{Row Legend(
LegendCol,
Color( 1 ),
Color Theme( "JMP Default"(1) ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
)
);
);回复:每次使用新创建的图例列为每个 var 图表具有不同图例的给定列列表创建多个 varchart。谢谢吉姆,但这仍然有一个小问题。 不知何故,所有情节都有相同的传说。
例如,这样的事情。图例在循环中每次都会改变。然而,这些图例并没有出现在 var 图表中。我总是得到所有情节中的最终图例列图例
nw = New Window( "test", vlb = V List Box() );
dt = Current Data Table();
mycolumnList = {"species", "subject", "season"};
mylegendList = Associative Array({"species","subject","season"},{"FOX","2","summer"});
For( i = 1, i <= N Items( mycolumnList ), i++,
Try( dt << delete column( "LegendCol" ) );
//legend = "ABC";
legend = mylegendList[mycolumnList[i]];
Eval(
Substitute(
Expr(
Try(
dt << New Column( "LegendCol", Formula( If( Char( As Column( _mycolumnList_ ) ) == _legend_, "first", "rest" ) ) )
)
),
Expr( _mycolumnList_ ), mycolumnlist[i],
Expr( _legend_ ), legend
)
);
myvarChart = vlb << append(
dt << Variability Chart(
Y( :miles ),
X( Eval( mycolumnList[i] ) ),
Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
Connect Cell Means( 1 ),
Variability Summary Report( 1 ),
Std Dev Chart( 0 ),
Points Jittered( 1 ),
Show Box Plots( 1 ),
Name( "Show Gauge R&R Specifications Dialog" )(0),
Automatic Recalc( 1 ),
SendToReport(
Dispatch(
{"Variability Gauge Analysis for miles", "Variability Chart for miles"},
"Variability Chart",
FrameBox,
{Row Legend(
LegendCol,
Color( 1 ),
Color Theme( "JMP Default"(1) ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
))));
回复:每次使用新创建的图例列为每个 var 图表具有不同图例的给定列列表创建多个 varchart。为了完成您正在做的事情,我相信您必须为每个图表创建一个单独的图例列
Names Default To Here( 1 );
nw = New Window( "test", vlb = V List Box() );
dt = Current Data Table();
mycolumnList = {"species", "subject", "season"};
mylegendList = Associative Array( {"species", "subject", "season"}, {"FOX", "2", "summer"} );
For( i = 1, i <= N Items( mycolumnList ), i++,
Try( dt << delete column( "LegendCol" || Char( i ) ) );
//legend = "ABC";
legend = mylegendList[mycolumnList[i]];
Eval(
Substitute(
Expr(
Try(
dt << New Column( "LegendCol" || Char( i ),
Formula( If( Char( As Column( _mycolumnList_ ) ) == _legend_, "first", "rest" ) )
)
)
),
Expr( _mycolumnList_ ), mycolumnlist[i],
Expr( _legend_ ), legend
)
);
Eval(
Substitute(
Expr(
myvarChart = vlb << append(
dt << Variability Chart(
Y( :miles ),
X( Eval( mycolumnList[i] ) ),
Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
Connect Cell Means( 1 ),
Variability Summary Report( 1 ),
Std Dev Chart( 0 ),
Points Jittered( 1 ),
Show Box Plots( 1 ),
Name( "Show Gauge R&R Specifications Dialog" )(0),
Automatic Recalc( 1 ),
SendToReport(
Dispatch(
{"Variability Gauge Analysis for miles", "Variability Chart for miles"},
"Variability Chart",
FrameBox,
{Row Legend(
_LegendCol_,
Color( 1 ),
Color Theme( "JMP Default"(1) ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
)
)
),
Expr( _legendcol_ ), Parse( "LegendCol" || Char( i ) )
)
);
);