I’m going to write a program that plots data from a sensor connected to the computer. The sensor value is going to be plotted as a function of the time (sensor value on the y-axis, time on the x-axis). I want to be able to add new values to the plot in real time. What would be best to do this with in C++?
Edit: And by the way, the program will be running on a Linux machine
Write a function that can plot a
std::dequein a way you like, then.push_back()values from the sensor onto the queue as they come available, and.pop_front()values from the queue if it becomes too long for nice plotting.The exact nature of your plotting function depends on your platform, needs, sense of esthetics, etc.