hoffstadt / hoffstadt/DearPyGui

Inaccurate time values returned from get_mouse_plot_pos()

Open
#2,363 2 comments 0 reactions 0 assignees View on GitHub
state: pending type: bug
Dominant language
C++
Stars
15.6k
Forks
783
PR merge metrics
No merged PRs in 30d

Description

## 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](https://github.com/hoffstadt/DearPyGui/issues/1847), 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

```python
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()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.