hoffstadt / hoffstadt/DearPyGui

Hiding a dragline shows plot series that should remain hidden

Open
#2,502 6 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, clean venv.
Python 3.11.7
Operating System: Windows 11

## My Issue/Question

Hiding/showing a dragline unexpectedly hides, shows, and changes the color of a line series

## To Reproduce

Steps to reproduce the behavior (see video and example code):
1. Hide plot series via legend
2. Click "Hide dragline"
3. Observe hidden plot re-appearing and changing color

## Expected behavior

Dragline hides itself. Plot stays hidden

## Screenshots/Video

https://github.com/user-attachments/assets/de6318eb-0928-427e-aa63-03ece6572501

## Standalone, minimal, complete and verifiable example

```python
import dearpygui.dearpygui as dpg
from math import sin

dpg.create_context()

# creating data
sindatax = []
sindatay = []
for i in range(0, 500):
sindatax.append(i / 1000)
sindatay.append(0.5 + 0.5 * sin(50 * i / 1000))

def hide_dl():
dpg.hide_item("dline1")

def show_dl():
dpg.show_item("dline1")

with dpg.window(label="Example", width=400, height=500):
with dpg.plot(label="Drag Lines/Points", height=400, width=-1):
dpg.add_plot_legend()
dpg.add_plot_axis(dpg.mvXAxis, label="x")
dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis")
dpg.add_line_series(
sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis"
)

dpg.add_drag_line(tag="dline1", color=[255, 0, 0, 255], default_value=0.2)

dpg.add_button(label="Hide dragline", callback=hide_dl)
dpg.add_button(label="Show dragline", callback=show_dl)

dpg.create_viewport(title="Custom Title", width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
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.