From bb54f97810284770f827af6d3d6f9417d8d318ca Mon Sep 17 00:00:00 2001 From: Vasile Vilvoiu Date: Thu, 22 Jul 2021 21:11:43 +0300 Subject: Handle very small axes, when no nice value is found. Fixes #23. --- src/renderer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/renderer.cpp') diff --git a/src/renderer.cpp b/src/renderer.cpp index 4337bbf..5285c63 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -381,8 +381,12 @@ Renderer::GetNiceTicks(double v_min, double v_max, const std::string& v_unit, un fval = std::floor(fval) + 1.0f; } fval *= factor; - assert(v_min <= fval); - assert(fval <= v_max); + + if ((fval < v_min) || (fval > v_max)) { + /* there is no nice value here; usually this happens because the + * axis length is too small */ + return v_min; + } return fval; }; -- cgit v1.2.3