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>