Skip to content

Commit 152fefe

Browse files
committed
bar: document purpose of updatePositionAxis
1 parent 7440346 commit 152fefe

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/traces/bar/set_positions.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,12 @@ function updatePositionAxis(gd, pa, sieve, allowMinDtick) {
379379

380380
Axes.minDtick(pa, minDiff, distinctPositions0, allowMinDtick);
381381

382-
// if user set bar width or offset,
383-
// then check whether axis needs expanding
382+
// If the user set the bar width or the offset,
383+
// then bars can be shifted away from their positions
384+
// and widths can be larger than minDiff.
385+
//
386+
// Here, we compute pMin and pMax to expand the position axis,
387+
// so that all bars are fully within the axis range.
384388
var pMin = Math.min.apply(Math, distinctPositions) - vpad,
385389
pMax = Math.max.apply(Math, distinctPositions) + vpad;
386390

0 commit comments

Comments
 (0)