Skip to content

Commit

Permalink
Fix: don't generate ticks > max if max is specified (chartjs#11083)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingMarco committed Feb 5, 2023
1 parent cfe8e03 commit 1f1fd79
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/scales/scale.linearbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ function generateTicks(generationOptions, dataRange) {
}

for (; j < numSpaces; ++j) {
ticks.push({value: Math.round((niceMin + j * spacing) * factor) / factor});
const tickValue = Math.round((niceMin + j * spacing) * factor) / factor;
if (maxDefined && tickValue > max) {
break;
}
ticks.push({value: tickValue});
}

if (maxDefined && includeBounds && niceMax !== max) {
Expand Down

0 comments on commit 1f1fd79

Please sign in to comment.