QCustomPlot Discussion and Comments

Is it possible to have fixed grid lines?Return to overview

Hi, is it possible to get a fixed 10x10 grid in QCustomPlot?
When we zoom or drag any axis, the number of ticks gets changed and so does the grid.
How to fix the grid and change only tick numbers when we drag or zoom?

There are two approaches I can think of:
Create a couple of QCPItemStraightLine instances that represent your vertical and horizontal lines, respectively. Their position/direction should of course be tied to the axis rect coordinates or widget coordinates, not the plot coordinates (otherwise they would move around with the coordinate system).

Then you might be able to create an additional set of axes which themselves are invisible (pen style Qt::NoPen?) but leave their grid enabled. Not sure whether this is clean to implement.

Oh and of course you could create your own layout element which draws a grid, and place it in the inset layout of the axis rect.