Including QwtPlotGrid in Qwt (QwtPlot)

For easier perception of information, for reading charts, you can enable the grid. This is done using the QwtPlotGrid class. Everything is as usual: the object needs to be created, configured, and attached to the qwtplot.


For example:

#include <qwt_plot_grid.h>
QwtPlotGrid grid = new QwtPlotGrid;
grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::gray, 0, Qt::DotLine));
The methods setMajPen(QPen) and setMinPen(QPen) allow you to configure the style and color of the lines that correspond to major and minor divisions.

The methods enableXMin(bool), enableYMin(bool), enableX(bool), and enableY(bool) allow you to enable or disable the grid on the corresponding axes for major and minor divisions.

And finally, to see the changes: