hoffstadt / hoffstadt/DearPyGui

When hiding a series by clicking on the legend, `dpg.is_item_shown(series_id)` is not updated

Open
#2,403 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: Ubuntu 20.04

## My Issue/Question

When changing the visibility of a plot series in the legend. The value of `dpg.is_item_shown` is not updated.

If there is any other way of retrieving this information. I would also be fine with that.

## To Reproduce

Steps to reproduce the behavior:
1. Run example code
2. Show and hide the series using the legend
3. See that the printed value is not changed

## Expected behavior

The value of `dpg.is_item_shown` should be updated

## Screenshots/Video
My use case is that I use a `custom_series` alongside a normal series to overlay the hovered point. When the main series is hidden, I would like to hide the custom series.

![Screenshot from 2024-10-21 09-52-27](https://github.com/user-attachments/assets/665cb4c6-df13-4cc7-beb3-ae14ae118787)

![Screenshot from 2024-10-21 09-47-44](https://github.com/user-attachments/assets/d78df43d-e8ac-4a3c-9e9f-74d4298649c4)

## Standalone, minimal, complete and verifiable example

```python
import dearpygui.dearpygui as dpg

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

with dpg.window(label="tutorial"):
with dpg.plot():
dpg.add_plot_legend()
dpg.add_plot_axis(dpg.mvXAxis)
with dpg.plot_axis(dpg.mvYAxis):
series = dpg.add_line_series([1,2,3], [2,4,5], label="Line 1")

def _(sender, data):
print(f"{dpg.is_item_shown(series)=}")
dpg.set_frame_callback(dpg.get_frame_count() + 200, _)
dpg.set_frame_callback(dpg.get_frame_count() + 200, _)

dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
```

## Note

I found that when calling `is_item_shown`, it calls: https://github.com/hoffstadt/DearPyGui/blob/138983b073c4e35797457192f80784e190298252/src/dearpygui_commands.h#L3731
Which reads from:
https://github.com/hoffstadt/DearPyGui/blob/138983b073c4e35797457192f80784e190298252/src/mvAppItem.h#L112

The value which is updated by the legend is
https://github.com/epezent/implot/blob/f156599faefe316f7dd20fe6c783bf87c8bb6fd9/implot_internal.h#L940
which can be retrieved with `GetItem` from `implot_internal.h`

If you are open to contribution, I am willing to help. For now I don't know what would be your preferred solution as it seems difficult to update the value of `AppItemConfig` from `ImPlotItem`.

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.