Skip to content

Commit

Permalink
fix: allow setting width/height in repeated layers (#8723)
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Mar 6, 2023
1 parent 36a4480 commit 9e26410
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build/vega-lite-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12467,7 +12467,7 @@
"$ref": "#/definitions/LayerSpec"
},
{
"$ref": "#/definitions/UnitSpec"
"$ref": "#/definitions/UnitSpecWithFrame"
}
],
"description": "A specification of the view that gets repeated."
Expand Down Expand Up @@ -29223,7 +29223,7 @@
"$ref": "#/definitions/LayerSpec"
},
{
"$ref": "#/definitions/UnitSpec"
"$ref": "#/definitions/UnitSpecWithFrame"
}
],
"description": "A specification of the view that gets repeated."
Expand Down
30 changes: 30 additions & 0 deletions examples/specs/repeat_layer_size.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"url": "data/movies.json"
},
"repeat": {
"layer": ["US Gross", "Worldwide Gross"]
},
"spec": {
"width": 200,
"mark": "line",
"encoding": {
"x": {
"bin": true,
"field": "IMDB Rating",
"type": "quantitative"
},
"y": {
"aggregate": "mean",
"field": {"repeat": "layer"},
"type": "quantitative",
"title": "Mean of US and Worldwide Gross"
},
"color": {
"datum": {"repeat": "layer"},
"type": "nominal"
}
}
}
}
4 changes: 2 additions & 2 deletions src/spec/repeat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {isArray} from 'vega-util';
import {LayerSpec, NonNormalizedSpec} from '.';
import {Field} from '../channeldef';
import {BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';
import {UnitSpec} from './unit';
import {UnitSpecWithFrame} from './unit';

export interface RepeatMapping {
/**
Expand Down Expand Up @@ -53,7 +53,7 @@ export interface LayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithC
/**
* A specification of the view that gets repeated.
*/
spec: LayerSpec<Field> | UnitSpec<Field>;
spec: LayerSpec<Field> | UnitSpecWithFrame<Field>;
}

export function isRepeatSpec(spec: BaseSpec): spec is RepeatSpec {
Expand Down

0 comments on commit 9e26410

Please sign in to comment.