有没有办法防止窗口滚动到添加框的位置?在下面的示例脚本中,按下“添加样条线”按钮将添加一个新样条线,其 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,使其不可见。 允许用户选择第二条样条的值应该是什么。 换句话说,您并没有添加大量样条,只是发送一条消息来更改一条的平滑因子。 这将消除任何跳跃。
- 使用 Add Graphics Script 更改 Add Spline 按钮的行为以添加曲线,而不是使用 UI messgae Fit Spline。这将需要额外的脚本:使用函数来获取系数、评估、选择颜色、添加图形脚本,
选项 #1 将是最简单的
JMP UI 滑块预测您要模拟的内容,用户可以调整平滑因子。

谢谢您的帮助!我会看看我是否可以完成这项工作,但我认为这种方法最终对我不起作用——我正在修改一个由各种报告调用以生成图表的函数——我无法添加滚动框报告。我能想到的唯一对我有用的解决方案是简单地防止新内容触发滚动机制。
您使用的是哪个版本的 JMP?
附上2个脚本: scrollers_ob.jsl和滚动条.jsl
两者本质上是相同的脚本,除了滚动动作。
scrollers_ob.jsl
- 仅使用 VListBox()、vlb 和 Scroll Window() 到包含用户刚刚按下的按钮的轮廓框。 但是,如果用户滚动到第 6 个显示器,则显示器 5 的一部分显示它会将显示器 6 弹出到顶部。 用户仍在查看感兴趣的图形,并且滚动动作很流畅。
scrollers0.jsl
- 对 vlb 使用 ScrollBox() 包装器 sb。ScrollBox 有一个很好的功能 << 获取滚动位置。 使用该功能,设置滚动位置,用户将看到完全相同的位置,但是,显示跳跃,不流畅。
这两个脚本都使用表达式来消除难以阅读和维护的“千篇一律”代码。 请注意,它会为每个按钮框、每个双变量和每个“显示”轮廓框创建句柄/引用。右键单击任何按钮 > 选择编辑 > 选择设置脚本以查看对双变量等的引用。
作为对 JSL 大师的仅供参考,我确实尝试将 Set Function() 用于 ButtonBox(),并使用其父级和兄弟级。 但是,我很惊讶, 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 个 Outline Box 的 Xpath 会更直接。
Names Default To Here( 1 );
n = 100;
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
xp = Expr(report(obj)[OutlineBox(cnt)] <<VISIBILITY></VISIBILITY>