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

Centering plot to my data in it #286

Closed
IvaOsi opened this issue Sep 11, 2021 · 3 comments
Closed

Centering plot to my data in it #286

IvaOsi opened this issue Sep 11, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@IvaOsi
Copy link

IvaOsi commented Sep 11, 2021

Hello, everyone!
I have a little data, I draw it like this:

static ImPlotAxisFlags xflags = ImPlotAxisFlags_RangeFit;
static ImPlotAxisFlags yflags = ImPlotAxisFlags_RangeFit;
 if (ImPlot::BeginPlot("My Plot", "x_label","y_label", ImVec2(-1,0),0, xflags, yflags   )) {
            for (int i = 0; i < 10; ++i) {
                ImPlot::PlotText( "hello", 1, 100+i, false, ImVec2(0,0));
            }
            ImPlot::EndPlot();
        }
        ImGui::End();

The problem is that it takes me a very long time to scroll up the graph to look at my data on it.

image

The temporary solution I have is to apply - SetNextPlotLimits But it imposes difficulties. Now I need to know in advance the limits of my data, which is an additional calculation.

Also, it may not work with real-time data. How do I change the graph so that it automatically scales to my data and I see it instead of scrolling it?

@epezent
Copy link
Owner

epezent commented Sep 14, 2021

I think you want ImPlotAxisFlags_AutoFit on your y-axis. Did you try that?

@IvaOsi
Copy link
Author

IvaOsi commented Sep 14, 2021

I think you want ImPlotAxisFlags_AutoFit on your y-axis. Did you try that?

its not working

@epezent epezent added the bug Something isn't working label Oct 3, 2021
@epezent
Copy link
Owner

epezent commented Oct 20, 2021

Hi, the issue was that PlotText was not submitting text extents for fitting. A patch was included in #294.

@epezent epezent closed this as completed Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants