kivy-garden / graph

Displays plots on a graph.
MIT License
50 stars 18 forks source link

to_data() method of Graph Gives Incorrect Results #10

Open DaytonaJohn opened 6 years ago

DaytonaJohn commented 6 years ago

I want to do some interacting with a plot. If the Graph widget is positioned in a layout at other than pos_hint = ('x': 0, 'y':0), then the to_data() method gives incorrect results. Also, the collide_plot() method gives incorrect results under the same circumstances. To reproduce, use the code in the below zip file and left click anywhere in the plot. If you click on the center of the plot(50,0), here is the output:

got a touch: <MouseMotionEvent spos=(0.5675, 0.5316666666666667) pos=(454.0, 319.00000000000006)> graph.view_size = (658.0, 535.0) graph.view_pos = (45.0, 51.0) collide = True point is at [62.1580547112462, 0.0018691588785049174]

I believe that the point output above should be close to (50,0). This works perfectly if the graph is located in the FloaLlayout at x=0, y=0.

Other than this bug, This is working great, thanks!!

bug.zip