Results 1 to 4 of 4

Thread: More scale questions

  1. #1
    Join Date
    Nov 2012
    Location
    Kentucky, USA
    Posts
    46
    Thanks
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default More scale questions

    I have the following code which is executed when the mouse clicks on a button and provides a new value of centerFreq:
    Qt Code:
    1. double interval = 48000;
    2. d_interval.setMinValue(::centerFreq - 25000);
    3. double minimum = d_interval.minValue();
    4. d_interval.setMaxValue( minimum + interval );
    5. double maximum = d_interval.maxValue();
    6. QwtPlot::setAxisScale( QwtPlot::xTop, minimum, maximum, 10000 );
    To copy to clipboard, switch view to plain text mode 
    It functions ok but I would like to change two things.
    First, say the centerFreq has a value of 7192000, then the scale labels display as 7.19e+06, 7.2e+06, etc.
    I would like to know how to make the labels display like 7.190, 7.200, etc.
    Secondly, the grid has 5 major ticks with 4 minor ticks in between.
    I would like 9 minor ticks in between each major tick.
    I tried setting up a QwtScaleDiv and it worked but it overwrote the labels calculated from centerFreq.

    Any tips as how I can accomplish these two changes?
    Thanks for any help.

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

    Default Re: More scale questions

    Ask the scale engine to calculate the scale for you.

    Uwe

  3. #3
    Join Date
    Nov 2012
    Location
    Kentucky, USA
    Posts
    46
    Thanks
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: More scale questions

    Thanks Uwe, I'm not sure how to go about that. But changing the step size from 10000 to 5000 fixed my minor tick problem.

    However, I still don't see how to get the labels to display like 7.190 instead of 7.19e+06

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

    Default Re: More scale questions

    A sorry: wrong answer - overload QwtScaleDraw::label() to control the value/label conversion, or simply divide your values by 1000.

    Uwe

  5. The following user says thank you to Uwe for this useful post:

    K4ELO (5th April 2013)

Similar Threads

  1. qwt log scale Y and linear scale X
    By Annihilator in forum Qwt
    Replies: 1
    Last Post: 31st December 2012, 10:01
  2. qwt Scale
    By David812 in forum Qwt
    Replies: 3
    Last Post: 24th May 2011, 08:43
  3. Marker and Scale
    By WXNSNW in forum Qt Programming
    Replies: 0
    Last Post: 11th December 2008, 09:44
  4. qwt 5 log scale..
    By halberdier83 in forum Qwt
    Replies: 7
    Last Post: 12th November 2007, 07:21
  5. how to scale an action.
    By hgedek in forum Qt Programming
    Replies: 1
    Last Post: 13th August 2007, 16:58

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
  •  
Qt is a trademark of The Qt Company.