JMP 腳本公式可根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中您好,我有一個腳本,可以創建一些數據點的附加圖,並用附加的折線圖覆蓋它。 我現在需要能夠計算多個不同 x 坐標中高點和低點之間的增量。 我能夠執行第一個操作,因為它包含所有 x 坐標值,但我對如何僅對橙色計算線之間的 x 坐標值以及僅對上的唯一初始曲線執行此操作感到困惑橙色線內的左側和右側均計算。 如果可能的話,我想在圖表上顯示這些值,或者在製作圖表時顯示的文本框中顯示這些值。 我添加了一些圖像來幫助解釋我需要計算增量的 4 個不同範圍,並添加了我當前的腳本。 橙色線可能會根據數據而變化,因為它基於用戶運行腳本時輸入的值。 非常感謝任何幫助。 謝謝!



framex_value = "";
w = New Window( "Frame size X",// opens a window with a title and this content...
<<RETURN result=""> (76200 - framex_value/2) & :X coordinate < (76200 - framex_value/2) );
//dt << delete rows:
//FieldMat = matrix(Col Max(IntenCD)-(Col Min(IntenCD)));
New Window( " Delta results: ", modal,
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H List Box( Text Box( "Full plate delta: " ), TextBox( Char( FullMat ) ) ),
//Spacer Box( size( 1, 10 ) ), // a little vertical space
//H List Box( Text Box( "Full field delta: " ), TextBox( Char( FieldMat ) ) ),
//Spacer Box( size( 1, 10 ) ), // a little vertical space
//H List Box( Text Box( "Edge of field delta: " ), TextBox( Char( 0 ) ) ),
))
);
// Determine X Matrix
xMat = matrix(76200 - (framex_value/2)) |/ matrix(76200 - (framex_value/2)) |/
matrix(76200 + (framex_value/2)) |/ matrix(76200 + (framex_value/2));
// The yMat is static
yMat = [1, 0.92, 0.92, 1];
gb = dt << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :X Coordinate ), Y( :Normalized ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
Pen Color( "orange" );
Pen Size( 2 );
Line( xmat, ymat );
);
report(gb)[AxisBox(2)] << min(.91);
w << closeWindow; // just the dialog, not the report
)
)
)
)
);</RETURN>質量和工藝工程回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中很好,謝謝@tx尼爾森。 這兩個改變起到了作用。 現在工作完美。 再次感謝您對此提供的所有幫助!
回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中默認情況下,當 JMP 創建變量(例如您的 xMat 等)時,該變量將保留直至更改。而且,如果在第一次運行代碼時,尚未創建所需的變量,那麼當您在代碼中請求它時,它將沒有值來提供程序,然後某些計算將無法進行被運行。但是,如果稍後在腳本中設置了該變量,它將保持設置狀態,直到刪除或更改為止。因此,當您第二次運行腳本時,代碼會達到第一次運行腳本時找不到所需變量的程度,這次它會找到它,因為它是在稍後設置的上次運行腳本期間代碼中的時間。
我找到了一個可能發生這種情況的地方。您在數據表上的活動完成後設置變量 dt。我將代碼行移到了腳本中的更上方,這樣代碼就可以在第一次運行時正常工作。我還將“Clear Symbols()”放置為腳本的第一行。這將在腳本開始時清除代碼中的所有變量。這將確保引用的變量值必須在本次代碼運行中創建,因為上次運行的所有值都已被刪除。嘗試一下代碼,看看它是否有效。
Clear Symbols();
Names Default To Here( 1 );
ramex_value = "";
w = New Window( "Frame size X", // opens a window with a title and this content...
<<RETURN result=""> (76200 - (framex_value / 2)) & dt:X coordinate < (76200 + (framex_value / 2)),
dt:Normalized,
.
)
) - Col Max( dt:Normalized ) - Col Min( dt:Normalized ) + 1;
Col Min( If( dt:X coordinate > (76200 - (framex_value / 2)) & dt:X coordinate < (76200 + (framex_value / 2)), dt:Normalized, . ) );
// Graph Builer and Delta display
gb = dt << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( dt:X Coordinate ), Y( dt:Normalized ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
Pen Color( "orange" );
Pen Size( 2 );
Line( xmat, ymat );
// Add the results to the chart
Text( Boxed, {75000, .94}, "Overall Delta = " || Char( Format( overallDelta, 7, 4 ) ) );
Text( Boxed, {75000, .93}, "Within Frame Delta = " || Char( Format( withinOrangeDelta, 7, 4 ) ) );
);
Report( gb )[AxisBox( 2 )] << Min( .91 );
w << closeWindow;
)
)
)
)
);</RETURN>回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中因此,在對我的腳本進行進一步測試後,它似乎運行完美(我第二次在數據上運行它),但不是第一次。 第一次運行後,它不會計算和顯示增量,但第二次運行腳本時它確實有效......我很困惑。 我附上了清理後的代碼,以及第一次運行沒有結果的圖片......以及第二次運行成功結果的圖片。 我錯過了什麼導致我的腳本第一次無法正常工作?
framex_value = "";
w = New Window( "Frame size X",// opens a window with a title and this content...
<<RETURN result=""> (76200 - (framex_value / 2)) & :X coordinate < (76200 + (framex_value / 2)),
:Normalized,
.
)
) - Col Max( :Normalized ) - Col Min( :Normalized ) +1;
Col Min(
If( :X coordinate > (76200 - (framex_value / 2)) & :X coordinate < (76200 + (framex_value / 2)),
:Normalized,
.
)
);
// Graph Builer and Delta display
gb = dt << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :X Coordinate ), Y( :Normalized ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
Pen Color( "orange" );
Pen Size( 2 );
Line( xmat, ymat );
// Add the results to the chart
Text( Boxed, {75000, .94}, "Overall Delta = " || Char( Format( overallDelta, 7, 4 ) ) );
Text( Boxed, {75000, .93}, "Within Frame Delta = " || Char( Format( withinOrangeDelta, 7, 4 ) ) );
);
Report( gb )[AxisBox( 2 )] << Min( .91 );
w << closeWindow;
)
)
)
)
);</RETURN>

回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中謝謝@tx尼爾森。我能夠弄清楚這一點並且它運行完美。 我發現我需要在 xy 坐標周圍放置 { } 才能使文本顯示在圖表中。 我非常感謝您對我的腳本的所有知識和幫助!
回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中這個額外的解釋是有道理的。 我會根據您的建議進行工作。 謝謝。
回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中
// Is the purpose of the display window below, only to display the values of overallDelta and withinOrangeDelta?
// That is all it is going to do. It does not allow for any data input, just displaying of those values
overallDelta = 22;
withinOrangeDelta = 15;
New Window( " Delta results: ",
modal,
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H List Box( Text Box( "Full plate delta: " ), Text Box( Char( overallDelta, 7, 4 ) ) ),
Spacer Box( size( 1, 10 ) ), // a little vertical space
H List Box( Text Box( "Full field delta: " ), Text Box( Char( withinOrangeDelta, 7, 4 ) ) ),
Spacer Box( size( 1, 10 ) ), // a little vertical space
H List Box( Text Box( "Edge of field delta: " ), Text Box( Char( 0 ) ) ),
)
)
);
// The leftDelta and rightDelta calculations will be similar to the above withinOrangeDelta, but
// I don't know what the upper and lower boundry values of :Normalized are or what the interior
// boundrys for the calclations are
// The code below will create your X Coordinate by Normalized graph
// If you have generated the xmat and ymat matrices, it will draw your orange line on the chart
// Then at a fixed XY point on the graph, of 500,.92 it will add in the text "Overall Delta = nn.nnnn"
// It is likely, that different data from your sample data will make the positioning of the statistics
// inapproprate if you have a hardwired value of 500,.92 for the display. So you will need to determine
// what those values need to be. You can get the values by determining the minimum values in the data table
// or you can query the displayed graph to get the axis minimums and then set the position from there.
gb = dt << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :X Coordinate ), Y( :Normalized ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
Pen Color( "orange" );
Pen Size( 2 );
Line( xmat, ymat );
// Add the results to the chart
Text( 500, .92, "Overall Delta = " || Char( Format( overallDelta, 7, 4 ) ) );
Text( 500, .915, "Within Delta = " || Char( Format( withinOrangeDelta, 7, 4 ) ) );
);
Report( gb )[AxisBox( 2 )] << Min( .91 );
// I don't see any window reference called "w"
w << closeWindow; // just the dialog, not the report回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中不用擔心,這就是我想知道的。
圖表中顯示的文本怎麼樣? 我沒有看到這個。 我可以製作一個在帶有值的圖表之前打開的彈出窗口,但我真的很喜歡您將這些值顯示在圖表上的想法,以便可以通過圖表查看它們。 我在那裡缺少什麼嗎?
我只包含了腳本的結尾以供參考。
再次感謝您對此的所有幫助!
New Window( " Delta results: ", modal,
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H List Box( Text Box( "Full plate delta: " ), TextBox( Char( overallDelta, 7,4 ) ) ),
Spacer Box( size( 1, 10 ) ), // a little vertical space
H List Box( Text Box( "Full field delta: " ), TextBox( Char( withinOrangeDelta, 7,4 ) ) ),
Spacer Box( size( 1, 10 ) ), // a little vertical space
H List Box( Text Box( "Edge of field delta: " ), TextBox( Char( 0 ) ) ),
))
);
// The leftDelta and rightDelta calculations will be similar to the above withinOrangeDelta, but
// I don't know what the upper and lower boundry values of :Normalized are or what the interior
// boundrys for the calclations are
gb = dt << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :X Coordinate ), Y( :Normalized ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
Pen Color( "orange" );
Pen Size( 2 );
Line( xmat, ymat );
// Add the results to the chart
text ( 500,.92, "Overall Delta = " || char(format(overallDelta, 7,4)));
text ( 500,.915, "Within Delta = " || char(format(withinOrangeDelta, 7,4)));
);
report(gb)[AxisBox(2)] << min(.91);
w << closeWindow; // just the dialog, not the report
)
)
)
)
);回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中是的......顯然這是我的錯字......抱歉回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中所以代碼中的實例是:Normalize,這實際上應該是:Normalized?

回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中標準化列是根據您提供的數據表創建的。您使用什麼數據來創建您顯示的圖表......“標準化”列用作這些圖表中的軸值之一
回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中感謝您對此的幫助,但我仍然遇到一些問題。 當我運行腳本時,我收到以下錯誤。
名稱未解析:在“Normalize”的訪問或評估中標準化{16},:Normalize/*###*/
另外,如果我註釋掉有問題的這一部分,以測試顯示註釋,它們不會顯示在圖表中。
您能幫我理解這些問題嗎?
謝謝。
回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中太好了,謝謝。 這看起來很棒。 我會嘗試一下,看看效果如何。 我真的很感謝您對此的幫助。
回复:JMP 腳本公式根據 .csv 文件的 X 坐標計算多個不同範圍的增量並顯示在圖形或文本框中我已經在您的圖表中添加了一些代碼(未經測試的代碼),它將計算總體和增量。左右增量計算需要定義框的規則。
我還為這兩個值添加了一個非常簡單的顯示。
在這兩種情況下,我都會向您提供為您的代碼提供這些後續增強功能所需採取的方法。我不能保證完美的代碼,但你應該看到這個概念並能夠從那裡得到它
framex_value = "";
w = New Window( "Frame size X",// opens a window with a title and this content...
<<RETURN result=""> (76200 - framex_value/2) & :X coordinate < (76200 - framex_value/2) );
//dt << delete rows:
//FieldMat = matrix(Col Max(IntenCD)-(Col Min(IntenCD)));
New Window( " Delta results: ", modal,
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H List Box( Text Box( "Full plate delta: " ), TextBox( Char( FullMat ) ) ),
//Spacer Box( size( 1, 10 ) ), // a little vertical space
//H List Box( Text Box( "Full field delta: " ), TextBox( Char( FieldMat ) ) ),
//Spacer Box( size( 1, 10 ) ), // a little vertical space
//H List Box( Text Box( "Edge of field delta: " ), TextBox( Char( 0 ) ) ),
))
);
// Determine X Matrix
xMat = matrix(76200 - (framex_value/2)) |/ matrix(76200 - (framex_value/2)) |/
matrix(76200 + (framex_value/2)) |/ matrix(76200 + (framex_value/2));
// The yMat is static
yMat = [1, 0.92, 0.92, 1];
// The overall delta
overallDelta = Col Max( :Normalized ) - Col Min( :Normalized );
// The delta between the lines
withinOrangeDelta = Col Max(
If( :X coordinate > (76200 - (framex_value / 2)) & :X coordinate < (76200 + (framex_value / 2)),
:Normalize,
.
)
) - Col Max( :Normalized ) - Col Min( :Normalized );
withinOrangeDelta = Col Min(
If( :X coordinate > (76200 - (framex_value / 2)) & :X coordinate < (76200 + (framex_value / 2)),
:Normalize,
.
)
);
// The leftDelta and rightDelta calculations will be similar to the above withinOrangeDelta, but
// I don't know what the upper and lower boundry values of :Normalized are or what the interior
// boundrys for the calclations are
gb = dt << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :X Coordinate ), Y( :Normalized ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
Pen Color( "orange" );
Pen Size( 2 );
Line( xmat, ymat );
// Add the results to the chart
text ( 500,.92, "Overall Delta = " || char(format(overallDelta, 7,4)));
text ( 500,.915, "Within Delta = " || char(format(withinOrangeDelta, 7,4)));
);
report(gb)[AxisBox(2)] << min(.91);
w << closeWindow; // just the dialog, not the report
)
)
)
)
);</RETURN>