pub struct Plot3DContext { /* private fields */ }Expand description
Plot3D context wrapper
Plotting requires the originating Dear ImGui context. The native plot allocation
reserves its owner thread until this Plot3DContext is dropped.
§Example
use dear_imgui_rs::*;
use dear_implot3d::*;
let mut imgui_ctx = Context::create();
let plot3d_ctx = Plot3DContext::create(&imgui_ctx);
// In your main loop:
let ui = imgui_ctx.frame();
let plot_ui = plot3d_ctx.get_plot_ui(ui);Implementations§
Source§impl Plot3DContext
impl Plot3DContext
Sourcepub fn try_create(imgui: &Context) -> ImGuiResult<Self>
pub fn try_create(imgui: &Context) -> ImGuiResult<Self>
Try to create a new ImPlot3D context.
This should be called once after creating your ImGui context.
Sourcepub unsafe fn raw(&self) -> *mut ImPlot3DContext
pub unsafe fn raw(&self) -> *mut ImPlot3DContext
Get the raw ImPlot3D context pointer without changing the current context.
§Safety
Both contexts must be alive and correctly bound. Keep wrapper-owned plots, cached items and style stacks intact. Balance raw Begin/End and Push/Pop pairs within their own scopes. This wrapper retains sole ownership of the native allocation.
Sourcepub fn get_plot_ui<'ui>(&'ui self, ui: &'ui Ui) -> Plot3DUi<'ui>
pub fn get_plot_ui<'ui>(&'ui self, ui: &'ui Ui) -> Plot3DUi<'ui>
Get a per-frame plotting interface
Call this once per frame to get access to plotting functions.
The returned Plot3DUi borrows both this plot context and the frame.
use dear_imgui_rs::Ui;
use dear_implot3d::{Plot3DContext, Plot3DUi};
fn view(ui: &Ui, plot: Plot3DContext) -> Plot3DUi<'_> {
plot.get_plot_ui(ui)
}Source§impl Plot3DContext
impl Plot3DContext
Sourcepub fn colormap_count(&self) -> usize
pub fn colormap_count(&self) -> usize
Return the number of available ImPlot3D colormaps.
Sourcepub fn colormap_name(&self, index: impl Into<ColormapIndex>) -> String
pub fn colormap_name(&self, index: impl Into<ColormapIndex>) -> String
Return a colormap name, or an empty string if the index is invalid for this context.
Sourcepub fn colormap_size(&self, index: impl Into<ColormapIndex>) -> usize
pub fn colormap_size(&self, index: impl Into<ColormapIndex>) -> usize
Returns the number of color entries, or zero for an index outside this context.
Sourcepub fn style_colormap_index(&self) -> Option<ColormapIndex>
pub fn style_colormap_index(&self) -> Option<ColormapIndex>
Return the default colormap stored in this ImPlot3D context’s style.
Sourcepub fn style_colormap_name(&self) -> Option<String>
pub fn style_colormap_name(&self) -> Option<String>
Return this context’s default colormap name.
Sourcepub fn set_style_colormap(&self, index: impl Into<ColormapIndex>)
pub fn set_style_colormap(&self, index: impl Into<ColormapIndex>)
Permanently set the default colormap used by this ImPlot3D context.
Sourcepub fn colormap_index_by_name(&self, name: &str) -> Option<ColormapIndex>
pub fn colormap_index_by_name(&self, name: &str) -> Option<ColormapIndex>
Look up a colormap index by its name.
Sourcepub fn set_style_colormap_by_name(&self, name: &str)
pub fn set_style_colormap_by_name(&self, name: &str)
Permanently set the default colormap by name. Invalid names are ignored.
Sourcepub fn colormap_color(&self, index: ColormapColorIndex) -> [f32; 4]
pub fn colormap_color(&self, index: ColormapColorIndex) -> [f32; 4]
Return a color from this context’s active colormap.
Source§impl Plot3DContext
impl Plot3DContext
Sourcepub fn style_colors_dark(&self)
pub fn style_colors_dark(&self)
Apply ImPlot3D’s dark style palette to this context.
Sourcepub fn style_colors_light(&self)
pub fn style_colors_light(&self)
Apply ImPlot3D’s light style palette to this context.
Sourcepub fn style_colors_classic(&self)
pub fn style_colors_classic(&self)
Apply ImPlot3D’s classic style palette to this context.
Sourcepub fn style_colors_auto(&self)
pub fn style_colors_auto(&self)
Apply ImPlot3D’s auto style palette to this context.