Results 1 to 3 of 3

Thread: QwtPlotPicker on stockchart

  1. #1
    Join Date
    Dec 2013
    Posts
    7
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QwtPlotPicker on stockchart

    Hey,

    I have yet another question regarding QWT.

    I added a QwtPlotPicker to my chart like this:

    Qt Code:
    1. QwtPlotPicker picker_ = new QwtPlotPicker(this->canvas());
    2. picker_->setAxis(QwtPlot::xBottom, QwtPlot::yRight);
    3. picker_->setStateMachine(new QwtPickerTrackerMachine());
    4. picker_->setTrackerMode(QwtPlotPicker::AlwaysOn);
    5. picker_->setRubberBandPen(QColor(Qt::green));
    6. picker_->setRubberBand(QwtPicker::CrossRubberBand);
    7. picker_->setTrackerPen(QColor(Qt::black));
    To copy to clipboard, switch view to plain text mode 
    Now the problem is that the values for the x-axis are shown as milliseconds from the epoch instead of dates. When I add a QwtPlotZoomer it displays values as dates just as I would expect it since my x-axis are dates (the curve is a QwtPlotTradingCurve).
    Any ideas what I am doing wrong here?

  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: QwtPlotPicker on stockchart

    Quote Originally Posted by wooosh View Post
    Any ideas what I am doing wrong here?
    Nothing - the picker doesn't correspond with the scales for how to display values. The same is for the zoomer !

    But as your zoomer shows datetime values I guess you have copied the code from the stockchart example, where QwtPlotPicker::trackerTextF() has been overloaded. The same has to be done for your picker.

    Uwe

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

    wooosh (17th February 2014)

  4. #3
    Join Date
    Dec 2013
    Posts
    7
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlotPicker on stockchart

    You are absolutely right. I used the code from the stockchart example. Got it working now. Thanks a lot!

Similar Threads

  1. Background in stockchart example
    By wooosh in forum Qwt
    Replies: 5
    Last Post: 7th January 2014, 06:38
  2. QwtPlotPicker with QwtPlotDirectPainter
    By friendbaby in forum Qwt
    Replies: 1
    Last Post: 12th December 2012, 14:43
  3. QwtPlotPicker
    By carhun in forum Qwt
    Replies: 1
    Last Post: 20th August 2012, 13:12
  4. QwtPlotMarker QwtPlotPicker
    By bss in forum Qwt
    Replies: 1
    Last Post: 15th June 2011, 12:55
  5. QwtPlotPicker questions
    By ttvo in forum Qwt
    Replies: 7
    Last Post: 28th February 2009, 09:44

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.