Writing Vega specifications
Structure maintainable Vega JSON, separate reusable configuration, and use the Studio preview cycle to develop visual behavior safely.
Ataytis Vega Studio runs the Vega grammar and runtime, providing direct access to dataflow transforms, scales, projections, axes, legends, marks, signals, event streams, and expressions inside Power BI.
Specification and configuration
| Specification content | Keep here |
|---|---|
| Structure | Schema, data references, transforms, signals, scales, axes, legends, marks, and visual-level metadata. |
config block | Reusable Vega configuration such as default mark styling, axis defaults, legend defaults, range choices, and autosize behavior. |
The current release exposes a single Spec editor, so keep configuration in the specification's own config block. Grouping defaults there rather than repeating them on every mark keeps a complex specification readable and lets its styling decisions travel with it into another report.
Specification structure
- 1
Declare the schema and viewport behavior
Set
$schema, dimensions or container sizing, padding, background, and autosize behavior first. - 2
Declare datasets and transforms
Reference
dataset, then add named derived datasets and transforms in a logical order. - 3
Add signals
Keep visual parameters, interaction state, and responsive calculations in clearly named signals.
- 4
Define scales and projections
Use stable names and keep domain/range decisions close to the datasets they depend on.
- 5
Add guides
Define axes and legends after their scales so relationships remain easy to follow.
- 6
Build marks in visual stacking order
Place backgrounds first, data marks next, then labels, annotations, and interactive overlays.
- 7
Describe the visual last
Add a
description, and any notes about the fields the specification expects, once the structure has settled.
Authoring cycle
- Make one structural change at a time and apply it manually.
- Check Diagnostics immediately if the preview stops rendering.
- Check Data table before assuming a transform or scale is wrong.
- Use Live signals to verify interaction state and responsive calculations.
- Only enable live preview after the specification parses successfully.
- Save the PBIX at stable milestones, and copy the specification into a separate versioned file when it is worth reusing.



