Skip to content

Programmatically autofit data #41

Answered by brenocq
Poooel asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Poooel, the flag ImPlot3DCond_Once currently only works with the SetupAxisLimits method. When used, it will set the limits only the first time the plot is created (first call to SetupAxisLimits for that plot). If you have new data coming in and you want it to be fitted, you could call SetupAxis/SetupAxes with the flag ImPlot3DAxisFlags_AutoFit to fit the data in that frame.

if (triggerAutofit) {
   ImPlot3D::SetupAxes(nullptr, nullptr, nullptr, ImPlot3DAxisFlags_AutoFit, ImPlot3DAxisFlags_AutoFit, ImPlot3DAxisFlags_AutoFit);
}

I modified the Line Plots demo to test this and it appears to work fine

    static float xs1[1001], ys1[1001], zs1[1001];
    for (int i = 0; i < 1001; i++) {
 …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Poooel
Comment options

Answer selected by Poooel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants