BokehJS BoxZoomTool 默认情况下始终处于活动状态,即使设置为 active: false

发布于 2025-01-20 09:11:46 字数 503 浏览 0 评论 0 原文

在bokehjs 2.4.2中,即使在添加工具时将活动> active 属性设置为 false 时,BoxZoomTool始终处于活动状态。

const box_zoom = new Bokeh.BoxZoomTool({
    active: false,
});
plot.add_tools(box_zoom);

使用其他工具,例如 freehandDrawTool ,默认情况下该工具不活跃,并且活动属性不被忽略。

默认情况下,如何添加boxzoomtool而不活跃?

In BokehJS 2.4.2 the BoxZoomTool is always active by default, even when setting the active property to false when adding the tool.

const box_zoom = new Bokeh.BoxZoomTool({
    active: false,
});
plot.add_tools(box_zoom);

With other tools, such as the FreehandDrawTool, the tool is not active by default and the active property is not ignored.

How do you add the BoxZoomTool without being active by default?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

微凉徒眸意 2025-01-27 09:11:46

BoxZoomTool没有参数活动,因此在示例中忽略了关键字。

要设置活动的工具,请查看此文档

在您的情况下,行 p.toolbar.active_drag = none 可以做到这一点,它停用了所有 pan/drag tools ,并且您只能在其上进行。
此行接受“ auto” pan/drag 的实例。

python示例

from bokeh.plotting import show, figure, output_notebook
from bokeh.models import BoxZoomTool
output_notebook()

p = figure(width=300, height=300, tools='')
box_zoom = BoxZoomTool()
p.line(x=[1,2,3,4,5], y=[1,2,3,4,5])
p.toolbar.active_drag = None # could also be "auto" or box_zoom
p.add_tools(box_zoom)

show(p)

”在此处输入图像说明“

这可以适应JS。

The BoxZoomTool has no parameter active, therefor the keyword is ignored in your example.

To set tools active, please check out this documentation.

In your case the line p.toolbar.active_drag = None does the trick, which deactivates all pan/drag tools, and you have only on off it.
This line accepts "auto", None or an instance of pan/drag.

Python Example

from bokeh.plotting import show, figure, output_notebook
from bokeh.models import BoxZoomTool
output_notebook()

p = figure(width=300, height=300, tools='')
box_zoom = BoxZoomTool()
p.line(x=[1,2,3,4,5], y=[1,2,3,4,5])
p.toolbar.active_drag = None # could also be "auto" or box_zoom
p.add_tools(box_zoom)

show(p)

enter image description here

This can be adapted to JS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文