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 Selectableclass Objecttrait Matchableclass Any
Members list
In this article