Skip to content

Commit

Permalink
Merge pull request #147 from VisActor/fix/1123
Browse files Browse the repository at this point in the history
fix: problems in scale align
  • Loading branch information
zamhown authored Nov 23, 2023
2 parents 74cea75 + 0566259 commit 6772c79
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
10 changes: 10 additions & 0 deletions common/changes/@visactor/vscale/fix-1123_2023-11-23-12-46.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vscale",
"comment": "fix: fix the scale problem in version 0.16.17",
"type": "none"
}
],
"packageName": "@visactor/vscale"
}
20 changes: 10 additions & 10 deletions packages/vscale/src/band-scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,7 @@ export class BandScale extends OrdinalScale implements IBandLikeScale {
this._rangeFactorStart = this._rangeFactorEnd - rangeFactorSize;
} else {
// 判断 scale 方向来决定边界检测顺序
if (range[1] > range[0]) {
if (canAlignEnd) {
this._rangeFactorStart = this._rangeFactorEnd - rangeFactorSize;
} else if (canAlignStart) {
this._rangeFactorEnd = this._rangeFactorStart + rangeFactorSize;
} else {
this._rangeFactorStart = 1 - rangeFactorSize;
this._rangeFactorEnd = 1;
}
} else {
if (range[0] <= range[1]) {
if (canAlignStart) {
this._rangeFactorEnd = this._rangeFactorStart + rangeFactorSize;
} else if (canAlignEnd) {
Expand All @@ -159,6 +150,15 @@ export class BandScale extends OrdinalScale implements IBandLikeScale {
this._rangeFactorStart = 0;
this._rangeFactorEnd = rangeFactorSize;
}
} else {
if (canAlignEnd) {
this._rangeFactorStart = this._rangeFactorEnd - rangeFactorSize;
} else if (canAlignStart) {
this._rangeFactorEnd = this._rangeFactorStart + rangeFactorSize;
} else {
this._rangeFactorStart = 1 - rangeFactorSize;
this._rangeFactorEnd = 1;
}
}
}
} else {
Expand Down

0 comments on commit 6772c79

Please sign in to comment.