Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/coord/cartesian/Grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,14 @@ function layOutGridByOuterBounds(
let proportion = axis.scale.normalize(
getTickValueOutermost(axis.scale, getLabelInner(labelInfo.label).labelInfo.tick)
);
// `normalize` is in data space and does not account for
// `inverse`, while the proportion below is measured in
// pixel space from the min edge of the grid. Flip it for
// inverse axes, otherwise a tick near one edge is treated
// as near the other edge and the grid collapses.
if (axis.inverse) {
proportion = 1 - proportion;
}
proportion = xyIdx === 1 ? 1 - proportion : proportion;
// xAxis use proportion on x, yAxis use proprotion on y, otherwise not.
fillMarginOnOneDimension(labelInfo.rect, xyIdx, proportion);
Expand Down
63 changes: 63 additions & 0 deletions test/ut/spec/component/grid.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.