Results 1 to 5 of 5

Thread: Problem with barchart in Qwt, may be a bug

  1. #1
    Join Date
    Apr 2014
    Posts
    3
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Exclamation Problem with barchart in Qwt, may be a bug

    Hi, I am a newer to Qt and Qwt and I got a problem with barchart:

    When I set data with function "setSamples( QVector<double> &_data )",
    if there is only one data in the QVector (means "_data.size() == 1" is true ) and the orientation is Qt::Horizontal,
    charts goes wrong like this:

    qwt_problem.png

    What did I do is running the example named "distrowatch" and modified the codes like this:

    qwt_problem_modify.PNG

    This problem appears on both barchart and multi_barchart.

    Actually I have try to figure out the problem with debuging the qwt for several hours.

    Yet I can not figure out why, but I found the x axis is set wrongly to -0.6 to 0.6 and y axis is set wrongly to 0 to 1200 in this situation so transform and scale works wrongly due to the bad range.

    I am working on a project with barchart so I really need your help.

    Thanks.

    Best regards.

    I am using Qwt 6.1
    Last edited by kknd1015; 28th April 2014 at 20:20. Reason: updated contents

  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: Problem with barchart in Qwt, may be a bug

    I tried your modification and ran into an assertion ( debug mode ) because of a bad range check in DistroScaleDraw::label(). After fixing it ( SVN trunk and 6.1 ) the application runs as expected, beside that the mapping between tick labels and bars is not valid anymore. But this is no surprise, as you removed most of the bars without adjusting the tick count.

    Uwe

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

    kknd1015 (30th April 2014)

  4. #3
    Join Date
    Apr 2014
    Posts
    3
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem with barchart in Qwt, may be a bug

    Thanks for your help!

    Yes there was a range error I forgot to mention that.

    But did you try the combo boxes at the top left of the app window to set the chart orientation to "horizon"?

  5. #4
    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: Problem with barchart in Qwt, may be a bug

    This is indeed a bug that happens when using the auto scaler for a horizontal barchart with exactly one bar.

    Fixed in SVN ( trunk and 6.1 branch ),

    Uwe

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

    kknd1015 (3rd May 2014)

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

    Default Re: Problem with barchart in Qwt, may be a bug

    Got it, thanks very much~

    Best regards.

Similar Threads

  1. how to create barchart in Qt
    By gauravg in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2013, 10:31

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.