QCustomPlot Discussion and Comments

Drawing axis grids on top of curves/charts rather than underneath.Return to overview

Does anyone know how to get the axis grids to draw on top of all the curves? At present the grids are drawn at the lowest level. I assume I have to play with the layer list and move the grids to the top of the layer stack.

I figured this one out. By default QCustomPlot has these defined layers:

1. background
2. grid
3. main
4. grid
5. axes
6. legend

All I had to do was move layer "main" after "background" after I created the QCustomPlot:

QCPLayer *mainLayer = qcpPlot_->layer( "main");
QCPLayer *backgrounLayer = qcpPlot_->layer( "background");
qcpPlot_->moveLayer( mainLayer, backgrounLayer, CustomPlot::limAbove);