Auto bounds breaks link_axis and link_cursor

オープン
#75 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust

調査の方向性

まず、Cargo.toml の依存関係を使って提供されている Rust の再現コードを実行し、次に auto bounds、link_axis、link_cursor の実装を調べます。auto bounds が有効な状態で、データ幅が異なる plot でもリンクされた plot の軸とカーソルが整列したままになれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
494
フォーク
110
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

emilk/egui_plot のほかの issue

emilk/egui_plot の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。