plotters icon indicating copy to clipboard operation
plotters copied to clipboard

avoid crash and provide a simple solution for very small log scales

Open elwerene opened this issue 5 years ago β€’ 1 comments

When using a log scale from 2 to 8, plotters crashes as tier_1 is zero and is later used as divisor. I made a simple fix by checking for zero tier_1 and providing a simple scale which iterates the integers between both numbers.

I know this is not a complete fix of the problem, especially as a small scale e.g. 0.2 to 0.8 would not show any grid lines, but the best idea a came up with at the moment and it always prevents the crash.

Sorry I had to close (https://github.com/38/plotters/pull/115) and reopen the pull request, but I did more work and just merging master would be wrong.

elwerene avatar Mar 13 '20 14:03 elwerene

Codecov Report

Merging #116 into master will increase coverage by 0.78%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #116      +/-   ##
==========================================
+ Coverage   66.24%   67.03%   +0.78%     
==========================================
  Files          53       53              
  Lines        5134     5129       -5     
==========================================
+ Hits         3401     3438      +37     
+ Misses       1733     1691      -42     
Impacted Files Coverage Ξ”
src/coord/logarithmic.rs 0.00% <0.00%> (ΓΈ)
src/chart/builder.rs 82.31% <0.00%> (+0.49%) :arrow_up:
src/chart/context.rs 78.66% <0.00%> (+0.66%) :arrow_up:
src/coord/datetime.rs 81.22% <0.00%> (+0.74%) :arrow_up:
src/coord/ranged.rs 43.47% <0.00%> (+1.08%) :arrow_up:
src/drawing/backend_impl/cairo.rs 89.74% <0.00%> (+1.46%) :arrow_up:
src/drawing/backend_impl/bitmap.rs 84.84% <0.00%> (+1.78%) :arrow_up:
src/style/size.rs 78.00% <0.00%> (+2.00%) :arrow_up:
src/drawing/backend_impl/svg.rs 75.79% <0.00%> (+2.31%) :arrow_up:
src/style/font/font_desc.rs 50.00% <0.00%> (+2.32%) :arrow_up:
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update 5cf3bfd...869f6fa. Read the comment docs.

codecov[bot] avatar Mar 13 '20 14:03 codecov[bot]