QCustomPlot Discussion and Comments

Locked grid with real-time graph (like an oscilloscope)Return to overview

For my oscilloscope application I need to set a fixed grid. An example is https://postimg.org/image/3t2klt4lr/

In other words when I receive data, I add them to the graph (with addData()) but grid is replotted and it follows the waveforms.
I have a horizontal scroll bar too (and it works fine following this example), but I need also in this case that, when I move cursor bar, the graphs are replotted but the grid mustn’t move.

So the question: is there any method to lock the grid easeily?

Thanks
QCP v2.0.0beta, QT 5.7

I've done that exact thing.
github.com/espotek/labrador

Look in mainwindow.cpp.

It's easier to do this on QCP1, from what I remember.

~Chris

Thanks Chris,
I see you used only setTickCount() method, but thanks to your code I found what method fits my needs, and that's the code:

	// init:
	ui->Plot->xAxis->ticker()->setTickCount(10);
	[...]
	// after data storage or when scrollbar is moved:
	ui->Plot->xAxis->ticker()->setTickOrigin(ui->Plot->xAxis->range().lower);

Thanks again.

Calzo