Skip to content

Commit

Permalink
fix: use child signal for radius if faceted (#9232)
Browse files Browse the repository at this point in the history
close #8754 
I found that the range for radius using width and height without
checking if the model is faceted

https://github.com/vega/vega-lite/blob/c33f46bad7f80f779e463a8a36481f888f18e222/src/compile/scale/range.ts#L311-L314

---------

Co-authored-by: GitHub Actions Bot <[email protected]>
Co-authored-by: Dominik Moritz <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2024
1 parent c33f46b commit e11af45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/compile/scale/range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'];

Expand Down Expand Up @@ -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 = model.getSignalName(isFacetModel(model.parent) ? 'child_width' : 'width');
const h = model.getSignalName(isFacetModel(model.parent) ? 'child_height' : 'height');
return `min(${w},${h})/2`;
})
];
Expand Down

0 comments on commit e11af45

Please sign in to comment.