Datasets:
File size: 7,545 Bytes
f3042bd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | # Vega-Lite 6.4.3 submission contract
Author one complete Vega-Lite 6.4.3 specification for the task. The chart is rendered in a fixed 900 × 620 CSS-pixel viewport.
Submit a complete JavaScript program with the `code` tool. The program returns the complete specification as plain object literals; it does not print it or return a patch. The TypeScript declarations in the appendix are reference only: write plain JavaScript, with no type annotations. Imports, files, and network access are disabled.
Bind the task rows by name with `data: { name: "table" }`. The host replaces each such reference with exactly the rows shown in the task before validation. Do not copy the rows into the specification: an inline row that repeats every field of a task row is rejected.
The program may also read the same rows, for example to compute domains:
```typescript
declare function getData(): Promise<Array<Record<string, unknown>>>;
```
The host accepts a submission only after JSON-Schema validation, Vega-Lite compilation, parsing, and a dataflow run all succeed. A rejected call returns its stage and error. Repair it by submitting another complete program.
Each attempt is retained for evaluation. The latest submission, not the last accepted one, controls the final outcome: a later invalid submission makes the final outcome invalid even when an earlier accepted chart is retained for audit. Stop after acceptance.
---
Schema appendix:
## axis.aria
Object role: `axis`; authored property: `aria`.
## Shared aria contract a79a74e2e438
Shared by 2 byte-identical schema locations.
Representative compact declaration:
## Axis.aria
Schema pointer: `#/definitions/Axis/properties/aria`
```typescript
type Axis_aria = boolean | ExprRef;
```
## channel.aggregate
Object role: `channel`; authored property: `aggregate`.
## Shared aggregate contract bbefebfb99c1
Shared by 20 byte-identical schema locations.
Representative compact declaration:
## ConditionalParameter<StringFieldDef>.aggregate
Schema pointer: `#/definitions/ConditionalParameter<StringFieldDef>/properties/aggregate`
```typescript
type ConditionalParameter_StringFieldDef__aggregate = Aggregate;
```
Aggregation function for the field (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`).
__Default value:__ `undefined` (None)
__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation.
## composition.$schema
Object role: `composition`; authored property: `$schema`.
## Shared $schema contract e72a79890b63
Shared by 6 byte-identical schema locations.
Representative compact declaration:
## TopLevelConcatSpec.$schema
Schema pointer: `#/definitions/TopLevelConcatSpec/properties/$schema`
```typescript
type TopLevelConcatSpec_$schema = string;
```
URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v6.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.
## encoding.angle
Object role: `encoding`; authored property: `angle`.
## Shared angle contract 54544d82899c
Shared by 2 byte-identical schema locations.
Representative compact declaration:
## Encoding.angle
Schema pointer: `#/definitions/Encoding/properties/angle`
```typescript
type Encoding_angle = NumericMarkPropDef;
```
Rotation angle of point and text marks.
## mark.align
Object role: `mark`; authored property: `align`.
## Shared align contract d3fa7ca91a11
Shared by 8 byte-identical schema locations.
Representative compact declaration:
## AreaConfig.align
Schema pointer: `#/definitions/AreaConfig/properties/align`
```typescript
type AreaConfig_align = Align | ExprRef;
```
The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `"left"`, `"right"`, `"center"`.
__Note:__ Expression reference is *not* supported for range marks.
## root.$schema
Object role: `root`; authored property: `$schema`.
## scale.align
Object role: `scale`; authored property: `align`.
## Scale.align
Schema pointer: `#/definitions/Scale/properties/align`
```typescript
type Scale_align = number | ExprRef;
```
The alignment of the steps within the scale range.
This value must lie in the range `[0,1]`. A value of `0.5` indicates that the steps should be centered within the range. A value of `0` or `1` may be used to shift the bands to one side, say to position them adjacent to an axis.
__Default value:__ `0.5`
## transform.aggregate
Object role: `transform`; authored property: `aggregate`.
## AggregateTransform.aggregate
Schema pointer: `#/definitions/AggregateTransform/properties/aggregate`
```typescript
type AggregateTransform_aggregate = AggregatedFieldDef[];
```
Array of objects that define fields to aggregate.
## unit.$schema
Object role: `unit`; authored property: `$schema`.
## axis.bandPosition
Object role: `axis`; authored property: `bandPosition`.
## Shared bandPosition contract 2dcb739946cc
Shared by 2 byte-identical schema locations.
Representative compact declaration:
## Axis.bandPosition
Schema pointer: `#/definitions/Axis/properties/bandPosition`
```typescript
type Axis_bandPosition = number | ExprRef;
```
## channel.align
Object role: `channel`; authored property: `align`.
## composition.align
Object role: `composition`; authored property: `align`.
## encoding.color
Object role: `encoding`; authored property: `color`.
## mark.angle
Object role: `mark`; authored property: `angle`.
## Shared angle contract a07a96b32771
Shared by 8 byte-identical schema locations.
Representative compact declaration:
## AreaConfig.angle
Schema pointer: `#/definitions/AreaConfig/properties/angle`
```typescript
type AreaConfig_angle = number | ExprRef;
```
## root.align
Object role: `root`; authored property: `align`.
---
# Contracts that earlier submissions often got wrong
Each block is the schema contract at a location where earlier submissions for other tasks were rejected. It restates the schema; it is not an example.
Schema contract for Position2Def:
type Position2Def = SecondaryFieldDef | DatumDef | PositionValueDef;
type SecondaryFieldDef = { aggregate?: Aggregate; bandPosition?: number; bin?: null; field?: Field; timeUnit?: TimeUnit | BinnedTimeUnit | TimeUnitParams; title?: Text | null };
type DatumDef = { bandPosition?: number; datum?: PrimitiveValue | DateTime | ExprRef | RepeatRef; title?: Text | null; type?: Type };
type ValueDefNumberWidthHeightExprRef = { value: number | "width" | "height" | ExprRef };
Schema contract for FacetFieldDef:
type FacetFieldDef = { aggregate?: Aggregate; bandPosition?: number; bin?: boolean | BinParams | null; field?: Field; header?: Header | null; sort?: SortArray | SortOrder | EncodingSortField | null; timeUnit?: TimeUnit | BinnedTimeUnit | TimeUnitParams; title?: Text | null; type?: StandardType };
Schema contract for TopLevelFacetSpec:
type TopLevelFacetSpec = { $schema?: string; align?: LayoutAlign | RowCol<LayoutAlign>; autosize?: AutosizeType | AutoSizeParams; background?: Color | ExprRef; bounds?: "full" | "flush"; center?: boolean | RowCol<boolean>; columns?: number; config?: Config; data: Data | null; datasets?: Datasets; description?: string; facet: FacetFieldDef | FacetMapping; name?: string; padding?: Padding | ExprRef; params?: TopLevelParameter[]; resolve?: Resolve; spacing?: number | RowCol<number>; spec: LayerSpec | UnitSpecWithFrame; title?: Text | TitleParams; transform?: Transform[]; usermeta?: Dict }; |