根據列值突出顯示分佈中的 bin,以突出顯示 bin 遷移我有一組包含一定數量單位的分佈。我使用select where和containsitem呼叫來選擇資料集中與特定 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
)
);

我想要實現的目標的模型:

基礎資料分析與建模可靠度分析回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移您可以從範例資料夾中選擇一個合適的檔案並建立模型來說明該問題嗎?
好處:
- 節省時間(#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" )} )
)
);
回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移你可以用參考線來做到這一點
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);
);

要在所有發行版中獲得相同的顏色,您可以為日期設定值顏色屬性並在設定顏色時使用它,或者建立顏色清單並按順序使用它們。
回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移以下是我對如何做到這一點的看法。它會找到選定的行以及與其關聯的容器,然後根據需要添加參考線。

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 處理程序,以及一些首先刪除任何現有參考線,然後添加新參考線的邏輯。
回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移一個需要回答的問題:
應該如何分配顏色以及如何標記範圍。
例如,如果所選 ID 的 6/20 資料為:48、90(77、56、...)。
或者反之亦然:我們能否確定某一日期所有選取設備 ID 的資料都位於同一個 bin 中?
回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移著名的。謝謝。我將按照您的建議調整我的問題以使用可用數據。
回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移感謝您的支持。
我能夠按照您和@jthi 的建議使用新增引用。我使用該方法進行著色並確認它適用於單一發行版。當我添加“按條件”時,我失去了繪圖尋址功能,從而導致錯誤。
根據@hogi的建議,我切換到了這個問題的可用數據。為了幫助解決這個問題,我在吉姆腳本的修改版本中增強了 Big Class。這是我遵循的步驟和結果
1.導入大類
2.如果表中沒有「State」列,則有條件地添加一些數據
一個。新增一個名為 State 的列,其中包含排序數據,以將人員置於「CA」、「WA」或「OR」中。
b.加入第二個“PATTY”,其年齡為 16、“F”、57、134,位於“WA”。
3. 選擇一些名稱。我選擇了萊斯利和帕蒂
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 = Report( dist )["高度",AxisBox( 1 )];
distRPT = Report( dist )["州=WA","高度",AxisBox( 1 )];
distRPT = Report( dist["州=WA"] )["高度",AxisBox( 1 )];
範例錯誤代碼:在存取或評估'Report(dist)[ /*###*/AxisBox(1)]' 、 Report( dist )[/*###*/AxisBox( 1 ) 時,物件在第41行不可下標)]
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 ) ) );
);
感謝您的評論與指導。
謝謝!
布萊恩
回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移好的 : )
關於“找到右軸框”,願望清單中的這個願望:
透過 JSL 更輕鬆地從報告中獲取結果
狀態為“在隊列中” - 我希望,除了“更容易從報告中獲取結果”之外,它還有助於找到正確的軸框...
回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移我的第一個猜測是,當您使用 By 時,您正在嘗試在清單上使用 Report() 函數(使用 Show(dist); 檢查 dist 包含的內容)
回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移如果您需要 BY 群組,情況會變得有點複雜。
每個子圖可以有不同的 bin 寬度。這就是為什麼需要 for 迴圈:
- 取得各個 bin 的寬度。
- 取得特定子圖的選定行
- 將參考線加入特定的子圖中。
嗯,也許重新考慮陰影區域的想法 - 我們也有顏色的問題。
目前,我們只是為每個選定的垃圾箱應用不同的顏色。陰影區域看起來不錯 - 但寬度是相當任意的。也許只是為每個選定的 ID 添加一行?您要選擇多少個「ID」?
當它聞起來像膠帶時,是時候問一下:我們正在重新發明輪子嗎?
一般來說,圖形產生器可以自動完成這些事情,而不需要與報表層對話...
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 ) );回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移透過圖形產生器:
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" )};
回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移感謝您的回覆。我能夠調整代碼來解決個別情節。在我的分析中,每組條件都有三個子圖。我對子圖索引進行了硬編碼。
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= {};
);迎接新的挑戰。因為使用關聯數組呼叫會遺失資訊。由於這裡的策劃目標已經實現,因此將為下一個挑戰創建一個單獨的帖子。
謝謝大家!
回覆:根據列值突出顯示分佈中的 bin 以突出顯示 bin 遷移嗨,賈莫,
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 ) ) );
);
);