Results 1 to 6 of 6

Thread: Problem using setAxisScaleDraw and QwtPlotZoomer

  1. #1
    Join Date
    Feb 2012
    Location
    Stuttgart / Germany
    Posts
    35
    Thanks
    6
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Problem using setAxisScaleDraw and QwtPlotZoomer

    Hello,

    I have to plot curves using QDateTime as x-axis. I'm using setAxisScaleDraw and using my return as below:

    Qt Code:
    1. return QDateTime::fromTime_t( v ).toString( "hh:mm:ss" );
    To copy to clipboard, switch view to plain text mode 

    It's working fine and plotting everything right. I added a QwtPlotZoomer to my software to perform the zoom possibility, and it's working also fine.

    The problem is: when I try to zoom a small part of the curve, for example, if I want to zoom some part that is less than one minute, my x-axis keeps with one minute size and my curve goes to the center of the screen, it doens't use the whole plot area.

    Example:

    The figure below, I have current and voltage plotted, and I zoomed just one part, represented using blue arrows.

    firstZoom.jpg

    The figure below is the result of the first zoom, showed at figure above:

    secondZoom.jpg

    It's possible to see that QwtPlotZoomer is working fine and also the scaleDraw. I zoomed a big part, then it works fine. The third figure (figure below) shows the result of the last zoom (figure above):

    thirdZoom.jpg

    And then I zoomed again the last figure, just a small part. And I get my problem, my last zoom is just 3 seconds, but the x-axis keeps with almost one minute and my graph goes to the center of the plot area (figure below):

    fourthZoom.jpg

    My question: is there a limit for the scaleDraw? I tried to use milliseconds, but I couldn't find a way to do that, I don't know exactly how it works. I would like to use always the whole plotting area, and don't have this small piece of curve. Someone has any ideia why it's happening that?

    I hope someone can understand my problem and help me, if you have any questions I can try to explain again.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem using setAxisScaleDraw and QwtPlotZoomer

    Qwt classes only know about doubles - the fact that those are somehow related to date/time values is completely in your code.

    Uwe

  3. #3
    Join Date
    Feb 2012
    Location
    Stuttgart / Germany
    Posts
    35
    Thanks
    6
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Problem using setAxisScaleDraw and QwtPlotZoomer

    Uwe, sorry, but I didn't understand what you meant.
    Can you explain again?
    Thanks

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem using setAxisScaleDraw and QwtPlotZoomer

    Quote Originally Posted by cesroc View Post
    Uwe, sorry, but I didn't understand what you meant.
    Eliminate the effect of using date/time temporarily and use a usual QwtScaleDraw object - so, that you can compare the visual result more easily to what happens when you zoom in.
    Then check what rectangles are selected by the zoomer ( use the debugger, or connect to the signals of QwtPlotZoomer/QwtPlotPicker ). Then we have more information about where to look for the problem.

    Note that you are using the inofficial patch for more than 4 axes. Maybe this is a problem related to using a wrong axis index because of it.

    Uwe

  5. #5
    Join Date
    Feb 2012
    Location
    Stuttgart / Germany
    Posts
    35
    Thanks
    6
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Problem using setAxisScaleDraw and QwtPlotZoomer

    Hello Uwe,

    If I eliminate the date/time the problem persists. The same result. I checked the rectangles and it's right. I tried to use the rectangle's first and last point as x-axis and It doesn't work. It prints as I showed before, just a small piece on the screen's center. I don't think my problem is because of the patch, because I'm using the MultiYAxis patch, I'm applying just for the y-axis, I don't have and use a patch on my x-axis. I have just the two x-axis that Qwt provides, top and bottom.

    Do you have any other idea?

    Thanks in advance

  6. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem using setAxisScaleDraw and QwtPlotZoomer

    Please simplify your code as far as possible and find values for the scale, that you can show the problem with a simple call of setAxisScale. Then try the same with a version without using the multi-axes patch.

    When the problem is still there upload your demo code as it is and I will have a look at it. If the problem is gone without the multi-axes patch upload a tarball with your patched Qwt version too.

    Uwe

Similar Threads

  1. Problem with QwtPlotZoomer
    By ch_1992 in forum Qwt
    Replies: 1
    Last Post: 12th April 2012, 01:29
  2. Multiple setAxisScaleDraw classes
    By KenJustKen in forum Qwt
    Replies: 2
    Last Post: 13th November 2011, 20:25
  3. custom axis (setAxisScaleDraw) questions
    By MrGarbage in forum Qwt
    Replies: 7
    Last Post: 11th January 2008, 11:08
  4. Replies: 3
    Last Post: 4th December 2007, 11:04
  5. Problem with QwtPlotZoomer
    By seguprasad in forum Qt Programming
    Replies: 1
    Last Post: 21st November 2007, 09:31

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.