Skip to content

Centering plot to my data in it #286

@IvaOsi

Description

@IvaOsi

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions