epezent / implot

Immediate Mode Plotting
MIT License
4.84k stars 531 forks source link

all plot be hidden default. #572

Open Sologala opened 6 months ago

Sologala commented 6 months ago

I will plot multi lines in one frame, but do not want show all of them in beginning. Is there some way to disable all lines in legend?

image

Sologala commented 6 months ago

I can directly modify plotitem's member variable to achive that, but it needs to include implot_internal.h. Is there some elegant way to do this?


      if (first_draw) {
                    first_draw = false;
                    ImPlotContext *ctx = ImPlot::GetCurrentContext();
                    ImPlotPlot *plot = ctx->CurrentPlot;
                    const int num_items = plot->Items.GetLegendCount();
                    for (int i = 0; i < num_items; ++i) {
                        ImPlotItem *item = plot->Items.GetLegendItem(i);
                        item->Show = false;
                    }
                }

``
djbarker commented 2 months ago

Am also interested in achieving this.