maxpayne
19th October 2008, 11:54
Hi,
I am new to both qt and qwt and I’m facing hell. I need some help in order to understand how to draw and set up a scale in qwt.
My first question concerns the use of Qwt scale draw:
1. Assume I have a set of time strings like 12:33:05 ,12:33:08, 12:33:11, 12:33:14, 12:33:17, 12:33:20. A total of 6. I want to use these as labels for major ticks.
2 .Next, I have a x axis scale set up as : setAxisScale(QwtPlot::xBottom, 0, 60);
3. Somehow qwt automatically divides the scale into 6 major divisions , each of 10 divisions each. This is acceptable for now but how do I change this default behavior in case?
4. Next how do I assign a label to each major tick? I want the time string 12:33:05 to be the label of the first major tick and so on.
my second question relates to the Cpu plot example:
class TimeScaleDraw: public QwtScaleDraw
{
public:
TimeScaleDraw(const QTime &base):
baseTime(base)
{
}
virtual QwtText label(double v) const
{
QTime upTime = baseTime.addSecs((int)v);
return upTime.toString();
}
private:
QTime baseTime;
};
I would like to know which method actually calls the label and passes the parameter v.what exactly is the value of v? and who calls this method? in the example i understand that every second the setRawData is called for each curve.However i would like to know who calls the virtual method label?
Hope you can help me answer these questions.
Thanks,
max.
I am new to both qt and qwt and I’m facing hell. I need some help in order to understand how to draw and set up a scale in qwt.
My first question concerns the use of Qwt scale draw:
1. Assume I have a set of time strings like 12:33:05 ,12:33:08, 12:33:11, 12:33:14, 12:33:17, 12:33:20. A total of 6. I want to use these as labels for major ticks.
2 .Next, I have a x axis scale set up as : setAxisScale(QwtPlot::xBottom, 0, 60);
3. Somehow qwt automatically divides the scale into 6 major divisions , each of 10 divisions each. This is acceptable for now but how do I change this default behavior in case?
4. Next how do I assign a label to each major tick? I want the time string 12:33:05 to be the label of the first major tick and so on.
my second question relates to the Cpu plot example:
class TimeScaleDraw: public QwtScaleDraw
{
public:
TimeScaleDraw(const QTime &base):
baseTime(base)
{
}
virtual QwtText label(double v) const
{
QTime upTime = baseTime.addSecs((int)v);
return upTime.toString();
}
private:
QTime baseTime;
};
I would like to know which method actually calls the label and passes the parameter v.what exactly is the value of v? and who calls this method? in the example i understand that every second the setRawData is called for each curve.However i would like to know who calls the virtual method label?
Hope you can help me answer these questions.
Thanks,
max.