We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The area chart renderer creates unnecessary and wrong triangles.
use egui_plotter::Chart; use eframe::egui::{self}; use plotters::prelude::*; fn main() { test_chart(); let options = eframe::NativeOptions { initial_window_size: Some(egui::vec2(320.0, 240.0)), ..Default::default() }; let _ = eframe::run_native("Test", options, Box::new(|_cc| Box::<App>::new(App::default()))); } struct App { chart: Chart } impl Default for App { fn default() -> Self { Self { chart: create_chart()} } } impl eframe::App for App { fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { ctx.request_repaint(); egui::CentralPanel::default().show(ctx, |ui| { self.chart.draw(ui); }); } } fn create_chart() -> Chart { Chart::new() .builder_cb(Box::new(|area, _t, _| { let mut chart = ChartBuilder::on(area) .set_label_area_size(LabelAreaPosition::Left, 40) .set_label_area_size(LabelAreaPosition::Bottom, 40) .margin(5) .build_cartesian_2d(0..10, 0..50) .unwrap(); chart.configure_mesh().draw().unwrap(); let data = [25, 37, 15, 32, 45, 33, 32, 10, 29, 0, 21]; chart .draw_series( AreaSeries::new((0..).zip(data.iter().enumerate().map(|x| (*x.1 as i32))), 0, &RED.mix(0.2)).border_style(&RED) ) .unwrap(); })) } pub fn test_chart() { let root_area = BitMapBackend::new("image.png", (600, 400)) .into_drawing_area(); root_area.fill(&WHITE).unwrap(); let mut chart = ChartBuilder::on(&root_area) .set_label_area_size(LabelAreaPosition::Left, 40) .set_label_area_size(LabelAreaPosition::Bottom, 40) .margin(5) .build_cartesian_2d(0..10, 0..50) .unwrap(); chart.configure_mesh().draw().unwrap(); let data = [25, 37, 15, 32, 45, 33, 32, 10, 29, 0, 21]; chart .draw_series( AreaSeries::new((0..).zip(data.iter().enumerate().map(|x| (*x.1 as i32))), 0, &RED.mix(0.2)).border_style(&RED) ) .unwrap(); }
The output of egui-plotter is: The output of plotters with the BitmapBackend is:
The text was updated successfully, but these errors were encountered:
Investigating now, sorry for the delay
Sorry, something went wrong.
Looks like some issue with egui's tesselator, or at least is my guess. Will try to work around this however
No branches or pull requests
The area chart renderer creates unnecessary and wrong triangles.
The output of egui-plotter is:
![screenshot](https://private-user-images.githubusercontent.com/42283470/258042178-1f76aef9-c93c-4c13-befe-a4f444ad9fbf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg1ODQ0ODAsIm5iZiI6MTcxODU4NDE4MCwicGF0aCI6Ii80MjI4MzQ3MC8yNTgwNDIxNzgtMWY3NmFlZjktYzkzYy00YzEzLWJlZmUtYTRmNDQ0YWQ5ZmJmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE3VDAwMjk0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRjYjcwODJkN2Q2ODEyOTU3ZjhiZTdiMGVmYjMzN2FiYmE4YThkYTE2NDdmZjI5NzNjNDY0NzhkMWRjMDQyOWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.sEmgkS2zRDqjXVf7880IaXs0s4JWHEXlWbB7JjjB_SM)
![image](https://private-user-images.githubusercontent.com/42283470/258042384-c17dd3a4-7f1f-4c70-9306-f0e665e59b9d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg1ODQ0ODAsIm5iZiI6MTcxODU4NDE4MCwicGF0aCI6Ii80MjI4MzQ3MC8yNTgwNDIzODQtYzE3ZGQzYTQtN2YxZi00YzcwLTkzMDYtZjBlNjY1ZTU5YjlkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE3VDAwMjk0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUyMTA2YWE2OGU3NGQ4NGZiZjIwZjgzMWRiNzhkZDg4NGU2NDNkMDUzMDcxNDlkYTNhZmY0ZWEyN2VkMGIzZGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.GfvwyelJHj82xwG3uoHvUd9w6egFGuzecyDehq2IRqg)
The output of plotters with the BitmapBackend is:
The text was updated successfully, but these errors were encountered: