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

Background area of plot can be transparent? #45

Closed
starwindz opened this issue May 28, 2020 · 4 comments
Closed

Background area of plot can be transparent? #45

starwindz opened this issue May 28, 2020 · 4 comments

Comments

@starwindz
Copy link

Thank you very much for the great work.
I have some question about real-time plot. I would like to make the background area of plot to be transparent.
https://github.com/epezent/implot/blob/master/implot_demo.cpp#L271

Tried to find related options or parameters but could not find out. Are there any ideas about this feature?

@epezent
Copy link
Owner

epezent commented May 28, 2020

Try:

ImPlot::PushStyleColor(ImPlotCol_FrameBg, {0,0,0,0});
ImPlot::PushStyleColor(ImPlotCol_PlotBg, {0,0,0,0});
if (ImPlot::BeginPlot(...)) {
    ...
    ImPlot::EndPlot();
}
ImPlot::PopStyleColor(2);

Of course, you won't be able to make it any more transparent than the ImGui window that it is drawn over, so you'll have to push the appropriate styling variables there as well.

@starwindz
Copy link
Author

Great, it works!
Thank you very much!

One more question, legend area such as "Data 1" and "Data 2" in the plot can be also transparent?
https://github.com/epezent/implot/blob/master/implot_demo.cpp#L289

@epezent
Copy link
Owner

epezent commented May 28, 2020

The legend color is controlled by ImGuiCol_PopupBg, so use:

ImGui::PushStyleColor(ImGuiCol_PopupBg,{0,0,0,0});

@starwindz
Copy link
Author

Very nice, it also works fine!
Thank you very much again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants