Replies: 1 comment
-
Figured it out. Initially, I was only calling pub fn render_plot(&mut self, ctx: &egui::Context) {
for index in 0..stream_count {
if let Some(is_plotted) = payload.plot_tracker.get(&stream_key) {
if *is_plotted {
// stream_id is **important**. Unique ID for each stream
let stream_id = egui::Id::new(stream_key);
// here, call new window explicitly for each stream with respective ID
egui::Window::new("")
.id(stream_id)
.default_size(vec2(512., 256.))
.show(ctx, |ui| {
ui.ctx().request_repaint();
let data = payload.get_plotpoints(index);
let plot = Plot::new("plot");
plot.show(ui, |ui| {
ui.line(Line::new(data));
});
});
}
}
}
} Then the main app looks like this, egui::CentralPanel::default().show(ctx, |_| {
self.render_plot(ctx);
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
TLDR: I'm trying to plot incoming data from stdin, there are multiple streams of data. I want to create a widget/container that will show the selected stream separately, in its respective instance of the same widget/container.
Context:
Here, graph is just an example representation of the data.
Problem: As shown in the above image, when a stream is selected, its respective representation appears. However, when I select two or more streams, they overwrite or appear on top of the previous plot.
This is obvious when we look at how I have structured the code:
Question: Is there any way to create instances for a widget/container that I could use to display different data separately from each other? I am aiming to have one container that, based on selection, displays data in different ways.
I am pretty new to this "application development" side of things, so pardon me if there are any obvious mistakes.
Beta Was this translation helpful? Give feedback.
All reactions