Skip to content

Commit

Permalink
Handle rim placement where there are no ticks (#923)
Browse files Browse the repository at this point in the history
I don't think this should happen in the real world, but it does seem to happen in
some unit tests.
  • Loading branch information
wlach committed Sep 26, 2019
1 parent 297ea6f commit abb3d2b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/js/common/y_axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ function rimPlacement (args, axisArgs) {
if (position === 'left') {
coordinates.x1 = mg_get_left(args);
coordinates.x2 = mg_get_left(args);
coordinates.y1 = scale(ticks[0]).toFixed(2);
coordinates.y2 = scale(ticks[tick_length - 1]).toFixed(2);
coordinates.y1 = tick_length ? scale(ticks[0]).toFixed(2) : mg_get_top(args);
coordinates.y2 = tick_length ? scale(ticks[tick_length - 1]).toFixed(2) : mg_get_bottom(args);
}
if (position === 'right') {
coordinates.x1 = mg_get_right(args);
coordinates.x2 = mg_get_right(args);
coordinates.y1 = scale(ticks[0]).toFixed(2);
coordinates.y2 = scale(ticks[tick_length - 1]).toFixed(2);
coordinates.y1 = tick_length ? scale(ticks[0]).toFixed(2) : mg_get_top(args);
coordinates.y2 = tick_length ? scale(ticks[tick_length - 1]).toFixed(2) : mg_get_bottom(args);
}
if (position === 'top') {
coordinates.x1 = mg_get_left(args);
Expand Down

0 comments on commit abb3d2b

Please sign in to comment.