Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Usage about QwtPlot
HYSuperman last edited by
I'm confused with using QwtPlot class to draw a customized coordinate system.
My goal is to draw a coordinate system with customized scale, and draw grid line on these customized scales. Here are the value of the scales:
x-axis and y-axis scale:
I read the user's guide of "QwtPlot class":http://qwt.sourceforge.net/class_qwt_plot.html and "QwtPlotGrid class":http://qwt.sourceforge.net/class_qwt_plot_grid.html. I found a function in QwtPlotGrid class called setxDiv and seemed that it could help, So I wrote the following code:
QList<double> doubleListmin;//min scale
QList<double> doubleListmed;//medium scale
QList<double> doubleListmaj;//major scale
doubleList = doubleListmin;
doubleList = doubleListmed;
doubleList = doubleListmaj;
QwtScaleDiv *xDiv = new QwtScaleDiv(-0.642455, 0.642455, doubleList);//lowerbound is -0.642455, upperbound is 0.642455, doubleList customizes the scale
QwtPlotGrid *grid = new QwtPlotGrid(); grid->setXDiv(*xDiv); //grid->updateScaleDiv(*xDiv, *xDiv); grid->attach(this);
But it turned out to have no influence on the new QwtPlotGrid, it doesn't change its scale system.
I think there's another way: draw a several lines in the QwtPlot. But I don't know how to do it.
Somebody help me please!!!
Thank you in advance~