From 99319d9fa7f0af3347a7dcf434f704f88e7fdecf Mon Sep 17 00:00:00 2001 From: ozlb Date: Tue, 12 May 2020 15:05:14 +0200 Subject: [PATCH 1/2] PlotDigital FitThisFrame issue FitThisFrame is triggering wrong fit for analog signals. It' not necessary due to actual nature of digital plot. --- implot.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/implot.cpp b/implot.cpp index 98cb7e8..de8e2ad 100644 --- a/implot.cpp +++ b/implot.cpp @@ -2563,14 +2563,6 @@ inline void PlotDigitalEx(const char* label_id, Getter getter, int count, int of if (gp.Style.Colors[ImPlotCol_Line].w != -1) item->Color = gp.Style.Colors[ImPlotCol_Line]; - // find data extents - if (gp.FitThisFrame) { - for (int i = 0; i < count; ++i) { - ImVec2 p = getter(i); - FitPoint(p); - } - } - ImGui::PushClipRect(gp.BB_Grid.Min, gp.BB_Grid.Max, true); bool cull = HasFlag(gp.CurrentPlot->Flags, ImPlotFlags_CullData); From 2a7430dae84972fa877682ef04c0aa66eceea6eb Mon Sep 17 00:00:00 2001 From: ozlb Date: Wed, 13 May 2020 11:10:14 +0200 Subject: [PATCH 2/2] FitPoint on x --- implot.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/implot.cpp b/implot.cpp index de8e2ad..8a192c9 100644 --- a/implot.cpp +++ b/implot.cpp @@ -2562,7 +2562,15 @@ inline void PlotDigitalEx(const char* label_id, Getter getter, int count, int of if (gp.Style.Colors[ImPlotCol_Line].w != -1) item->Color = gp.Style.Colors[ImPlotCol_Line]; - + + // find data extents + if (gp.FitThisFrame) { + for (int i = 0; i < count; ++i) { + ImVec2 p = getter(i); + FitPoint(ImVec2(p.x, 0)); + } + } + ImGui::PushClipRect(gp.BB_Grid.Min, gp.BB_Grid.Max, true); bool cull = HasFlag(gp.CurrentPlot->Flags, ImPlotFlags_CullData);