Skip to content

Commit

Permalink
Rejig minx calculation etc to prevent massive long loops due to exces…
Browse files Browse the repository at this point in the history
…sive numbers of ticks. For Minsky #1702.
  • Loading branch information
highperformancecoder committed Jan 9, 2024
1 parent 9bb3472 commit 3ad41fb
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/plot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ namespace ecolab
{
minx=logx? 0.1: -1;
maxx=1;
miny=logy? 0.1: -1;
maxy=1;
miny1=miny=logy? 0.1: -1;
maxy1=maxy=1;
}
else
{
Expand Down Expand Up @@ -340,6 +340,17 @@ namespace ecolab
adjustMinyMaxy(miny,maxy);
adjustMinyMaxy(miny1,maxy1);

// adjust minx, miny, miny1 etc if tickIncrement too small
double tickIncrement, tick;
computeIncrementAndOffset(minx, maxx, nxTicks, tickIncrement, tick);
if ((maxx-tick)>100*tickIncrement) minx=tick;
computeIncrementAndOffset(miny, maxy, nyTicks, tickIncrement, tick);
if ((maxy-tick)>100*tickIncrement) miny=tick;
if (finite(miny1) && finite(maxy1))
{
computeIncrementAndOffset(miny1, maxy1, nyTicks, tickIncrement, tick);
if ((maxy1-tick)>100*tickIncrement) miny1=tick;
}
}

void Plot::drawGrid
Expand Down

0 comments on commit 3ad41fb

Please sign in to comment.