Qt-interest Archive, May 2007
QwtPlot - replotting and xaxis labeling
Message 1 in thread
Hi ,
Question 1 - replotting
I am trying to refresh/clear and replot a new set of data on a QwtPlot widget but it doesn't seem to work. Below is the function I call everytime I want to plot some new data. This function works fine the first time (the first call) but when I call it again to plot new data the exsisting plot doesn't seem to refresh /clear?
void plotgraph(QwtPlot* plot, double xdata, double ydata, int size)
{
QwtPlotCurve *curve = new QwtPlotCurve;
curve->setRenderHint(QwtPlotItem::RenderAntialiased);
curve->setPen(QPen(Qt::red));
curve->attach(plot);
curve->setData(xdata, ydata, size);
plot->replot();
}
Question 2 - xaxis labeling
I am trying to plot a data vs time (in months) graph using QwtPlot. How do I go about labeling the xaxis points as Jan,Feb....Dec. I have been using setdata to set the yaxis and xaxis data. But this take only double datatype as input. I basically want my xaxis data to be an array of strings rather than double.
Thanks,
Roger T
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Message 2 in thread
roger t wrote:
> Question 1 - replotting
You add a new curve with each call of plotgraph. Instead you have to attach
a curve once and change its points.
> Question 2 - xaxis labeling
Look at the cpuplot example.
For questions about Qwt better use the Qwt mailing list.
Uwe
--
[ signature omitted ]