Results 1 to 13 of 13

Thread: Time/Date Axis

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Time/Date Axis

    I'm very interested in something similar to this. Basically I need only dates as X axis. Do you thing this snippet is correct?

    QwtPlot *plt = ui->qwtPlot;
    plt->setAxisScaleDraw(QwtPlot::xBottom, new TimeScaleDraw("dd/M/yy"));
    QDate date = getDateFromSomewhere();
    QDateTime tm(date);
    xData.append(tm.toTime_t());
    yData.append(someData());

  2. #2
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Time/Date Axis

    Quote Originally Posted by Patrik View Post
    I'm very interested in something similar to this. Basically I need only dates as X axis. Do you thing this snippet is correct?
    why don't you try it by yourself?

  3. #3
    Join Date
    May 2010
    Posts
    86
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Time/Date Axis

    Hi Philminder, I tried your example under 6.00-rc5, and it fails at:

    ..\datetime\mainwindow.cpp: In constructor 'MainWindow::MainWindow(QWidget*)':
    ..\datetime\mainwindow.cpp:40: error: no matching function for call to 'QwtPlotCurve::setData(double*, double*, int)'
    ..\libraries\qwt/qwt_plot_seriesitem.h:146: note: candidates are: void QwtPlotSeriesItem<T>::setData(QwtSeriesData<T>*) [with T = QPointF]

    It looks like setData arguments have changed...

  4. #4
    Join Date
    Jul 2010
    Posts
    37
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Time/Date Axis

    please download latest Qwt (6.0) and recompile: it should works.

  5. #5
    Join Date
    Nov 2009
    Location
    US, Midwest
    Posts
    215
    Thanks
    62
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Time/Date Axis

    corrado1972 -
    I downloaded datetime.zip and curve->setData(&xData[0], &yData[0], xData.size()); (mainwindow.cpp line40) does not compile with Qwt 6.0.0.

    setData should be replaced with setRawSamples
    Last edited by TorAn; 30th April 2011 at 16:09.

  6. #6
    Join Date
    Jul 2010
    Posts
    37
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Time/Date Axis

    TorAn excuse me but I understood that the problem was referred to the examples included in Qwt release.
    My advice is to discard the datetime.zip and look in the examples, friedberg and cpuplot: there is all the necessary to get datetime axis.
    bye

Similar Threads

  1. Relocating axis labels
    By malcom2073 in forum Qwt
    Replies: 0
    Last Post: 9th May 2008, 13:01
  2. Set axis title on the right side
    By pospiech in forum Qwt
    Replies: 1
    Last Post: 14th March 2008, 07:26
  3. Qwt and custom axis
    By jiveaxe in forum Qwt
    Replies: 3
    Last Post: 14th November 2007, 15:50
  4. Qwt - extra axis
    By steg90 in forum Qwt
    Replies: 2
    Last Post: 10th July 2007, 14:41

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.