From 895c8f445887a05356252367213f129bddfc309f Mon Sep 17 00:00:00 2001 From: "Weng, Chia-Ling" <75072960+ChiaLingWeng@users.noreply.github.com> Date: Wed, 24 Jan 2024 09:15:37 +0000 Subject: [PATCH 1/4] fix: use child signal for radius if faceted --- src/compile/scale/range.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/compile/scale/range.ts b/src/compile/scale/range.ts index e114d5625e..4f87f21614 100644 --- a/src/compile/scale/range.ts +++ b/src/compile/scale/range.ts @@ -63,6 +63,7 @@ import {Explicit, makeExplicit, makeImplicit} from '../split'; import {UnitModel} from '../unit'; import {ScaleComponentIndex} from './component'; import {durationExpr} from '../../timeunit'; +import {isFacetModel} from '../model'; export const RANGE_PROPERTIES: (keyof Scale)[] = ['range', 'scheme']; @@ -237,16 +238,16 @@ function fullWidthOrHeightRange( // For y continuous scale, we have to start from the height as the bottom part has the max value. return center ? [ - SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal), - SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal) - ] + SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal), + SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal) + ] : [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0]; } else { return center ? [ - SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal), - SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal) - ] + SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal), + SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal) + ] : [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)]; } } @@ -306,11 +307,12 @@ function defaultRange(channel: ScaleChannel, model: UnitModel): VgRange { case RADIUS: { // max radius = half od min(width,height) + return [ 0, new SignalRefWrapper(() => { - const w = model.getSignalName('width'); - const h = model.getSignalName('height'); + const w = isFacetModel(model.parent) ? model.getSignalName('child_width') : model.getSignalName('width'); + const h = isFacetModel(model.parent) ? model.getSignalName('child_height') : model.getSignalName('height'); return `min(${w},${h})/2`; }) ]; From be56875ee5523f520a81f3b7951e100714d15725 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Wed, 24 Jan 2024 09:18:59 +0000 Subject: [PATCH 2/4] style: auto-formatting [CI] --- src/compile/scale/range.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compile/scale/range.ts b/src/compile/scale/range.ts index 4f87f21614..b8fcea4235 100644 --- a/src/compile/scale/range.ts +++ b/src/compile/scale/range.ts @@ -238,16 +238,16 @@ function fullWidthOrHeightRange( // For y continuous scale, we have to start from the height as the bottom part has the max value. return center ? [ - SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal), - SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal) - ] + SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal), + SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal) + ] : [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0]; } else { return center ? [ - SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal), - SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal) - ] + SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal), + SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal) + ] : [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)]; } } From 7497085a298ce3c4c0b9fe2292332bf70e80eaa6 Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Mon, 29 Jan 2024 20:43:25 -0500 Subject: [PATCH 3/4] Update src/compile/scale/range.ts --- src/compile/scale/range.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compile/scale/range.ts b/src/compile/scale/range.ts index b8fcea4235..c0cb2a1f54 100644 --- a/src/compile/scale/range.ts +++ b/src/compile/scale/range.ts @@ -311,8 +311,8 @@ function defaultRange(channel: ScaleChannel, model: UnitModel): VgRange { return [ 0, new SignalRefWrapper(() => { - const w = isFacetModel(model.parent) ? model.getSignalName('child_width') : model.getSignalName('width'); - const h = isFacetModel(model.parent) ? model.getSignalName('child_height') : model.getSignalName('height'); + const w = model.getSignalName(isFacetModel(model.parent) ? 'child_width' : 'width'); + const h = model.getSignalName(isFacetModel(model.parent) ?'child_height' : 'height'); return `min(${w},${h})/2`; }) ]; From ab9ae070386719fa0ad6c9b1a15037ef16525132 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Tue, 30 Jan 2024 01:45:39 +0000 Subject: [PATCH 4/4] style: auto-formatting [CI] --- src/compile/scale/range.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compile/scale/range.ts b/src/compile/scale/range.ts index c0cb2a1f54..87058fea01 100644 --- a/src/compile/scale/range.ts +++ b/src/compile/scale/range.ts @@ -312,7 +312,7 @@ function defaultRange(channel: ScaleChannel, model: UnitModel): VgRange { 0, new SignalRefWrapper(() => { const w = model.getSignalName(isFacetModel(model.parent) ? 'child_width' : 'width'); - const h = model.getSignalName(isFacetModel(model.parent) ?'child_height' : 'height'); + const h = model.getSignalName(isFacetModel(model.parent) ? 'child_height' : 'height'); return `min(${w},${h})/2`; }) ];