Skip to content

Commit

Permalink
Merge pull request #134 from VisActor/sync/main
Browse files Browse the repository at this point in the history
Sync/main
  • Loading branch information
zamhown authored Nov 20, 2023
2 parents 5caf8ae + 2538c40 commit 36cd224
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 21 deletions.
10 changes: 10 additions & 0 deletions common/changes/@visactor/vscale/sync-main_2023-11-20-16-04.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vscale",
"comment": "fix: inaccurate wholeRange in band scale",
"type": "none"
}
],
"packageName": "@visactor/vscale"
}
4 changes: 2 additions & 2 deletions common/config/rush/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"definitionName":"lockStepVersion","policyName":"vutilMain","version":"0.16.11","nextBump":"patch"}]
[{"definitionName":"lockStepVersion","policyName":"vutilMain","version":"0.16.12","nextBump":"patch"}]
6 changes: 6 additions & 0 deletions packages/vdataset/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/vdataset",
"entries": [
{
"version": "0.16.12",
"tag": "@visactor/vdataset_v0.16.12",
"date": "Mon, 20 Nov 2023 06:23:53 GMT",
"comments": {}
},
{
"version": "0.16.11",
"tag": "@visactor/vdataset_v0.16.11",
Expand Down
7 changes: 6 additions & 1 deletion packages/vdataset/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/vdataset

This log was last generated on Mon, 20 Nov 2023 03:24:54 GMT and should not be manually modified.
This log was last generated on Mon, 20 Nov 2023 06:23:53 GMT and should not be manually modified.

## 0.16.12
Mon, 20 Nov 2023 06:23:53 GMT

_Version update only_

## 0.16.11
Mon, 20 Nov 2023 03:24:54 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/vdataset/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vdataset",
"version": "0.16.11",
"version": "0.16.12",
"main": "cjs/index.js",
"module": "es/index.js",
"types": "es/index.d.ts",
Expand Down Expand Up @@ -35,7 +35,7 @@
"test-cov": "jest -w 16 --coverage"
},
"dependencies": {
"@visactor/vutils": "workspace:0.16.11",
"@visactor/vutils": "workspace:0.16.12",
"@turf/flatten": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/rewind": "^6.5.0",
Expand Down
12 changes: 12 additions & 0 deletions packages/vscale/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"name": "@visactor/vscale",
"entries": [
{
"version": "0.16.12",
"tag": "@visactor/vscale_v0.16.12",
"date": "Mon, 20 Nov 2023 06:23:53 GMT",
"comments": {
"none": [
{
"comment": "fix: one of the two endpoints of rangeFactor is null during initialization"
}
]
}
},
{
"version": "0.16.11",
"tag": "@visactor/vscale_v0.16.11",
Expand Down
9 changes: 8 additions & 1 deletion packages/vscale/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log - @visactor/vscale

This log was last generated on Mon, 20 Nov 2023 03:24:54 GMT and should not be manually modified.
This log was last generated on Mon, 20 Nov 2023 06:23:53 GMT and should not be manually modified.

## 0.16.12
Mon, 20 Nov 2023 06:23:53 GMT

### Updates

- fix: one of the two endpoints of rangeFactor is null during initialization

## 0.16.11
Mon, 20 Nov 2023 03:24:54 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/vscale/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vscale",
"version": "0.16.11",
"version": "0.16.12",
"description": "Scales for visual encoding, used in VGrammar, VTable",
"keywords": [
"scale",
Expand Down Expand Up @@ -34,7 +34,7 @@
"test-cov": "jest -w 16 --coverage"
},
"dependencies": {
"@visactor/vutils": "workspace:0.16.11"
"@visactor/vutils": "workspace:0.16.12"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
Expand Down
22 changes: 12 additions & 10 deletions packages/vscale/src/band-scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,20 @@ export class BandScale extends OrdinalScale implements IBandLikeScale {
}

if (this.isBandwidthFixed()) {
const wholeLength = scaleWholeRangeSize(
super.domain().length,
this._bandwidth,
this._paddingInner,
this._paddingOuter
);

const wholeLength =
scaleWholeRangeSize(super.domain().length, this._bandwidth, this._paddingInner, this._paddingOuter) *
Math.sign(range[1] - range[0]);
const rangeFactorSize = Math.min((range[1] - range[0]) / wholeLength, 1);
if (isValid(this._rangeFactorStart) && isValid(this._rangeFactorEnd)) {
const r0 = range[0] - wholeLength * this._rangeFactorStart;
const r1 = r0 + wholeLength;
this._wholeRange = [r0, r1];
if (wholeLength > 0) {
const r0 = range[0] - wholeLength * this._rangeFactorStart;
const r1 = r0 + wholeLength;
this._wholeRange = [r0, r1];
} else {
const r1 = range[1] + wholeLength * (1 - this._rangeFactorEnd);
const r0 = r1 - wholeLength;
this._wholeRange = [r0, r1];
}

if (changeProperty === 'rangeFactorStart' && this._rangeFactorStart + rangeFactorSize <= 1) {
this._rangeFactorEnd = this._rangeFactorStart + rangeFactorSize;
Expand Down
6 changes: 6 additions & 0 deletions packages/vutils/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/vutils",
"entries": [
{
"version": "0.16.12",
"tag": "@visactor/vutils_v0.16.12",
"date": "Mon, 20 Nov 2023 06:23:53 GMT",
"comments": {}
},
{
"version": "0.16.11",
"tag": "@visactor/vutils_v0.16.11",
Expand Down
7 changes: 6 additions & 1 deletion packages/vutils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/vutils

This log was last generated on Mon, 20 Nov 2023 03:24:54 GMT and should not be manually modified.
This log was last generated on Mon, 20 Nov 2023 06:23:53 GMT and should not be manually modified.

## 0.16.12
Mon, 20 Nov 2023 06:23:53 GMT

_Version update only_

## 0.16.11
Mon, 20 Nov 2023 03:24:54 GMT
Expand Down
2 changes: 1 addition & 1 deletion packages/vutils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vutils",
"version": "0.16.11",
"version": "0.16.12",
"main": "cjs/index.js",
"module": "es/index.js",
"types": "es/index.d.ts",
Expand Down

0 comments on commit 36cd224

Please sign in to comment.