epezent / implot

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

Plots enabled/disabled through Legend #311

Closed dsantxez closed 2 years ago

dsantxez commented 2 years ago

First of all thank you for the great library for plotting.

I have been testing the legend option inside ImPlot and I have seen that it comes with a enabled option to disable/enable painting different plots (Lines, shaded, etc.) in a BeginPlot/EndPlot.

Is there a way to disable that option? I have seen the option of altLegend function inside the implot_internal. I could use this function but I haven't seen a way of disabling the context menu of the Plot or changing for a custom one.

How would be the best option to disable that option or use the alt option but disable the default the legend option?

dsantxez commented 2 years ago

Hi there,

I was able to use the AltShowLegend(interactive off) and then use a regular checkbox list of ImGui to have that functionality. I would be nice though to be able to query if the plot has been disabled or not in the legend.

dsantxez commented 2 years ago

I have still found one issue with this approach. The default legend is still available for the user unless I force programatically to show the AltLegend at the same place as the regular legend. Is there a programatically way to disable showing the regular legend and to be able to control the altLegend from the context menu of the plot?

epezent commented 2 years ago

See ImPlotLegendFlags_NoButtons and/or ImPlotLegendFlags_NoMenu

dsantxez commented 2 years ago

I see now that I was using the 0,9 version, we are using from vcpkg the ImPlot library. Sorry my bad, I will use directly the files from the latest version.

Thank you for your quick reply