Results 1 to 5 of 5

Thread: How to change the Interval Type in QwtPlot?

  1. #1
    Join Date
    Oct 2011
    Location
    Germany
    Posts
    27
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default How to change the Interval Type in QwtPlot?

    I am experimenting with QWT, specially with QwtPlot and QwtPlotCurve.
    I changed the "StockCchart" example a bit, so that I can display "date(x-axis)/double(y-axis)" values.
    I want to display every day on the x-axis, but only moths will be displayed.
    How can I change the QwtDate::IntervalType from QwtDate::Month to QwtDate:ay?

    (Qt 4.8.4, Qwt 6.1 RC3)

    Thanks
    Insanity: doing the same thing over and over again and expecting different results.
    Albert Einstein

  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 change the Interval Type in QwtPlot?

    In the stockchart example the position of the ticks depends on the scale interval - when you are zooming in ( rubberband zoom ) you can see, that easily. See QwtDateScaleEngine.

    Uwe

  3. #3
    Join Date
    Oct 2011
    Location
    Germany
    Posts
    27
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to change the Interval Type in QwtPlot?

    @Uwe: Thanks for the answer.
    But I want to display every day on the x-axis regardless of zooming.
    There is always only 1 value per day. That why I want to show the date values on the x-axis.
    The user want to see dates directly, without further clicking or zooming.
    Insanity: doing the same thing over and over again and expecting different results.
    Albert Einstein

  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: How to change the Interval Type in QwtPlot?

    But I want to display every day on the x-axis regardless of zooming.
    What doesn't count: a range of 1000 days would require 1000 tick labels, what is not displayable on screen.

    But what you can do is to overload QwtDateScaleEngine::intervalType() never returning something smaller than days. ( when zooming in too deep ) and with QwtPlot::setAxisMaxMajor you can increase the range, where the scale engine decides to display in days.

    When you don't need zooming at all you can calculate the tick positions manually assigning them using QwtPlot::setAxisScaleDiv().

    Uwe
    Last edited by Uwe; 16th April 2013 at 13:05.

  5. #5
    Join Date
    Oct 2011
    Location
    Germany
    Posts
    27
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to change the Interval Type in QwtPlot?

    Thanks a lot.
    I will try to overload QwtDateScaleEngine::intervalType(), which seems to be the simplest way for me.
    Insanity: doing the same thing over and over again and expecting different results.
    Albert Einstein

Similar Threads

  1. Replies: 1
    Last Post: 26th July 2012, 10:54
  2. QwtPlot Change Axis Title Alignment
    By deepy in forum Qwt
    Replies: 5
    Last Post: 20th October 2010, 14:40
  3. Replies: 2
    Last Post: 6th May 2010, 15:09
  4. Replies: 1
    Last Post: 5th January 2010, 22:00
  5. Change widget type
    By drescherjm in forum Qt Tools
    Replies: 2
    Last Post: 16th April 2009, 03:03

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.