Auto bounds breaks link_axis and link_cursor

Aperta
#75 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust

Direzione di ricerca

Inizia eseguendo la riproduzione Rust fornita con le dipendenze di Cargo.toml, quindi esamina l’implementazione di auto bounds, link_axis e link_cursor. Il lavoro è completato quando gli assi e i cursori dei plot collegati rimangono allineati per plot con larghezze dei dati diverse mentre auto bounds è attivo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Describe the bug

While auto bounds is active link_axis and link_cursor does not work if the plot data for the different plots have a different width.

The linking works if the user zoom's in, but when the user double clicks to enable auto bounds the plots are unaligned again.

To Reproduce

Run the following example:

use eframe::egui;
use egui_plot::Line;

fn main() -> eframe::Result {
    let native_options = eframe::NativeOptions::default();

    eframe::run_simple_native("UnalignedPlots", native_options, move |ctx, _frame| {
        egui::CentralPanel::default().show(ctx, |ui| {
            let plot_height = ui.available_height() / 2.0;

            egui_plot::Plot::new("Plot1")
                .height(plot_height)
                .link_axis("plot_axis", [true, false])
                .link_cursor("plot_cursor", [true, false])
                .show(ui, |ui| {
                    ui.line(Line::new(vec![[0.0, 1.0], [10.0, 0.5]]));
                });

            egui_plot::Plot::new("Plot2")
                .height(plot_height)
                .link_axis("plot_axis", [true, false])
                .link_cursor("plot_cursor", [true, false])
                .show(ui, |ui| {
                    ui.line(Line::new(vec![[5.0, 0.5], [7.0, 1.0]]));
                });
        });
    })
}

Cargo.toml:

[package]
name = "unaligned_plots"
version = "0.1.0"
edition = "2021"

[dependencies]
egui = "0.31"
egui_plot = { git = "https://github.com/emilk/egui_plot", branch = "main" }
eframe = { version = "0.31", default-features = false, features = ["x11", "default_fonts", "wgpu"] }

Expected behavior

The x axis for both the cursor and the plot should be linked even while auto bounds is active.

Screenshots

Image

As can be seen in the image both cursor and plot axis are not aligned properly.

Lingua principale
Rust
Stelle
494
Fork
110
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di emilk/egui_plot

Tutte le issue di emilk/egui_plot

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.