epezent / implot

Immediate Mode Plotting
MIT License
4.55k stars 503 forks source link

ImPlot usable with docking version of ImGui? #508

Closed fecaltransplant closed 11 months ago

fecaltransplant commented 11 months ago

ImGui and ImPlot have both been tremendous. I'm getting everything I want out of these along with a lot of other goodies I didn't even consider!

On the docking side, I noticed that there's an ability to dock windows so that they become tabbed. When I have line plots present in either one of the tabbed windows, ImGui either crashes on contact or if I try to change the tab once they're docked/tabbed.

Using the debugger, I found that ImPlot::SetupAxes() and ImPlot::IsPlotHovered() both tripped the crash once I docked offending windows together.

Does ImPlot support tabs on the docking version of ImGui? The side-by-side docking works great. If this is just my own error, that'll be wonderful.

Thanks!

epezent commented 11 months ago

@fecaltransplant ImPlot should support docking and as far back as I can remember it has without issue. If there is indeed an issue, it would be a new development. I'll take a look. In the meantime, can you provide a minimal example to repro the issue you're seeing.

epezent commented 11 months ago

Everything seems fine on my end:

double data[2] = { 0, 1};

ImGui::Begin("Plot 1");
if (ImPlot::BeginPlot("Plot 1"))
{
    ImPlot::PlotLine("Data", data, 2);
    ImPlot::EndPlot();
}
ImGui::End();

ImGui::Begin("Plot 2");
if (ImPlot::BeginPlot("Plot 2"))
{
    ImPlot::PlotLine("Data", data, 2);
    ImPlot::EndPlot();
}
ImGui::End();

docking

fecaltransplant commented 11 months ago

Awesome! My first guess is that I might have a mismatch with my versions of ImGui and ImPlot. I'll check that now.

Thanks! I'm glad that this is just my own fail :D

fecaltransplant commented 11 months ago

Yes, I just cloned brand new ImGui and ImPlot and it worked. It's my first day!

Thanks again