Results 1 to 3 of 3

Thread: How to set the fixed start and enf od the axis value?

  1. #1
    Join Date
    Jan 2012
    Location
    ShangHai, PRC of China
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question How to set the fixed start and enf od the axis value?

    I want to get an axis like this:
    1.jpg

    The axis from 20-20K.
    between 20 and 100, the step is 10
    between 100-1K, the step is 100
    between 1K-10K, the step is 1000
    and 10K-20K, the step is 10k.

    I copy some code from qwt example,like the following:
    Qt Code:
    1. logSpace(frequency, 20000, 20,20000);
    2. ...
    3. currentCurve->setSamples(frequency, amplitude, 20000);
    4. ...
    5. #define qExp(x) ::exp(x)
    6. #define qAtan2(y, x) ::atan2(y, x)
    7.  
    8. static void logSpace( double *array, int size, double xmin, double xmax )
    9. {
    10. if ( ( xmin <= 0.0 ) || ( xmax <= 0.0 ) || ( size <= 0 ) )
    11. return;
    12.  
    13. const int imax = size - 1;
    14.  
    15. array[0] = xmin;
    16. array[imax] = xmax;
    17.  
    18. const double lxmin = log( xmin );
    19. const double lxmax = log( xmax );
    20. const double lstep = ( lxmax - lxmin ) / double( imax );
    21.  
    22. for ( int i = 1; i < imax; i++ )
    23. array[i] = qExp( lxmin + double( i ) * lstep );
    24. }
    To copy to clipboard, switch view to plain text mode 

    But I got the following display:
    2.PNG
    , it's not from 20-20k. changed to 10-100k.

    What I can do?

  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: How to set the fixed start and enf od the axis value?

    And all of the intervals should have the same size in pixels - like for a log10 ( see the bode example ) based scale ?

    Uwe

  3. #3
    Join Date
    Jan 2012
    Location
    ShangHai, PRC of China
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set the fixed start and enf od the axis value?

    Sure, That's I want. But qwt can only display a complete major, for example, 10-100, but not 20-100


    Added after 12 minutes:


    It's very strange,

    If set the scale range to 20-20k, it's ok.
    setAxisScale(xBottom, 20,20000);

    But yesterday, it did not work.
    Last edited by wang9658; 24th June 2012 at 02:17.

Similar Threads

  1. Replies: 9
    Last Post: 3rd May 2011, 22:21
  2. QwtPlot fixed X-axis display
    By micc13 in forum Qwt
    Replies: 2
    Last Post: 3rd December 2010, 13:28
  3. error[fixed]
    By nickb in forum Newbie
    Replies: 1
    Last Post: 17th November 2010, 21:26
  4. Replies: 0
    Last Post: 9th August 2010, 11:46
  5. fixed axis scales
    By oskarmellow in forum Qwt
    Replies: 1
    Last Post: 17th December 2008, 07:20

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.