Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inaccurate time values returned from get_mouse_plot_pos() #2363

Open
surelyitsanton opened this issue Jul 15, 2024 · 1 comment
Open

Inaccurate time values returned from get_mouse_plot_pos() #2363

surelyitsanton opened this issue Jul 15, 2024 · 1 comment
Labels
state: pending not addressed yet type: bug bug

Comments

@surelyitsanton
Copy link

Version of Dear PyGui

Version: 1.11.1
Operating System: Windows 10

My Issue/Question

When setting a plot's x-axis to time, the function dpg.get_plot_mouse_pos() returns an x value in increments of 128 seconds instead of returning the exact x-value of the mouse position to the nearest second. For example the seconds returned from this function jump between 1658792320 and 1658792448 instead of returning any of the values in between. The precision of the dpg.get_plot_mouse_pos() return value is brought up here, however that issue is regarding the lack of decimal points in the number of seconds returned.

To Reproduce

Steps to reproduce the behavior:

  1. Run the code below.
  2. Move the mouse pointer horizontally over the graph area between the two plotted points
  3. Watch the coordinates in the command line output (the x-coordinate jumps between 1658792320 and 1658792448 instead of showing any of the values in between)

Expected behavior

We should see the x-coordinate change by 1 as we slowly move the mouse horizontally across the plot

Standalone, minimal, complete and verifiable example

import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()

def mouse_move_callback():
    print(dpg.get_plot_mouse_pos())

with dpg.handler_registry():
    dpg.add_mouse_move_handler(callback=mouse_move_callback)

with dpg.window(tag="Primary"):
    with dpg.plot(height=-1, width=-1):
        dpg.add_plot_axis(dpg.mvXAxis, time=True)
        with dpg.plot_axis(dpg.mvYAxis):
            dpg.add_scatter_series([1658792320, 1658792467], [0, 1])

dpg.show_viewport()
dpg.set_primary_window("Primary", True)
dpg.start_dearpygui()
dpg.destroy_context()
@v-ein
Copy link
Contributor

v-ein commented Jul 15, 2024

Probably caused by the same precision loss on 32-bit floats. See this comment for details:
#2157 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: pending not addressed yet type: bug bug
Projects
None yet
Development

No branches or pull requests

2 participants