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

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

Open
maximeflya opened this issue Oct 21, 2024 · 0 comments
Labels
state: pending not addressed yet type: bug bug

Comments

@maximeflya
Copy link

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

Screenshot from 2024-10-21 09-47-44

Standalone, minimal, complete and verifiable example

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:

get_item_configuration(PyObject* self, PyObject* args, PyObject* kwargs)

Which reads from:
struct mvAppItemConfig

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.

@maximeflya maximeflya added state: pending not addressed yet type: bug bug labels Oct 21, 2024
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

1 participant