ObjField

viz.macros.ObjField
class ObjField(path: List[String], fieldMap: Map[String, Any]) extends Selectable

Accessor for object fields in a Vega/Vega-Lite spec.

Provides type-safe modification of object-valued JSON fields. Extends Selectable to allow compile-time checked access to nested fields via dot notation.

The := operator replaces the entire object, while += performs a deep merge preserving existing fields.

Value parameters

fieldMap

Map of nested field names to their accessor objects (used by selectDynamic)

path

The JSON path to this field as a list of field names

Attributes

Example
// Replace entire object spec.build(_.title := json"{\"text\": \"New\", \"fontSize\": 20}")
// Deep merge - adds/updates fields while preserving others spec.build(_.title += json"{\"color\": \"red\"}")
// Access nested fields with compile-time checking spec.build(_.title.text := "New Title", _.title.fontSize := 20)
Graph
Supertypes
trait Selectable
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def +=(j: Json): SpecMod

Deep merge a JSON value into this object.

Deep merge a JSON value into this object.

Existing fields not present in j are preserved. Fields present in both are overwritten by j.

Attributes

def +=(obj: JsonObject): SpecMod

Deep merge a JSON object into this object.

Deep merge a JSON object into this object.

Existing fields not present in obj are preserved. Fields present in both are overwritten by obj.

Attributes

def :=(j: Json): SpecMod

Replace the entire object with arbitrary JSON

Replace the entire object with arbitrary JSON

Attributes

def :=(obj: JsonObject): SpecMod

Replace the entire object with a JSON object

Replace the entire object with a JSON object

Attributes

def apply(j: Json): SpecMod
def apply(obj: JsonObject): SpecMod
def selectDynamic(name: String): Any