Skip to content

Commit

Permalink
fix(pictorial): fix zero value flipping for different axes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovilia committed Dec 4, 2024
1 parent b9705c5 commit 08fb397
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 33 deletions.
4 changes: 3 additions & 1 deletion src/chart/bar/PictorialBarView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ function prepareBarLength(

// if 'pxSign' means sign of pixel, it can't be zero, or symbolScale will be zero
// and when borderWidth be settled, the actual linewidth will be NaN
outputSymbolMeta.pxSign = boundingLength >= 0 ? 1 : -1;
outputSymbolMeta.pxSign = (valueDim.xy === 'x' !== valueAxis.inverse)
? boundingLength >= 0 ? 1 : -1
: boundingLength > 0 ? 1 : -1;
}

function convertToCoordOnAxis(axis: Axis2D, value: number) {
Expand Down
102 changes: 70 additions & 32 deletions test/pictorial-zero-value.html

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

0 comments on commit 08fb397

Please sign in to comment.