viz.macros

package viz.macros

Members list

Type members

Classlikes

class ArrField(path: List[String], headAccessor: Option[Any], elementAccessorFactory: Option[Int => Any], tupleAccessors: Map[String, Any]) extends Selectable

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

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

Provides type-safe modification of array-valued JSON fields. Unlike other field types, the += operator on arrays appends elements rather than deep merging.

For heterogeneous arrays (where elements have different structures), tuple-style accessors are available: _0, _1, _2, etc. Each accessor has the precise type of that specific element.

Value parameters

elementAccessorFactory

Optional factory function to create accessors for array elements at any index

headAccessor

Optional accessor for the first element of the array (if available)

path

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

tupleAccessors

Map of tuple-style accessors (_0, _1, etc.) for precise per-element types

Attributes

Example
// Replace the entire array spec.build(_.data.values := json"[{\"a\": 1}, {\"a\": 2}]")
// Append a single element spec.build(_.data.values += json"{\"a\": 3}")
// Append multiple elements spec.build(_.signals += Vector(json"{\"name\": \"sig1\"}", json"{\"name\": \"sig2\"}"))
// Access first element's nested field spec.build(_.data.head.values := json"[{\"a\": 1}]")
// Access element at index 2 with tuple-style accessor (precise type) spec.build(_.layer._2.data.sequence.start :=
5)
// Access element at index 2 with apply (uses first element's type) spec.build(_.data(2).values := json"[{\"a\":
1}]") 
Supertypes
trait Selectable
class Object
trait Matchable
class Any
class BoolField(path: List[String])

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

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

Provides type-safe modification of boolean-valued JSON fields.

Value parameters

path

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

Attributes

Example
spec.build(_.autosize := false)
Supertypes
class Object
trait Matchable
class Any
class NullField(path: List[String])

Accessor for null-valued fields in a Vega/Vega-Lite spec.

Accessor for null-valued fields in a Vega/Vega-Lite spec.

Provides modification of fields that are initially null in the spec.

Value parameters

path

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

Attributes

Supertypes
class Object
trait Matchable
class Any
class NumField(path: List[String])

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

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

Provides type-safe modification of number-valued JSON fields.

Value parameters

path

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

Attributes

Example
spec.build(_.width := 800, _.height := 600.5)
Supertypes
class Object
trait Matchable
class Any
class ObjField(path: List[String], fieldMap: Map[String, Any]) extends Selectable

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

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)
Supertypes
trait Selectable
class Object
trait Matchable
class Any
class StringField(path: List[String])

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

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

Provides type-safe modification of string-valued JSON fields.

Value parameters

path

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

Attributes

Example
spec.build(_.title := "New Title")
Supertypes
class Object
trait Matchable
class Any
object VegaPlot

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
VegaPlot.type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Types

type SpecMod = Json => Json

Type alias for spec modifier functions using circe Json

Type alias for spec modifier functions using circe Json

Attributes