有没有办法阻止窗口滚动到添加框的位置?在下面的示例脚本中,按“添加样条线”按钮将添加一条新样条线,其 lambda 值是之前的样条线的一半,按该按钮 6 次左右后,窗口会从图形滚动到该样条线的位置。新添加的控制样条线。
这是一个示例 - 解决方案不是简单地从显示中删除其他控制图。在我的实际代码中,我使用 biv << (Curve[1] << Report( 0 )) 命令删除控制图,但它仍然滚动。
任何帮助将不胜感激。
谢谢!
Names Default To Here( 1 );
n = 100;
New Window( "test",
V List Box(
b = Button Box( "Add Spline",
n = n / 2;
obj << Fit Spline( n, Standardized );
),
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj = Bivariate( Y( :Weight ), X( :Height ) );
obj << Fit Spline( n, Standardized );
)
);您是否考虑过使用带有选择器的选项卡式报告?见下图。或者您是否正在为每个视图创建一个包含多个图形的页面,例如并排图形。
此外,其他替代方案还有:
- 使用带有折叠(隐藏)框的两条样条线创建双变量。 在用户选择一个值或按钮之前,将第二条样条线的线宽设置为 0,使其不可见。 允许用户选择第二条样条线的值。 换句话说,您不需要添加大量样条曲线,只需发送一条消息来更改其中一个样条曲线的平滑因子即可。 这将消除任何跳跃。
- 更改“添加样条线”按钮的行为,以使用“添加图形脚本”添加曲线,而不是使用 UI 消息“拟合样条线”。这将需要额外的脚本:使用函数获取系数、评估、选择颜色、添加图形脚本,
选项#1是最简单的
JMP UI 滑块会预测您尝试模拟的内容,用户可以调整平滑系数。

谢谢您的帮助!我会看看我是否可以做到这一点,但我认为这种方法最终对我不起作用——我正在修改一个由各种报告调用来生成图表的函数——我无法添加滚动框报告。我能想到的唯一对我有用的解决方案就是简单地防止新内容触发滚动机制。
您使用的是哪个版本的 JMP?
附2个脚本:滚动条_ob.jsl和滚动条.jsl
除了滚动操作之外,两者本质上是相同的脚本。
滚动条_ob.jsl
- 仅使用 VListBox()、vlb 和 Scroll Window() 来显示包含用户刚刚按下的按钮的轮廓框。 然而,如果用户滚动到第 6 个显示屏,则显示屏 5 的一部分将显示它将显示屏 6 弹出到顶部。 用户仍然可以看到感兴趣的图表,并且滚动动作很流畅。
滚动条0.jsl
- 对 vlb 使用 ScrollBox() 包装器 sb。ScrollBox 有一个很好的函数 << 获取滚动位置。 使用该函数设置滚动位置,用户将看到完全相同的位置,但是显示是跳跃的,不平滑。
这两个脚本都使用表达式来消除难以阅读和维护的“千篇一律”代码。 请注意,它创建每个按钮框、每个二元变量和每个“显示”轮廓框的句柄/引用。右键单击任何按钮 > 选择编辑 > 选择设置脚本以查看对二元变量等的引用。
作为对 JSL 大师的仅供参考,我确实尝试对 ButtonBox() 使用 Set Function(),并使用其父级和同级。 然而,我很惊讶,vlb << Scroll Window(this) 对我不起作用。这可能是一个编码错误。 我没有花太多时间在上面,因为我认为代码可能太迟钝而无法提供信息。
感谢您的帮助!但是,我的问题是我不想显示摘要的任何部分,我只想绘制样条线。为此,我使用了 Visibility( "Collapse" ) 和 (Curve[x] << Report(0)) 命令,这成功地阻止了报告的显示。然而,屏幕仍然在移动,就像它们被显示一样。
我在这里提供了一个更完整的示例。单击添加样条线的按钮会立即滚动到图形不再可见的位置,即使(最终)没有显示新内容。
我有一个在我的公司中使用的报告,该报告在一个页面中有很多图形,就像这个例子一样,并且能够交互式地添加样条曲线是非常有用的,但是当感兴趣的图形因此移出屏幕时,它也会变得非常有用处理起来很烦人。
任何帮助将不胜感激!
Names Default To Here( 1 );
n = 100;
New Window( "test",
V List Box(
Outline Box( "a display",
a1 = 1;
V List Box(
b = Button Box( "Add Spline",
n = n / 2;
a1++;
obj1 << Fit Spline( n, Standardized ) << (Curve[a1] << Report( 0 ));
),
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj1 = Bivariate( Y( :Weight ), X( :Height ) );
obj1 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
(obj1 << Report())[List Box( 5 )] << Visibility( "Collapse" );
(obj1 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
);
),
Outline Box( "a display",
a2 = 1;
V List Box(
b = Button Box( "Add Spline",
n = n / 2;
a2++;
obj2 << Fit Spline( n, Standardized ) << (Curve[a2] << Report( 0 ));
),
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj2 = Bivariate( Y( :Weight ), X( :Height ) );
obj2 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
(obj2 << Report())[List Box( 5 )] << Visibility( "Collapse" );
(obj2 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
);
),
Outline Box( "a display",
a3 = 1;
V List Box(
b = Button Box( "Add Spline",
n = n / 2;
a3++;
obj3 << Fit Spline( n, Standardized ) << (Curve[a3] << Report( 0 ));
),
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj3 = Bivariate( Y( :Weight ), X( :Height ) );
obj3 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
(obj3 << Report())[List Box( 5 )] << Visibility( "Collapse" );
(obj3 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
);
),
Outline Box( "a display",
a4 = 1;
V List Box(
b = Button Box( "Add Spline",
n = n / 2;
a4++;
obj4 << Fit Spline( n, Standardized ) << (Curve[a4] << Report( 0 ));
),
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj4 = Bivariate( Y( :Weight ), X( :Height ) );
obj4 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
(obj4 << Report())[List Box( 5 )] << Visibility( "Collapse" );
(obj4 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
);
),
Outline Box( "a display",
a5 = 1;
V List Box(
b = Button Box( "Add Spline",
n = n / 2;
a5++;
obj5 << Fit Spline( n, Standardized ) << (Curve[a5] << Report( 0 ));
),
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj5 = Bivariate( Y( :Weight ), X( :Height ) );
obj5 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
(obj5 << Report())[List Box( 5 )] << Visibility( "Collapse" );
(obj5 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
);
),
Outline Box( "a display",
a6 = 1;
V List Box(
b = Button Box( "Add Spline",
n = n / 2;
a6++;
obj6 << Fit Spline( n, Standardized ) << (Curve[a6] << Report( 0 ));
),
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj6 = Bivariate( Y( :Weight ), X( :Height ) );
obj6 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
(obj6 << Report())[List Box( 5 )] << Visibility( "Collapse" );
(obj6 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
);
),
Outline Box( "a display",
a7 = 1;
V List Box(
b = Button Box( "Add Spline",
n = n / 2;
a7++;
obj7 << Fit Spline( n, Standardized ) << (Curve[a7] << Report( 0 ));
),
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj7 = Bivariate( Y( :Weight ), X( :Height ) );
obj7 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
(obj7 << Report())[List Box( 5 )] << Visibility( "Collapse" );
(obj7 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
);
),
Outline Box( "a display",
a8 = 1;
V List Box(
b = Button Box( "Add Spline",
n = n / 2;
a8++;
obj8 << Fit Spline( n, Standardized ) << (Curve[a8] << Report( 0 ));
),
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj8 = Bivariate( Y( :Weight ), X( :Height ) );
obj8 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
(obj8 << Report())[List Box( 5 )] << Visibility( "Collapse" );
(obj8 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
);
),
Outline Box( "a display",
a9 = 1;
V List Box(
b = Button Box( "Add Spline",
n = n / 2;
a9++;
obj9 << Fit Spline( n, Standardized ) << (Curve[a9] << Report( 0 ));
),
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj9 = Bivariate( Y( :Weight ), X( :Height ) );
obj9 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
(obj9 << Report())[List Box( 5 )] << Visibility( "Collapse" );
(obj9 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
);
)
)
);从交互式 UI 的角度来看,滚动到适合摘要是有意义的。该脚本使用两个有用的 JMP 显示框函数/方法:Visibility() 和 Scroll Window()。 Scroll Window() 用于始终返回到显示的顶部,可见性用于“折叠”与样条线关联的轮廓框。
请注意,为了简单起见,此脚本使用轮廓框计数。然而,使用从 Bivar Spline 开始的 helpKey 来查找第 k 个轮廓框的 Xpath 会更直接。
Names Default To Here( 1 );
n = 100;
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
xp = Expr(report(obj)[OutlineBox(cnt)] <<VISIBILITY></VISIBILITY>