Allow Auto-Bounds to Include or Exclude Specific Datasets

Đang mở
#100 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
data-visualization

Hướng nghiên cứu

Bắt đầu từ API auto_bounds của egui_plot và theo dõi cách các chuỗi được vẽ hiện đóng góp vào các giới hạn x/y, bao gồm cả hành vi hiện có của include_x và include_y. Xác định cách các bộ lọc include và exclude sẽ nhận diện các chuỗi có tên, sau đó xác minh auto-bounds với các pane được liên kết và các cập nhật mượt mà mà không cần giải pháp tạm thời reset rồi áp dụng lại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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_bounds
  • exclude(&[&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/exclude filter for auto_bounds would greatly simplify my code and preserve smooth interactions by avoiding the need to reset and reapply manual bounds every frame.
  • set_plot_bounds works 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.
Ngôn ngữ chính
Rust
Star
494
Fork
110
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của emilk/egui_plot

Tất cả issue của emilk/egui_plot

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.