new Qwt user question: custom labels for axis
Brought to you by:
rathmann
|
From: Jason Z. <guf...@gm...> - 2009-01-30 19:16:17
|
Hi,
I am trying to plot a real time data with a fixed display length. To do
that, I would like to have the x-axis label constantly change: increase
right-most number when new data comes in and decrease the left-most number
at the same time (so that the total display data length keeps the same).
First I set the display length by:
QwtPlot *myPlot = new QwtPlot;
myPlot->setAxisScale(QwtPlot::xBottom, 0, DATA_LENGTH, 1);
This will set the plot to display the x-axis label from 0 (left-most) to
DATA_LENGTH (right-most). However, I could not find the settings in QwtPlot
to set the labels according to the number of my new coming data (which is
constantly increasing) if the number is greater than DATA_LENGTH.
I found a lot of people overload the setAxisScaleDraw(QwtPlot::xBottom, new
QwtScaleDraw) so that QwtScaleDraw is used by a custom defined format like
cpuplot example.
I don't want to change the format, is there any way I can do this without
overload the QwtScaleDraw?
I tried to use:
double data_number;
......
data_number++;
QwtScaleDraw *scaleDraw = new QwtScaleDraw;
scaleDraw->label(data_number);
myPlot->setAxisScaleDraw(QwtPlot::xBottom, scaleDraw);
But this does not change anything.
Is there anyway that I can change the axis labels without any effect to the
data that displayed in the plot?
Thanks,
Jason Zhang
|