hoffstadt / hoffstadt/DearPyGui

Slot 0 plot children disallow right-clicking plot legend

Open
#2,459 0 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: 2.0.0
Operating System: Linux (Arch, 6.12.8)
Python: 3.12.8

## My Issue/Question

In 2.0.0 there seems to be an issue with plot legend right-click functionality. Specifically, if a plot has any of slot 0 children _shown_ (annotation, drag line, drag point, except for legend of course), it seems to be impossible to access right-click menu for plotted series. When such children are not shown, there is no issue (see MRE).

It also seems that, unlike in <2.0.0, such children are counted as series (?), as when toggling the plot annotation in MRE, line series changes color.

## Standalone, minimal, complete and verifiable example
Try right-clicking the "Line" line series in the legend with the "Show annotation" checkbox on and off. When the checkbox is on right-clicking the legend does nothing.

Swapping `dpg.add_plot_annotation` to any of [`dpg.add_drag_point`, `dpg.add_drag_line` or `dpg.add_drag_rect`] with appropriate args exhibits the same behavior.

```python
import dearpygui.dearpygui as dpg

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

with dpg.window(tag="main"):
dpg.add_checkbox(
label="Show annotation",
callback=lambda _, state: dpg.configure_item("annotation", show=state),
default_value=False,
)

with dpg.plot(tag="plot", width=-1, height=-1):
dpg.add_plot_axis(dpg.mvXAxis, tag="x_axis")
dpg.add_plot_axis(dpg.mvYAxis, tag="y_axis")
dpg.add_plot_legend(tag="legend")
dpg.add_line_series(
x=[0, 1, 2], y=[0, 1, 0], parent="y_axis", label="Line", tag="line_series"
)

dpg.add_text("Text", parent="line_series", tag="series_text")

dpg.add_plot_annotation(
default_value=(1, 1),
tag="annotation",
label="[1,1]",
show=False,
)

dpg.set_primary_window("main", True)

dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
```
## Expected behavior

Right-clicking plot legend should show child widgets of any plot series regardless of plot's other children (as was the case in DPG <2.0.0)

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.