API
Deneb.CommonProperties
Deneb.ConcatSpec
Deneb.ConcatView
Deneb.ConstrainedSpec
Deneb.DataSpec
Deneb.EncodingSpec
Deneb.FacetSpec
Deneb.HConcatSpec
Deneb.LayerSpec
Deneb.LayoutProperties
Deneb.LayoutSpec
Deneb.MarkSpec
Deneb.MultiViewSpec
Deneb.ParamsSpec
Deneb.PropertiesSpec
Deneb.RepeatSpec
Deneb.ResolveSpec
Deneb.SingleSpec
Deneb.TopLevelProperties
Deneb.TransformSpec
Deneb.VConcatSpec
Deneb.VegaLiteSpec
Deneb.ViewableSpec
Base.:*
Base.:+
Base.getproperty
Base.hcat
Base.hvcat
Base.propertynames
Base.vcat
Deneb.Data
Deneb.Encoding
Deneb.Facet
Deneb.Mark
Deneb.Params
Deneb.Repeat
Deneb.Transform
Deneb.concat
Deneb.condition
Deneb.config
Deneb.expr
Deneb.field
Deneb.interactive_scales
Deneb.layout
Deneb.param
Deneb.print_theme
Deneb.projection
Deneb.resolve
Deneb.resolve_axis
Deneb.resolve_legend
Deneb.resolve_scale
Deneb.select
Deneb.select_bind_input
Deneb.select_checkbox
Deneb.select_dropdown
Deneb.select_interval
Deneb.select_legend
Deneb.select_point
Deneb.select_radio
Deneb.select_range
Deneb.set_theme!
Deneb.spec
Deneb.title
Deneb.transform_fold
Deneb.transform_window
Deneb.vlspec
Deneb.CommonProperties
— TypeCommon properties of all view specifications. https://vega.github.io/vega-lite/docs/spec.html#common The data
, transform
and params
common properties are defined in dedicated Spec types.
Deneb.ConcatSpec
— TypeGeneral concatenation specification. https://vega.github.io/vega-lite/docs/concat.html#concat
Deneb.ConcatView
— TypeConcatenation specifications. https://vega.github.io/vega-lite/docs/concat.html
Deneb.ConstrainedSpec
— TypeSpecifications that impose certain constrains in their properties
Deneb.DataSpec
— TypeSpec containing the data
property of viewable specifications. https://vega.github.io/vega-lite/docs/data.html
Deneb.EncodingSpec
— TypeSpec containing the encoding
property of a Single or Layered view specification. https://vega.github.io/vega-lite/docs/encoding.html
Deneb.FacetSpec
— TypeFacet specification. https://vega.github.io/vega-lite/docs/facet.html
Deneb.HConcatSpec
— TypeHorizontal concatenation specification. https://vega.github.io/vega-lite/docs/concat.html#hconcat
Deneb.LayerSpec
— TypeLayer specification. https://vega.github.io/vega-lite/docs/layer.html
Deneb.LayoutProperties
— TypeCommon properties of all layout (facet
, repeat
, concat
) specifications. https://vega.github.io/vega-lite/docs/spec.html#common
Deneb.LayoutSpec
— TypeFacet, Repeat and Concat specifications
Deneb.MarkSpec
— TypeSpec containing the mark
property of a Single-View spec. https://vega.github.io/vega-lite/docs/mark.html
Deneb.MultiViewSpec
— TypeLayered and Layout specifications. https://vega.github.io/vega-lite/docs/composition.html
Deneb.ParamsSpec
— TypeSpec containing the params
common property to all viewable specifications. https://vega.github.io/vega-lite/docs/parameter.html
Deneb.PropertiesSpec
— TypeSpecifications containing a specific set of properties
Deneb.RepeatSpec
— TypeRepeat specification. https://vega.github.io/vega-lite/docs/repeat.html
Deneb.ResolveSpec
— TypeSpec containing the resolve
property common to all Multi-View specifications. https://vega.github.io/vega-lite/docs/resolve.html
Deneb.SingleSpec
— TypeSingle view specification. https://vega.github.io/vega-lite/docs/spec.html#single
Deneb.TopLevelProperties
— TypeTop-Level specification of a Vega-Lite specification. https://vega.github.io/vega-lite/docs/spec.html#top-level
Deneb.TransformSpec
— TypeSpec containing the transform
common property to all viewable specifications. https://vega.github.io/vega-lite/docs/transform.html
Deneb.VConcatSpec
— TypeVertical concatenation specification. https://vega.github.io/vega-lite/docs/concat.html#vconcat
Deneb.VegaLiteSpec
— TypeVega-Lite specification. https://vega.github.io/vega-lite/docs/spec.html
Deneb.ViewableSpec
— TypeSingle and Multi-view specifications
Base.:*
— Methodspec1::AbstractSpec * spec2::AbstractSpec
Multiplication of two AbstractSpec
creates a new AbstractSpec
as a composition of the two specifications. For instance, vlspec(mark=:bar) * vlspec(title="chart")
will be equivalent to vlspec(mark=:bar, title="chart")
. Properties defined in spec2
have precedence over spec1
, meaning that if a given property is specified in both, then the result specification will use the property from spec2
. If the types of the two specs are different then the result spec will be a VegaLiteSpec.
Base.:+
— Methodspec1::ConstrainedSpec + spec2::ConstrainedSpec
The addition of two specs will produce a new spec with both specs layered. The order matters as spec1
will appear below spec2
. If the specs contain shared properties (e.g. data
, encoding
, width
...), they will be promoted to the top level specification. Multi-view layout specs (facet, repeat, concat) cannot be layered.
Base.getproperty
— Methodgetproperty(spec::AbstractSpec, property::Symbol)
Returns property property
of a specification.
Base.hcat
— Methodhcat(A::AbstractSpec...)
[spec1 spec2 spec3 ...]
Horizontal concatenation of specs.
Base.hvcat
— Methodhvcat(A::AbstractSpec...)
[spec1 spec2; spec3 spec4 ...]
General (wrappable) concatenation of specs.
Base.propertynames
— Methodpropertynames(::AbstractSpec)
Return the top-level properties of a specification.
Base.vcat
— Methodvcat(A::AbstractSpec...)
[spec1; spec2; spec3 ...]
Vertical concatenation of specs.
Deneb.Data
— MethodData(table)
Data(; url, [format], [name])
Data(generator::SymbolOrString; properties...)
Creates a DataSpec
containing the data
property of a viewable specification. Available constructors are:
- using a
table
that supports the Tables.jl interface - using a
url
to load the data from, with optionalformat
andname
properties. - using a
generator
with specificproperties
to a use any of the available Vega-Lite data generator
See more in Vega-Lite's and Deneb's documentation.
Deneb.Encoding
— MethodEncoding(x; channels...)
Encoding(x, y; channels...)
Encoding(; channels...)
Creates an EncodingSpec
containing the encoding
property of a single or layer view specification. The x
and y
channels can be specified as positional arguments using the shorthad string syntax. See more in Vega-Lite's and Deneb.jl's.
Examples
Encoding("monthdate(date):T", "mean(precipitation):Q", color="year(date):O")
Encoding(
x=field("bin_min:Q", bin=:binned, title="Maximum Daily Temperature (C)"),
y=field("value:Q", scale=(range=[20, -20]), axis=nothing),
fill=field="mean_temp:Q",
)
Deneb.Facet
— MethodFacet(; [row], , [column], kw...)
Facet(field; columns::Int=nothing, kw...)
Creates a FacetSpec
for a facet specification. . A field
can be passed as a positional argument, or must be passed in the row
/column
keyword argument.
Examples
Facet("site:O", columns=2, sort=(op=:median, field=:yield))
Facet(row="Origin:N)
Deneb.Mark
— MethodMark(type; kw...)
Mark(; spec...)
Creates a MarkSpec
containing the mark
property of a single view specification. The type
property of the mark can be specified as a positional argument. See more in Vega-Lite's and Deneb's documentation.
Deneb.Params
— MethodParams(; spec...)
Creates a ParamsSpec
containing the params
property of a viewable specification. See also the more convenient select_*
methods and the interactive_scales
function.
Deneb.Repeat
— MethodRepeat(; [row::Vector], [column::Vector], [layer::Vector])
Repeat(field::Vector{SymbolOrString}; columns::Int=nothing)
Creates a RepeatSpec
for a repeat specification. . A field
can be passed as a positional argument, or must be passed in the row
/column/layer
keyword argument.
Examples
Repeat([:Horsepower, :Miles_per_Gallon, :Acceleration], columns=2)
Repeat(column=[:distance, :delay, :time])
Deneb.Transform
— MethodTransform(; spec...)
Creates a TransformSpec
containing the transform
property of a viewable specification. See also the more convenient transform_*
methods.
Deneb.concat
— Methodconcat(A::AbstractSpec...; columns)
Deneb.condition
— Functioncondition(param::SymbolOrString, iftrue, iffalse; empty=nothing)
condition_test(test::String, iftrue, iffalse)
condition(param_then_pairs::Vector{Pair}, iffalse; empty::Vector=nothing)
condition_test(ifthen_pairs::Vector{Pair}, iffalse)
If iftrue/iffalse isn't a NamedTuple, then it'll be converted as a NamedTuple with name :value. Nested conditions via a vector of ifthen_pairs.
Examples
condition(:myparam, 1, 2; empty=true)
condition_test("datum.x > 0", field("color:O"), :blue)
condition_test(["datum.x > 5" => field("color:O"), "datum.x < 0" => :blue], :gray)
Deneb.config
— Methodconfig(; properties...)
config(type; properties...)
Deneb.expr
— Methodexpr(expr)
Convenient function to create an expr spec: {"expr": expr}
.
Deneb.field
— Methodfield(field; kw...)
Shortcut to create an arbitrary encoding channel, the positional argument field
can use the shorthand string syntax (e.g. "mean(x):Q").
Deneb.interactive_scales
— Methodinteractive_scales(;bindx=true, bindy=true, shift_on_y=false)
Creates a ParamsSpec
that can be composed to other specs to create interactive pan (mouse hold and drag) and zoom (mouse wheel) charts. bindx
and bindy
specify if the x
and y
channels are to be bound. If shift_on_y
is true, then the shift key must be hold to pan and zoom in the y
channel.
Deneb.layout
— Methodlayout(; align, bounds, center, spacing, columns)
Set layout properties. Needs to be composed with a LayoutSpec (Repeat, Facet, Concat).
Deneb.param
— Methodparam(param)
Convenient function to create a param spec: {"param": param}
.
Deneb.print_theme
— Functionprint_theme()
Prints the specification of the current theme.
Deneb.projection
— Methodprojection(type; kw...)
Sets the projection properties.
Deneb.resolve
— Methodresolve(type; channels...)
resolve(type, channel, option)
Creates a ResolveSpec
. The type
indicates the resolution to be defined: scale
, axis
, or legend
.
For scales, resolution can be specified for every channel. For axes, resolutions can be defined for positional channels (x
, y
, xOffset
, yOffset
). For legends, resolutions can be defined for non-positional channels (color
, opacity
, shape
, and size
).
There are two options to resolve a scale, axis, or legend: shared
and independent
. Independent scales imply independent axes and legends.
The defaults are documented in Vega-Lite's documentation.
Example
resolve(:scale, color=:independent)
Deneb.resolve_axis
— Methodresolve_axis(; channels...)
Alias to resolve(:axis; channels...)
Deneb.resolve_legend
— Methodresolve_legend(; channels...)
Alias to resolve(:legend; channels...)
Deneb.resolve_scale
— Methodresolve_scale(; channels...)
Alias to resolve(:scale; channels...)
Deneb.select
— Methodselect(type, name; value, bind, select_options...)
Convenient function to create a ParamsSpec
with the following structure:
{
"name": name,
"value": value,
"select": {
"type": type,
select_options...
},
"bind": bind
}
Deneb.select_bind_input
— Methodselect_bind_input(type, name; value, select, bind_options...)
Convenient function to create a ParamsSpec
with the following structure:
{
"name": name,
"value": value,
"select": select,
"bind": {
"input": type,
bind_options...
}
}
Deneb.select_checkbox
— Methodselect_checkbox(type, name; value, select, bind_options...)
Deneb.select_dropdown
— Methodselect_dropdown(type, name; options, value, select, bind_options...)
options is required
Deneb.select_interval
— Methodselect_interval()
Deneb.select_legend
— Methodselect_legend(name; encodings=:color, fields=nothing, bind_options=nothing)
Creates a ParamSpec
named name
that can be composed to other specs to create selectable legends bound to the given encoding
or field
. To customize the events that trigger legend interaction, set bind_options
with a property that maps to a Vega event stream (e.g. "dblclick"). More info about legend binding: https://vega.github.io/vega-lite/docs/bind.html#legend-binding
Deneb.select_point
— Methodselect_point()
Deneb.select_radio
— Methodselect_radio(type, name; options, value, select, bind_options...)
options is required
Deneb.select_range
— Methodselect_range(type, name; value, select, bind_options...)
Deneb.set_theme!
— Methodset_theme!(theme::Symbol)
Sets the current theme to be used. The default Deneb's theme (:default
) sets the following global config:
{
"view": {"continuousWidth": 300, "continuousHeight": 300, "step": 25},
"mark": {"tooltip": true}
}
The :default_no_tooltip
theme sets the default size as above, but disables tooltips. The :empty
theme uses Vega-Lite default empty configuration.
Other available themes are any of the Vega themes: :dark
, :excel
, :fivethirtyeight
, :ggplot2
, :googlecharts
, :latimes
, :powerbi
, :quartz
, :urbaninstitute
, :vox
(see https://vega.github.io/vega-themes for more info). In this case the :default
global config will be used.
set_theme!(config_theme::Symbol, vega_theme::Symbol)
Sets the global config theme (:default
, :default_no_tooltip
, :empty
) and the vega theme (use vega_theme = :default
for no vega theme).
set_theme!(config::NamedTuple, [vega_theme::Symbol])
Sets a theme with a user-specified config.
Deneb.spec
— Methodspec(s)
Creates an arbitrary Vega-Lite spec.
Deneb.title
— Methodtitle(title)
Deneb.transform_fold
— Methodtransform_fold(fold::Vector; as=(:key, :value))
Wide to long transformation
Deneb.transform_window
— Methodif a sortby field starts with '-' then descending order
Deneb.vlspec
— Methodvlspec(s)
Creates a Vega-Lite spec enforcing certain Vega-Lite constrains.
Example
vlspec(
data=(; url="https://vega.github.io/vega-datasets/data/seattle-weather.csv"),
mark=:bar,
encoding=(
x=(timeUnit=:month, field=:date, type=:ordinal),
y=(aggregate=:mean, field=:precipitation),
)
)