Results 1 to 7 of 7

Thread: Get y throught x

  1. #1
    Join Date
    Sep 2011
    Posts
    13
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Get y throught x

    Hellow!
    I have some x coordinate, how can i get y coordinate of QwtPlotItem?
    In advance many thanks for your help!

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

    Default Re: Get y throught x

    No information about almost nothing - do you really expect a useful answer for such a request ?

    Uwe

  3. #3
    Join Date
    Sep 2011
    Posts
    13
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Get y throught x

    Sorry for my bad english
    As i understend you not understend my answer
    I have some qwt item in the my plot, item consist of many points
    Is there some function through which i can get x coordinate throught y coordinate of some point in my item
    For example:
    I have graphic of y = 2*x
    cout << item->someFunction(2) // I get 1, because in the point with coordinate y = 2, there is x coordinate = 1
    Is there such function?
    And if there is not such funtion, how can i write such function?

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

    Default Re: Get y throught x

    Quote Originally Posted by ruzik View Post
    I have some qwt item in the my plot, item consist of many points
    O.k. so you have some individual type of plot item - nothing derived from QwtPlotCurve or QwtPlotAbstractSeriesItem.

    Is there some function through which i can get x coordinate throught y coordinate of some point in my item
    Qwt doesn't know about what is displayed by user type plot items ( or any function that was used to build points ). How do you expect such a method to be implemented ?

    I have graphic of y = 2*x
    Then x = 0.5 * y

    Uwe

  5. #5
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    99
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Get y throught x

    For example:
    I have graphic of y = 2*x
    cout << item->someFunction(2) // I get 1, because in the point with coordinate y = 2, there is x coordinate = 1

    Here you have found the solution yourself. ;-)
    To find the x for a given y value you divide that y value by 2.

    More complex functions can have the same y value for several x values. So that wouldn't be very usefull. If that's not the case you can calculate it easily like you did.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Get y throught x

    A side note... Provided there exists function y = f(x), the inverse of that function --- x = g(y) where for every x: y=f(x) doesn't have to be a function. A simple example is y = x^2. An inverse relation has two solutions for all arguments but 0 (e.g. 4 = 2^2 but also 4 = (-2)^2 therefore g(4) = {-2, 2} ). Therefore such mapping as you want can't possibly exist in a general situation.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Sep 2011
    Posts
    13
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Get y throught x

    Ok, i am understend
    Thank you for your help!

Similar Threads

  1. Setting font throught setStylesheet command
    By qtnewbi3 in forum Qt Programming
    Replies: 3
    Last Post: 25th October 2011, 09:58
  2. How to InsertRow Throught QSqlQueryModel ?
    By innobleday in forum Qt Programming
    Replies: 0
    Last Post: 24th March 2010, 04:44
  3. Problem loading plugins throught generated bundle
    By mourad in forum Installation and Deployment
    Replies: 0
    Last Post: 25th March 2008, 11:23
  4. send own class reference throught signal
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 10th January 2008, 21:55

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.