Hi,,
I've implemented QwtScaleDraw to make a realtime graph like qwt example(cpu usage example):
{
public:
TimeScaleDraw
(const QTime &base
): baseTime(base)
{
}
virtual QwtText label
(double v
) const {
QTime upTime
= baseTime.
addMSecs((int)v
);
return upTime.toString();
}
};
class TimeScaleDraw: public QwtScaleDraw
{
public:
TimeScaleDraw(const QTime &base):
baseTime(base)
{
}
virtual QwtText label(double v) const
{
QTime upTime = baseTime.addMSecs((int)v);
return upTime.toString();
}
QTime baseTime;
};
To copy to clipboard, switch view to plain text mode
I want to update baseTime to current time in every timer interval instead of adding to the array in every cycle.
i call setAxisScale(QwtPlot::yLeft,timeData[INTERVAL-1],timeData[0]) in every cycle but the timeData array is held to be fix (is 0 to 60 for 60 data to be plotted).)
Actually i want to my array(data of y axis) be fixed but baseTime will update in every cycle.
When i do that the labels are not changing. actually the label function is not calling because when i call setAxisScale in timer scale the scale seems to be constant but because the basetime is changing so it must update itself!!
How can i make this class to update itslef(call the label function whenever i call setAxisScale(QwtPlot::yLeft,timeData[INTERVAL-1],timeData[0]))( the timeData array is fix))
Bookmarks