Allow Auto-Bounds to Include or Exclude Specific Datasets
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- rust
调研方向
从 egui_plot 的 auto_bounds API 开始,追踪当前绘制的系列如何影响 x/y 范围,包括现有的 include_x 和 include_y 行为。定义 include 和 exclude 过滤器应如何识别具名系列,然后在使用链接窗格和平滑更新的情况下验证 auto-bounds,无需采用重置后重新应用的变通方案。
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
I’m building a trading terminal using egui and egui_plot. Right now, auto_bounds considers all series when computing plot limits. I’d like to exclude certain datasets (for example, indicators) so that auto-bounds apply only to the primary data (e.g., candlesticks).
Describe the solution you'd like
Add an API to include or exclude named series when computing auto-bounds. For example:
plot
.auto_bounds([false, true])
.include(vec!["ohlc"])
// or
plot
.auto_bounds([false, true])
.exclude(vec!["bbu", "bbl"])
include(&[&str]): only these series affect auto_boundsexclude(&[&str]): all series except these affect auto_bounds
Describe alternatives you've considered
Currently, I disable auto-bounds entirely, track the plot’s visible bounds each frame, and then manually re-apply the desired x/y limits when there hasn’t been any interaction:
if !pane.interacting &&
(pane.needed_plot_bounds.min()[1] != pane.plot_bounds.min()[1]
|| pane.needed_plot_bounds.max()[1] != pane.plot_bounds.max()[1])
{
plot = plot.reset(); // because include_x and include_y only works once after reset
}
plot.auto_bounds([false, false])
.include_x(pane.needed_plot_bounds.min()[0])
.include_x(pane.needed_plot_bounds.max()[0])
.include_y(pane.needed_plot_bounds.min()[1])
.include_y(pane.needed_plot_bounds.max()[1])
.link_axis(LINK_GROUP_ID, Vec2b::new(true, false))
.link_cursor(LINK_GROUP_ID, Vec2b::new(true, false))
.show(ui, |plot_ui| {
// to update plot_bounds, needed_plot_bounds and interacting
pane.update_plot_bounds(plot_ui.plot_bounds());
});
This workaround incurs a noticeable “jump” whenever bounds update, resulting in a less smooth scrolling/zooming experience.
Additional context
- A built-in
include/excludefilter forauto_boundswould greatly simplify my code and preserve smooth interactions by avoiding the need to reset and reapply manual bounds every frame. set_plot_boundsworks smoothly when there is only one pane. However, when multiple panes are linked together, it fails to update bounds correctly, making the workaround unusable in a multi-pane layout.
- 主要语言
- Rust
- 星标
- 494
- 派生
- 110
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
emilk/egui_plot 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
-
bug
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 3/5 1-2 天 新手友好度 66/100
-
难度 4/5 3-5 天 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 45/100
相似的 Issue
-
claim
难度 2/5 1-3 小时 新手友好度 88/100
Nixitov/Riptide-Native#946 ·
维护者通常 1 天内回复
-
area: ai-assistants documentation help wanted
难度 2/5 1-3 小时 新手友好度 78/100
BetaBots-LLC/latticegate#17 ·
-
难度 1/5 1 小时以内 新手友好度 94/100
storytold/craft-libs#5594 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
LingyunStudio/RustMusic#16 ·