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 values of the scales:
x-axis and y-axis scale:
x1=-0.642455
x2=0
x3=0.642455
y1=-0.642455
y2=0
y3=0.642455
I read the user's guide of QwtPlot class and QwtPlotGrid class. 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
doubleListmin.append(0.1);
doubleListmed.append(0.3);
doubleListmaj.append(0.642455);
QList<double> doubleList[3];
doubleList[0] = doubleListmin;
doubleList[1] = doubleListmed;
doubleList[2] = 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~