将单位添加到可变性图表的 Y 轴我有一组测试项目跨 80 台设备进行测试。 我正在绘制可变性图表,我想将单位添加到 Y 轴。 我在不同的列中有单位。 列名是默认的标签集。 有没有办法将单位添加到标签中?有可用的脚本吗?附件是我想要的outout的样本表和样本格式。

回复:将单位添加到可变性图表的 Y 轴谢谢@txnelson和@cwillden .这两个脚本都适用于原始问题。
谢谢,
文卡特
回复:将单位添加到可变性图表的 Y 轴这实际上就是我对拆分的想法。干得好,吉姆。
我正在考虑的替代方法将避免拆分,并且 y 轴标签只是单位。如果该单位丢失,我只是将“未知单位”放在它的位置,但你可以在那里做任何你想做的事情。这种方法构建脚本的“SendToByGroup”部分。这适用于您的示例数据:
Names Default to Here(1);
dt = Current Data Table();
/**** Get units for each level of TestInstance ***/
testList = Associative Array(dt:TestInstance) << get keys;
unitList = {};
for(i = 1, i<=N Items(testList), i++,
temp = dt:Unit[min(dt << Get Rows Where(:TestInstance == testList[i]))];
Insert Into(unitList, If(Is Missing(temp),"Unknown Unit", temp ));
);
unitArray = Associative Array(testList, unitList);
/**** Build the Var Chart Script ****/
varChartStr = "Variability Chart(
Y( :value ),
X( :PackageID ),
Std Dev Chart( 0 ),
By( :TestInstance )";
//Loop through levels of TestInstance to add the unit label for the y-axis
for(i=1, i<= N Items(testList), i++,
varChartStr = varChartStr || Eval Insert("\[,
SendToByGroup(
{:TestInstance == "^testList[i]^"},
SendToReport(
Dispatch(
{"Variability Gauge TestInstance=^testList[i]^",
"Variability Chart for value"},
"value",
TextEditBox,
{Set Text( "^unitArray[testList[i]]^" )}
)
)
)]\");
);
//Close the script
varChartStr = varChartStr || "
);";
//Run the script
eval(parse(varChartStr));
//Add the script to the data table
Eval(Parse(Eval Insert("dt << New Script(\!"Variability Chart\!", ^varChartStr^)")));
结果如下:
回复:将单位添加到可变性图表的 Y 轴这是一个脚本,它通过将单元添加到测试的名称来生成您想要的内容。我对提供的 Excel 文件运行了这个。该脚本假定数据表在运行脚本之前已在 JMP 中打开。
Names Default To Here( 1 );
// This script assumes you have opened the Excel file as a JMP Data Table
dt = Current Data Table();
// Split the data into the proper form for analysis
dtSplit = dt << Split( Split By( :TestInstance ), Split( :value ), Remaining Columns( Drop( :Unit ) ), Sort by Column Property );
// Create a data table to determine the units for each test
dtUnits = dt << Summary( Group( :TestInstance, :Unit ), Freq( "None" ), Weight( "None" ), Link to original data table( 0 ) );
// Loop across the data table and add the Units to the different Test Columns in the data table
For( i = 1, i <= N Rows( dtUnits ), i++,
If( dtUnits:Unit[i] != "",
Column( dtSplit, dtUnits:TestInstance[i] ) << set name(
Column( dtSplit, dtUnits:TestInstance[i] ) << get name || " ( " || dtUnits:Unit[i] || " )"
)
)
);
// Delete the Units data table since it is no longer needed
close( dtUnits, nosave );
// Create a window to place all of the charts into
nw = New Window( "Variability Chart by PackageID", vlb = V List Box() );
// Get all of the column names
colNames = dtSplit << get column names( string, numeric );
// Loop across all of the columns and when a Test column is found,
// then create a chart for it
For( i = 1, i <= N Items( colNames ), i++,
If( Contains( colNames[i], "Test" ) == 1,
testList = ":Name(\!"" || colNames[i] || "\!")";
Eval(
Substitute(
Expr(
vlb << append( dtSplit << Variability Chart( Y( __theList__ ), X( :PackageID ), Std Dev Chart( 0 ) ) )
),
Expr( __theList__ ), Parse( testList )
)
);
)
);
回复:将单位添加到可变性图表的 Y 轴@cwillden谢谢,我转换了附件格式中显示的表格。 请告诉我添加单位的方法。
谢谢
回复:将单位添加到可变性图表的 Y 轴我认为使用更广泛的格式会更容易(即拆分 TestInstance 上的“值”列),但是如果您想将其保持为长格式,最直接的方法可能是在循环中构造 SendToByGroup() 部分并按组级别抓取每个单位。今晚晚些时候我当然可以帮你,但我必须马上跑。
回复:将单位添加到可变性图表的 Y 轴谢谢@cwillden但我有 200 多个测试项目,所以这种方法可能不适合那么多测试项目。 你有什么想法将它与循环一起使用吗?
谢谢。
回复:将单位添加到可变性图表的 Y 轴如果您必须这样做一次,只需单击轴标签并输入您想要的任何内容。如果您必须重复执行此操作,请输入您想要的内容并保存脚本。将此脚本指向任何未来的表:
Variability Chart(
SendToByGroup( {:TestInstance == "Test1"} ),
Y( :value ),
SendToByGroup( {:TestInstance == "Test1"}, Y( :value ) ),
SendToByGroup( {:TestInstance == "Test2"}, Y( :value ) ),
SendToByGroup( {:TestInstance == "Test3"}, Y( :value ) ),
SendToByGroup( {:TestInstance == "Test4"}, Y( :value ) ),
X( :PackageID ),
Std Dev Chart( 0 ),
By( :TestInstance ),
SendToByGroup(
{:TestInstance == "Test1"},
SendToReport(
Dispatch(
{"Variability Gauge TestInstance=Test1",
"Variability Chart for value"},
"value",
TextEditBox,
{Set Text( "Unknown" )}
)
)
),
SendToByGroup(
{:TestInstance == "Test2"},
SendToReport(
Dispatch(
{"Variability Gauge TestInstance=Test2",
"Variability Chart for value"},
"value",
TextEditBox,
{Set Text( "mA" )}
)
)
),
SendToByGroup(
{:TestInstance == "Test3"},
SendToReport(
Dispatch(
{"Variability Gauge TestInstance=Test3",
"Variability Chart for value"},
"value",
TextEditBox,
{Set Text( "uA" )}
)
)
),
SendToByGroup(
{:TestInstance == "Test4"},
SendToReport(
Dispatch(
{"Variability Gauge TestInstance=Test4",
"Variability Chart for value"},
"value",
TextEditBox,
{Set Text( "mA" )}
)
)
)
)