Skip to content

Commit

Permalink
Merge pull request #774 from Flole998/fix-xaxis-date
Browse files Browse the repository at this point in the history
Fix missing x-Axis on 1D Timeframe
  • Loading branch information
mccartney committed Jul 6, 2023
2 parents 9abbb92 + a2237d3 commit caaca95
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ protected void calculate() {
// now increase the timespan until one is found where all the labels fit nicely. It will often
// be the first one.
index--;
boolean skip;
int fallbackindex = index;
boolean skip, force = false;
do {
skip = false;

Expand Down Expand Up @@ -242,9 +243,14 @@ protected void calculate() {
// }
}
// System.out.println("************");
if (index >= timeSpans.size() - 1)
break; // We reached the end, even though we might not yet have the result we want,
// continuing will lead to an Exception!
if (index >= timeSpans.size() - 1) {
// Nothing matches, as mentioned above, first one is usually the best fit, force it!
force = true;
index = fallbackindex;
continue; // We can't exit just yet, we need to do the calculations above again
}
if (force)
break; // We don't care anymore if it's a match or not, just use it
} while (skip
|| !areAllTickLabelsUnique(tickLabels)
|| !willLabelsFitInTickSpaceHint(tickLabels, gridStepInChartSpace));
Expand Down

0 comments on commit caaca95

Please sign in to comment.