Results 1 to 7 of 7

Thread: QwPlottMultiBarChart determining legend title of bar segment under cursor

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2012
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QwPlottMultiBarChart determining legend title of bar segment under cursor

    Uwe,
    Thanks so much for the quick response. Now it's making more sense and I like the idea of the lookup table and saving this information during creation. This will remove my problems with the current state and will also help me when things are zoomed and/or panned in. I'll give it a try.
    Buffy

  2. #2
    Join Date
    Jul 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: QwPlottMultiBarChart determining legend title of bar segment under cursor

    I have a similar need but to display the y value of the bar when hovering. I am trying to use the hint from Uwe, but am a little lost. How does the m_barGeometries know if a QPointF is in a given bar? The LookUpTable class has the sampleIndex, valueIndex and QwtColumnRect. I thought I could get the QRect from QwtColumnRect and check if the rect contains point. However, rect seems to have only a relative size and not tied to the plot. All my stored QRect objects all have the same size 9x13 with xp and yp equal zero.

    I am new to Qwt and any help on how to determine if mouse location is over a specific bar would be greatly appreciated.

    Thanks

    Tim

  3. #3
    Join Date
    Jul 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: QwPlottMultiBarChart determining legend title of bar segment under cursor

    I found a few problems with my solution. First of all, if sampleIndex was -1 then I should not store it in the look up table. I guess that draw call is for the legend. Second, the coordinate system that the QwtColumnRect contains is the same as the output of trackerPosition(). So I don't need to inverse transform it. I can use it directly in the QRectF object returned by QwtColumnRect. I just call QRectF::contains(pos) and it works.

    Regards

    Tim

Similar Threads

  1. Segment fault
    By kenchan in forum Qt Programming
    Replies: 14
    Last Post: 25th December 2012, 11:30
  2. Replies: 0
    Last Post: 29th October 2012, 11:23
  3. Replies: 2
    Last Post: 26th October 2012, 16:26
  4. I need a 16 segment LCD display control????
    By phoenixcomm in forum Newbie
    Replies: 2
    Last Post: 2nd July 2012, 00:26
  5. Replies: 2
    Last Post: 2nd October 2009, 15:32

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
  •  
Qt is a trademark of The Qt Company.