2 Attachment(s)
Problem with twitching on axis-ends
Hi.
I have a problem with twitching in my plot. This twitching comes when the y-, or x-axis is swapping between having a value label at the end or having a tick at the end.
It's best demonstrated by these two screens:
Attachment 6918Attachment 6919
If you test with the oscilloscope example, and adjust the displayed seconds, back and forth, you will see what I mean by twitching.
This is a bit annoying, especially when having live values thats going up and down.
I have based my widget on the refreshtest example, and managed to work around the problem by setting:
Code:
canvas()->setLineWidth(5);
But this adds a black border around the canvas, and I haven't figured out a way to make that border transparent, or inherit color from application.
If someone have a suggestion on how to workaround this, please let me know.
Gerhard
Re: Problem with twitching on axis-ends
What about setting a margin between the end of the scales and the canvas border: see QwtPlotLayout::setCanvasMargin().
The margin should be larger than half of the width of your tick labels. You could rotate the tick labels, so that you only need half of the font height - or something in between like in the cpuplot example.
Uwe
Re: Problem with twitching on axis-ends
Thank you for your reply Uwe.
I managed to solve it by setting plotLayout()->setAlignCanvasToScales(false); for the vertical twitching.
But I also have the problem of twitching horizontally. Whenever a major tick on the y-axis appear that has a number of characters which is greater than the rest. For example you have a range from 0-2, and when the curve goes down to -1, you have one additional character, "-" and "1".
Example:
Code:
Y-axis
---
|2|
---
|1|
---
|0|
----
|-1|
----
Is there a way to set a fixed size for the label on the major tick? For instance setting it to 7 characters if you know your y-values ranges from -999999 to 9999999.
Example of wanted behaviour:
Code:
Y-axis
------
| 2|
------
| 1|
------
| 0|
------
| -1|
------
Your help is greatly appreciated.
Gerhard
Re: Problem with twitching on axis-ends
This is one of the FAQs: grep for setMinimumExtent.
Also check the event_filter example.
Uwe
Re: Problem with twitching on axis-ends
That did the trick.
Thank you Uwe, you've been very helpfull!
Gerhard