Results 1 to 3 of 3

Thread: Dual date scale support and alignment

  1. #1
    Join Date
    Apr 2014
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Dual date scale support and alignment

    I'm trying to figure out how to support both zero based time and a time offset on the x-axis scale.

    The program I'm developing have the option to choose between zero based time where the samples begins at time 00:00 and the clock time where the samples were recorded. The samples are saved as zero based time in the memory. I've managed to inherit the QwtDateScaleDraw so that the when the clock time is used, it shows the text label with the clock time based offset. Everything works fine with this unless you would want an alignment of the clock time based values. So if the graph begins at 23:12:47.250 I don't want the tick of the left most value to be that but aligned to the next appropriate time, 23:12:45 for example. QwtDateScaleEngine already supports this but the zero based time is propagated to the scale even if the text label is different.

    The question here is how to best support dual times with both proper text and scale alignment and how to inject the false x-values with the clock time based offset while the plot still believes that it is zero based?

    BTW, I cannot change the x-axis values as I have other widgets based on this scale. Then I would have go through all of them too.

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

    Default Re: Dual date scale support and alignment

    Quote Originally Posted by LaminateFloor View Post
    The program I'm developing have the option to choose between zero based time where the samples begins at time 00:00 and the clock time where the samples were recorded.
    Both types of scales display seconds/minutes/hours, but they also differ substantially. That's why implementing a scale system ( scale engine + scale draw ) for displaying elapsed time is on my TODO list.

    The question here is how to best support dual times with both proper text and scale alignment and how to inject the false x-values with the clock time based offset while the plot still believes that it is zero based?.
    The proper is to implement a new type of scale engine and scale draw.


    • The scale draw should be pretty easy. it is simply about mapping your value ( guess: ms elapsed since ) into some string of a format "hh:mm:ss:zzz" - or maybe also showing days.
    • The scale engine will be more work - but maybe you don't need to implement all features. F.e. I can imagine, that you don't need autoscaling.



    HTH,
    Uwe

  3. #3
    Join Date
    Apr 2014
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Dual date scale support and alignment

    Thanks for the reply.

    The ability to choose the time offset of x-scale would certainly be a useful feature in the future.

    The scale draw was pretty easy and I've done my own class inherited from QwtDateScaleDraw.
    I tried to do an own version derived from QwtDateScaleEngine, the only problem was when I adjusted the offset it got propagated to the plot with fake x-values which was a side effect I didn't want. I will try again but use QwtLinearScaleEngine instead. I only need alignment for hours and smaller units.

Similar Threads

  1. Replies: 1
    Last Post: 5th March 2014, 00:41
  2. active dual display
    By qt_develop in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 20th May 2012, 14:56
  3. Date Scale for X-Axis
    By mishani99 in forum Qwt
    Replies: 3
    Last Post: 6th September 2011, 11:40
  4. Dual frame buffers /dev/fb0 and /dev/fb1
    By ghassett in forum Qt Programming
    Replies: 0
    Last Post: 28th May 2009, 18:57
  5. How to default Date-Edit Widget to system date
    By JohnToddSr in forum Qt Tools
    Replies: 4
    Last Post: 17th January 2007, 19:18

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.