PDA

View Full Version : Plot autoscale obscuring axis labels and title.



JoeBauman
22nd June 2011, 18:52
Hi Folks -

I have a plot that is being continuously updated with data pulled in from a serial port. As the values exceed the current Y-axis scale, the plot automatically scales and continues plotting correctly. However, as the axis values get larger they overwrite the axis title and then no longer fit themselves. Here is a picture of what happens (the Y-axis should also have a label that says "Count" but it has been covered up):

http://dl.dropbox.com/u/5023043/plot_labels.png

If I resize the entire window while this is happening, it will redraw the axis correctly. Is there a way that I can redraw the plot axis programatically without re-sizing the entire application?

Thanks much,

Joe.

Uwe
26th June 2011, 11:32
Is there a way that I can redraw the plot axis programatically without re-sizing the entire application?
Obviously the layout of your plot widget is not recalculated, what should happen each time the plot gets an QEvent::LayoutRequest event. So the question is why the plot widget gets no event, when your scales are changing. Please spend some time on finding out, what happens to this event in your environment ( Qwt/Qt versions ? ) or send me small demo, if you are using Qwt 6.x.

As workaround you can post an QEvent::LayoutRequest event to the plot widget from your code ( QwtPlot::replot processes all pending layout requests ) or call QwtPlot::updateLayout() manually.

Uwe

JoeBauman
8th July 2011, 00:06
Thanks for the reply, Uwe. I got pulled away on some other tasks and am just now looking at this again.

I've added an updateLayout() call as a workaround, though I am going to look into the event system a bit as I think I might be seeing some other strange yet related behavior. I'll post here if I find any solutions.