VegaSpec

viz.vega.VegaSpec
class VegaSpec[M](val rawSpec: Json, val mod: M, val sourceInfo: Option[SourceInfo] = ...)

Vega spec wrapper to generate typed accessors inferred from the JSON structure.

When created from a file via VegaPlot.relativeToSource/VegaPlot.projectRoot/VegaPlot.absolutePath or resource via VegaPlot.fromResource, this class tracks the source and automatically uses fresh content if it has changed since compilation. This ensures the output is always correct, even if the typed accessors are stale.

Value parameters

mod

The typed accessor object for modifications

rawSpec

The JSON spec as parsed at compile time

sourceInfo

Optional source tracking for staleness detection

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def build(mods: M => SpecMod*): Json

Apply modifications using lambda syntax: spec.build(_.title := "New")

Apply modifications using lambda syntax: spec.build(_.title := "New")

If the source has changed, modifications are applied to the fresh content.

Attributes

def buildWith(mods: SpecMod*): Json

Apply modifications directly: spec.buildWith(titleMod, widthMod)

Apply modifications directly: spec.buildWith(titleMod, widthMod)

If the source has changed, modifications are applied to the fresh content.

Attributes

def overlay(mods: M => SpecMod*): VegaSpec[M]

Apply modifications, returning a new spec so they can be chained: spec.overlay(_.title := "New").build(...)

Apply modifications, returning a new spec so they can be chained: spec.overlay(_.title := "New").build(...)

If the source has changed, modifications are applied to the fresh content. The returned spec carries the already modified JSON and no longer tracks the source, since re-reading it would discard these modifications.

Attributes

def overlayWith(mods: SpecMod*): VegaSpec[M]

Apply modifications directly, returning a new spec so they can be chained: spec.overlayWith(titleMod).build(...)

Apply modifications directly, returning a new spec so they can be chained: spec.overlayWith(titleMod).build(...)

This cannot be an overload of overlay: SpecMod is itself a function type, so a lambda like _.title := "x" matches both signatures and the call is ambiguous. Named like build/buildWith for the same reason.

If the source has changed, modifications are applied to the fresh content. The returned spec carries the already modified JSON and no longer tracks the source, since re-reading it would discard these modifications.

Attributes

Concrete fields

val mod: M
val rawSpec: Json
val sourceInfo: Option[SourceInfo]