根据列值突出显示分布中的箱体,以突出显示箱体迁移我有一组包含单位总体的分布。我使用了select where和containitem调用来选择数据集中与特定 DUT 参考 ID 号匹配的列表项。这有助于显示哪些容器包含感兴趣单位的测量值。我想使用每个选择实例的测试日期来突出显示包含测量值的容器。例如,如果同一单位在 2024 年 6 月 20 日进行了测试,随后在 2024 年 6 月 25 日再次进行了测试,然后在 2024 年 6 月 28 日再次进行了测试。6 月 20 日的容器结果将以一种颜色突出显示,而 6 月 25 日、6 月 28 日的容器结果将以另外两种颜色突出显示。其他一些目标是使这些颜色在报告中的分布中保持一致(每个测试日期一种颜色),所有未选定的单位保留默认颜色。我还希望突出显示各个容器的图从上到下。
非常感谢您的支持。
//dtmain << select where(:SN=="12346777" | :SN=="12346982");
dtmain << select where(ContainsItem(:SN, {"12346777", "12346982"}));
Distribution(
Stack( 1 ),
Continuous Distribution(
Column( :Average ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
),
Continuous Distribution(
Column( :Min ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
),
Continuous Distribution(
Column( :Max ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
),
By(
:TID, :BLOCKNAME, :MEAS_TYPE
)
);

我想要实现的目标的模型:

基础数据分析与建模可靠性分析回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移您能否从示例文件夹中挑选一个合适的文件并创建一个说明该问题的模型?
其优点:
- 节省时间(#1):
用户无需创建模型数据集 - 节省时间(#2):
有助于理解这个问题 - 所有回复都将基于一个通用模型
-> 易于比较

例如,使用温度数据、状态选择和按季度的颜色 - 而不是原始数据、DUT 选择和按测量日期的颜色 - 这是您感兴趣的吗?
dt = Open( "$SAMPLE_DATA/Functional Data/Weekly Weather Data.jmp" );
dt << New Column( "selected Quarter",
"Ordinal",
Formula( If( Selected(), Quarter( :DATE ) ) ),
Set Property(
"Value Colors",
{1 = -13912408, 2 = -4042310, 3 = -4354269, 4 = -13400361}
)
);
dt << Graph Builder(
Transform Column( "temperature", Formula( Round( :TAVG / 2 ) * 2 ) ),
Size( 568, 328 ),
Show Control Panel( 0 ),
Variables( X( :STATION ), X( :temperature ), Overlay( :selected Quarter ) ),
Elements( Position( 1, 1 ), Bar( X, Overlay( 0 ), Legend( 9 ), Bar Style( "Stacked" ) ) ),
Elements( Position( 2, 1 ), Bar( X, Legend( 1 ), Bar Style( "Stacked" ) ) ),
SendToReport(
Dispatch( {}, "400", ScaleBox,
{Legend Model( 1, Properties( 0, {Fill Color( 32 )}, Item ID( "Missing", 1 ) ) )}
),
Dispatch( {}, "Graph Builder", FrameBox( 2 ), {Fill Selection Mode( "Unselected Faded" )} )
)
);
回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移你可以用参考线来做到这一点
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dist = dt << Distribution(
Stack(1),
Continuous Distribution(
Column(:height),
Horizontal Layout(1),
Vertical(0),
Set Bin Width(2),
Process Capability(0)
)
);
ab = Report(dist)[AxisBox(1)];
ab << Add Ref Line({60, 62}, "Solid", "Red", "", 1, 0.25);
ab << Add Ref Line({62, 64}, "Solid", "Green", "", 1, 0.25);
ab << Add Ref Line({64, 66}, "Solid", "Blue", "", 1, 0.25);

或使用图形脚本
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dist = dt << Distribution(
Stack(1),
Continuous Distribution(
Column(:height),
Horizontal Layout(1),
Vertical(0),
Set Bin Width(2),
Process Capability(0)
)
);
fb = Report(dist)[FrameBox(2)];
fb << Add Graphics Script(
1,
Transparency(0.2);
Fill Color("Red");
Rect(68, Y Range() + 10, 70, Y Origin(), 1);
Transparency(0.2);
Fill Color("Light Green");
Rect(70, Y Range() + 10, 72, Y Origin(), 1);
);

为了在所有分布中获得相同的颜色,您可以为日期设置值颜色属性并在设置颜色时使用该属性,或者创建颜色列表并按顺序使用它们。
回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移以下是我对此的看法。它会找到选定的行和与其关联的容器,然后根据需要添加参考线。

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// For illustration, randomly select some rows
For( i = 1, i <= 3, i++,
dt << select rows( Random Integer( 1, N Rows( dt ) ) )
);
dist = dt << Distribution(
Stack( 1 ),
Continuous Distribution(
Column( :height ),
Quantiles( 0 ),
Summary Statistics( 0 ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
)
);
distRPT = Report( dist )[AxisBox( 1 )];
// Find the Midpoints of the bins the selected rows are in
dist << Save( "Level Midpoints" );
theBins = (Associative Array( Column( dt, N Cols( dt ) )[dt << get selected rows] )) << get keys;
dt << delete columns( N Cols( dt ) );
// Get the Increment of the X axis
theIncr = distRPT[AxisBox( 1 )] << get inc;
// Add the reference lines for each selected bin
For Each( {bin, index}, theBins,
binList = {};
Insert Into( binList, bin - theIncr / 2 );
Insert Into( binList, bin + theIncr / 2 );
Eval( Eval Expr( distRPT << Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
);
对此进行扩展,使图形能够随着用户选择和取消选择不同的行而以交互方式发生变化,这需要添加一个 RowState Handler,以及一些首先删除任何现有参考线,然后添加新参考线的逻辑。
回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移需要回答的一个问题:
颜色该如何分配,范围该如何标记。
例如,如果所选 ID 的 6/20 数据为:48、90(77、56、...)。
或者反过来:我们能否确定某一日期选定的所有设备 ID 的数据都在同一个箱子里?
回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移知道了。谢谢。我会按照你的建议调整我的问题以使用可用数据。
回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移感谢您的支持。
我能够按照您和@jthi的建议使用添加引用。我使用该方法进行着色并确认它适用于单一分布。当我添加按条件时,我失去了绘图寻址能力,从而导致错误。
根据@hogi的建议,我切换到了这个问题的可用数据。为了帮助解决这个问题,我在修改后的Jim脚本中增加了Big Class。以下是我遵循的步骤和结果
1. 导入 Big Class
2. 如果表中没有“State”列,则有条件地添加一些数据
a. 添加一个名为“State”的列,其中包含排序数据,以将人们置于“CA”、“WA”或“OR”中。
b. 添加第二个“PATTY”,其年龄为 16 岁,“女”,57 岁,134 岁,位于“WA”。
3. 选择一些名字。我选择了 LESLIE 和 PATTY
4. 运行脚本来查找并突出显示感兴趣的箱子。
好的 Case - remove By (:State) from the script below and change the preceding comma to a semicolon to run successfully. The code finds both instances of Patty and uses different colors for each of them. If they had the same height, for this example the reference lines would overlap only showing one of the two colors.
@hogi很好地指出了显示哪种颜色的仲裁问题。一旦我理解了元素寻址,我计划为同一个容器中出现多个有趣的数据点的情况添加一个条件。

NG案例 - 根据 :State 运行具有 By 条件的分布,并看到寻址绘图对象时出错。我尝试了几种寻址排列,但没有成功。我缺少访问 AxisBox 的关键信息。
也不起作用:
distRPT = 报告(dist)["高度",AxisBox(1)];
distRPT = 报告(dist)["州=WA","高度",AxisBox(1)];
distRPT = 报告(dist["State=WA"])["高度",AxisBox( 1 )];
示例错误代码:在访问或评估“Report(dist)[ /***###*/AxisBox(1)]”时,第 41 行的对象不可下标,Report( dist )[/***###*/AxisBox( 1 )]
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
col_name_list = dt << get column names(string);
newColName = "State";
// New column: State
if (!contains(col_name_list, newColName),
Local( {dt, tempStrings},
dt = Data Table( "Big Class" );
dt << New Column( "State", Character, "Nominal" ) << Begin Data Update;
tempStrings = {"CA", "WA", "OR"};
For Each Row( dt, :State = tempStrings[Sequence( 1, 3, 1, 1 )] );
dt << End Data Update;
);
//Make it a double Patty :), another person with the same name.
dt << Add Rows( 1, At End );
//Cheat and use a constant of 41 for the last row index
dt[[41],{name,age,sex,height,weight,State}] = {{"PATTY", 16, "F", 57, 134, "WA"}};
);
// For illustration, select some names
dt << select where( ContainsItem(:name, {"LESLIE","PATTY"}));
dist = dt << Distribution(
Stack( 1 ),
Continuous Distribution(
Column( :height ),
Quantiles( 0 ),
Summary Statistics( 0 ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
),
By (:State)
);
distRPT = Report( dist )[AxisBox( 1 )];
// Find the Midpoints of the bins the selected rows are in
dist << Save( "Level Midpoints" );
theBins = (Associative Array( Column( dt, N Cols( dt ) )[dt << get selected rows] )) << get keys;
dt << delete columns( N Cols( dt ) );
// Get the Increment of the X axis
theIncr = distRPT[AxisBox( 1 )] << get inc;
// Add the reference lines for each selected bin
For Each( {bin, index}, theBins,
binList = {};
Insert Into( binList, bin - theIncr / 2 );
Insert Into( binList, bin + theIncr / 2 );
Eval( Eval Expr( distRPT << Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
);
感谢您的评论和指导。
谢谢!
布莱恩
回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移好的 : )
关于“找到正确的轴盒”,愿望清单中的这个愿望:
通过 JSL 更轻松地获取报告结果
状态为“在队列中” - 我希望,除了“更容易从报告中获得结果”之外,它还能方便地找到正确的轴框......
回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移我的第一个猜测是,当您使用 By 时,您正在尝试在列表上使用 Report() 函数(使用 Show(dist); 检查 dist 包含的内容)
回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移如果需要 BY 组,情况就会变得更加复杂。
每个子图可以有不同的箱宽。这就是为什么需要 for 循环的原因:
- 获取单独的箱宽。
- 获取特定子图的选定行
- 将参考线添加到特定子图。
嗯,也许重新考虑阴影区域的想法——我们也存在颜色问题。
目前,我们只是为每个选定的箱子应用不同的颜色。阴影区域看起来不错 - 但宽度相当随意。也许只需为每个选定的 ID 添加一行?您想选择多少个“ID”?
当闻起来像胶带时,是时候问一下:我们是在重新发明轮子吗?
一般来说,Graph Builder 可以自动完成这些事情,而无需与报告层对话......
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
col_name_list = dt << get column names( string );
newColName = "State";
// New column: State
If( !Contains( col_name_list, newColName ),
Local( {dt, tempStrings},
dt = Data Table( "Big Class" );
dt << New Column( "State", Character, "Nominal" ) << Begin Data Update;
tempStrings = {"CA", "WA", "OR"};
For Each Row( dt, :State = tempStrings[Sequence( 1, 3, 1, 1 )] );
dt << End Data Update;
);
//Make it a double Patty :), another person with the same name.
dt << Add Rows( 1, At End );
//Cheat and use a constant of 41 for the last row index
dt[[41], {name, age, sex, height, weight, State}] = {{"PATTY", 16, "F", 57, 134, "WA"}};
);
// For illustration, select some names
dt << select where( Contains Item( :name, {"LESLIE", "PATTY"} ) );
dist = dt << Distribution(
Stack( 1 ),
Continuous Distribution(
Column( :height ),
Quantiles( 0 ),
Summary Statistics( 0 ),
Horizontal Layout( 1 ),
Normal Quantile Plot( 0 ), // disable, if the user enabled it in the preferences :)
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
),
By( :State )
);
// get all reports
// if there is a BY group, get the info - if there is none, put it into a list
If( Is List( dist ),
dists=dist;
myBys = Transform each ({myexpr} , dist << Get Where Expr, Arg(myExpr , 2 ))
, //no By
dists = Eval List( {dist} );
myBys= {};
);
//get the reports
distRPTs = Transform Each( {dist}, dists, Report( dist ) );
// Find the Midpoints of the bins the selected rows are in
dist << Save( "Level Midpoints" );
//loop though the By groups and add the reflines
For Each( {report, idx}, distRPTs,
//report = distRPTs[2]; idx=2;
selected rows = dt << get selected rows;
// there is a BY group -> restrict the selection
if(N Items(myBys),
Eval( Eval Expr( selected rows = dt << get rows where( Contains( Expr( selected rows ), Row() ) & :State == Expr( myBys[idx] ) ) ) );
);
theBins = (Associative Array( Column( dt, N Cols( dt ) )[selected rows] )) << get keys;
// Get the Increment of the X axis
theIncr = report[AxisBox( 1 )] << get inc;
// Add the reference lines for each selected bin
For Each( {bin, index}, theBins,
//bin = 57; index=1
binList = {};
Insert Into( binList, bin - theIncr / 2 );
Insert Into( binList, bin + theIncr / 2 );
Eval( Eval Expr(report[AxisBox( 1 )] << Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
);
);
dt << delete columns( N Cols( dt ) );回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移通过图形生成器:
New Column( "selected",
Character,
Formula( If( Col Maximum( Selected( Row State() ), :name ), :name, "-" ) )
)
New Window( "try",
H List Box(
Graph Builder( Size( 519, 452 ), Show Control Panel( 0 ), Show Legend( 0 ), Variables( X( :name ) ), Elements( Bar( X ) ) );
gb = Graph Builder(
Size( 487, 500 ),
Show Control Panel( 0 ),
Variables( X( :height ), Wrap( :State ), Color( :selected ) ),
Elements(
Heatmap( X, Legend( 8 ) ),
Histogram( X, Legend( 6 ), Response Scale( "Fill" ) ),
Points( X, Legend( 9 ), Jitter( "None" ) )
),
SendToReport(
Dispatch( {}, "400", ScaleBox,
{Legend Model( 8, Properties( 0, {Transparency( 0 )}, Item ID( "-", 1 ) ) ), Legend Model(
9,
Properties( 0, {Transparency( 0 )}, Item ID( "-", 1 ) )
)}
)
)
);
)
);
(gb << xpath( "//FrameBox" )) << {Marker Drawing Mode( "Outlined" ), Marker Size( 10 ), Transparency( 0.5 ),
Fill Selection Mode( "Unselected Faded" )};
回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移谢谢您的回复。我能够调整代码以处理单个图。在我的分析中,每组条件都有三个子图。我求助于对子图索引进行硬编码。
If( Is List( rptDist ),
dists=rptDist;
myBys1 = Transform each ({myexpr} , rptDist << Get Where Expr, Arg(myExpr , 1 ));
myBys2 = Transform each ({myexpr} , rptDist << Get Where Expr, Arg(myExpr , 2 ));
myBys3 = Transform each ({myexpr} , rptDist << Get Where Expr, Arg(myExpr , 3 ));
, //else condition - no By conditions in Distribution call
dists = Eval List( {rptDist} );
myBys= {};
);迎接新的挑战。因为使用关联数组调用会丢失信息。由于此处的绘图目标已经实现,因此将为下一个挑战创建单独的帖子。
谢谢大家!
回复:根据列值突出显示分布中的箱子,以突出显示箱子迁移嗨,贾莫,
I've added the nested for loops which achieved the desired result. Without the second loop the added reference would only appear in the first of the three plots. Please note that I assigned numOfPlots a constant value of 3. I was looking for a way to interrogate the report(AxisBox... for dimensions, but I did not find the right object to return the correct count.
总共有三个嵌套的 for 循环来产生分布并用参考线对其进行注释。
...
For Each( {report, idx}, distRPTs, //grab each report in the
...
For Each( {bin, index}, theBins, //process bin for each report
...
For( iPlot = 1, iPlot <= numOfPlots, iPlot +=1, << add refer. in each of the subplots.
...
...<BR />For Each( {bin, index}, theBins,
binList = {};
//TBD change bin width to avoid offset when bin width is an odd number
Insert Into( binList, bin - theIncr / 2 );
Insert Into( binList, bin + theIncr / 2 );
For( iPlot = 1, iPlot <= numOfPlots, iPlot +=1,
Eval( Eval Expr(report[AxisBox( iPlot )] << Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
);
);