diff options
| author | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-07-22 21:11:43 +0300 |
|---|---|---|
| committer | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-07-22 21:11:43 +0300 |
| commit | bb54f97810284770f827af6d3d6f9417d8d318ca (patch) | |
| tree | 1f5173097c23ce6a9fdd4cd94353c1a97830aaba /src/renderer.cpp | |
| parent | aa91ba3ab50320d9f3cf9b41a68d9c001f769df6 (diff) | |
Handle very small axes, when no nice value is found.
Fixes #23.
Diffstat (limited to 'src/renderer.cpp')
| -rw-r--r-- | src/renderer.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
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; }; |
