pub struct PlotContext { /* private fields */ }Expand description
ImPlot context that manages the plotting state
This context is separate from the Dear ImGui context but works alongside it. You need both contexts to create plots.
Implementations§
Source§impl PlotContext
impl PlotContext
Sourcepub fn try_create(_imgui_ctx: &ImGuiContext) -> ImGuiResult<Self>
pub fn try_create(_imgui_ctx: &ImGuiContext) -> ImGuiResult<Self>
Try to create a new ImPlot context
This should be called after creating the Dear ImGui context. The ImPlot context will use the same Dear ImGui context internally.
Sourcepub fn create(imgui_ctx: &ImGuiContext) -> Self
pub fn create(imgui_ctx: &ImGuiContext) -> Self
Create a new ImPlot context (panics on error)
Sourcepub fn current() -> Option<Self>
pub fn current() -> Option<Self>
Get the current ImPlot context
Returns None if no context is current
Sourcepub fn set_as_current(&self)
pub fn set_as_current(&self)
Set this context as the current ImPlot context
Sourcepub fn get_plot_ui<'ui>(&'ui self, ui: &'ui Ui) -> PlotUi<'ui>
pub fn get_plot_ui<'ui>(&'ui self, ui: &'ui Ui) -> PlotUi<'ui>
Get a PlotUi for creating plots
This borrows both the ImPlot context and the Dear ImGui Ui, ensuring that plots can only be created when both are available.
Sourcepub unsafe fn raw(&self) -> *mut ImPlotContext
pub unsafe fn raw(&self) -> *mut ImPlotContext
Get the raw ImPlot context pointer
§Safety
The caller must ensure the pointer is used safely and not stored beyond the lifetime of this context.