Skip to main content

Layout - VegaViewSpecifier

Layout.VegaViewSpecifier

Define a UI Chart based on a Vega-Lite specification from a

Stream within a LayoutBuilder.

Remarks

See

Vega-Lite for more information about specifications.

Type parameters

NameType
Textends DictType | ArrayType = DictType | ArrayType

Layout

area

area(def):

VegaCartesianViewFinalizer

Define a

Area chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType | StringType | DateTimeType
Yextends IntegerType | FloatType
Colorextends StringType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omitthe definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width
def.x(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the x value
def.y(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the y value
def.y2?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the second y value https://vega.github.io/vega-lite/docs/encoding.html#position

Returns

VegaCartesianViewFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.area({
x: builder => builder
.value(fields => fields.date)
.title("X Title")
.sort('descending'),
y: builder => builder
.value(fields => fields.float)
.title("Y Title")
.sort('ascending'),
color: builder => builder
.value(fields => fields.string)
.title("Color Title")
})
)
))
.toTemplate()


bar

bar(def):

VegaCartesianViewFinalizer

Define a

Bar chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType
Yextends IntegerType | FloatType | StringType | DateTimeType
Colorextends IntegerType | FloatType | StringType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omit<BarMark, "kind" | "orient">the definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width
def.x(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the x value
def.y(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the y value

Returns

VegaCartesianViewFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.bar({
x: builder => builder
.value(fields => fields.float)
.title("X Title")
.aggregate('sum')
.sort('descending'),
y: builder => builder
.value(fields => fields.string)
.title("Y Title")
.sort('ascending'),
})
)
))
.toTemplate()


boxPlot

boxPlot(def):

VegaCartesianViewFinalizer

Define a

Boxplot chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType | StringType | DateTimeType
Yextends IntegerType | FloatType
Colorextends IntegerType | FloatType | StringType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omit<{ extent?: number | "min-max" ; kind: "boxplot" } & { fill?: string ; fill_opacity?: number ; invalid?: null | "filter" ; opacity?: number ; stroke?: string ; stroke_dash?: [stroke: number, space: number] ; stroke_opacity?: number ; stroke_width?: number }, "kind">the definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width
def.x(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the x value
def.y(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the y value

Returns

VegaCartesianViewFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.boxPlot({
x: builder => builder
.value(fields => fields.string)
.title("X Title")
.sort('ascending'),
y: builder => builder
.value(fields => fields.float)
.title("Y Title")
.sort('descending'),
})
)
))
.toTemplate()


column

column(def):

VegaCartesianViewFinalizer

Define a

Column chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType | StringType | DateTimeType
Yextends IntegerType | FloatType
Colorextends IntegerType | FloatType | StringType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omit<BarMark, "kind" | "orient">the definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width
def.x(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the x value
def.y(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the y value

Returns

VegaCartesianViewFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.column({
x: builder => builder
.value(fields => fields.string)
.title("X Title")
.sort('ascending'),
y: builder => builder
.value(fields => fields.float)
.title("Y Title")
.aggregate('sum')
.sort('descending'),
})
)
))
.toTemplate()


errorBand

errorBand(def):

VegaCartesianViewFinalizer

Define a

Boxplot chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType | StringType | DateTimeType
Yextends IntegerType | FloatType
Colorextends IntegerType | FloatType | StringType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omit<{ extent?: "stdev" | "stderr" | "ci" | "iqr" ; kind: "errorband" } & { fill?: string ; fill_opacity?: number ; invalid?: null | "filter" ; opacity?: number ; stroke?: string ; stroke_dash?: [stroke: number, space: number] ; stroke_opacity?: number ; stroke_width?: number }, "kind">the definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width
def.x(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the x value
def.y(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the y value

Returns

VegaCartesianViewFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.errorBand({
x: builder => builder
.value(fields => fields.string)
.title("X Title")
.sort('ascending'),
y: builder => builder
.value(fields => fields.float)
.title("Y Title")
.sort('descending'),
})
)
))
.toTemplate()


errorBar

errorBar(def):

VegaCartesianViewFinalizer

Define a

Boxplot chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType | StringType | DateTimeType
Yextends IntegerType | FloatType
Colorextends IntegerType | FloatType | StringType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omit<{ extent?: "stdev" | "stderr" | "ci" | "iqr" ; kind: "errorbar" } & { fill?: string ; fill_opacity?: number ; invalid?: null | "filter" ; opacity?: number ; stroke?: string ; stroke_dash?: [stroke: number, space: number] ; stroke_opacity?: number ; stroke_width?: number ; thickness?: number }, "kind">the definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width
def.x(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the x value
def.y(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the y value

Returns

VegaCartesianViewFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.errorBar({
x: builder => builder
.value(fields => fields.string)
.title("X Title")
.sort('ascending'),
y: builder => builder
.value(fields => fields.float)
.title("Y Title")
.sort('descending'),
})
)
))
.toTemplate()


heatmap

heatmap(def):

VegaCartesianViewFinalizer

Define a

Heatmap chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType | StringType | DateTimeType
Yextends IntegerType | FloatType | StringType | DateTimeType
Colorextends IntegerType | FloatType | StringType | DateTimeType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omitthe definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width
def.x(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the x value
def.y(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the y value

Returns

VegaCartesianViewFinalizer

Remarks

See

Vega-Lite for more information about specifications.

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.heatmap({
x: builder => builder
.value(fields => fields.date)
.title("X Title")
.sort('descending'),
y: builder => builder
.value(fields => fields.string)
.title("Y Title")
.sort('ascending'),
color: builder => builder
.value(fields => fields.float)
.title("Color Title")
})
)
))
.toTemplate()


line

line(def):

VegaCartesianViewFinalizer

Define a

Line chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType | StringType | DateTimeType
Yextends IntegerType | FloatType
Colorextends StringType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omitthe definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width
def.x(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the x value
def.y(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the y value

Returns

VegaCartesianViewFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.line({
x: builder => builder
.value(fields => fields.date)
.title("X Title")
.sort('descending'),
y: builder => builder
.value(fields => fields.float)
.title("Y Title")
.sort('ascending'),
color: builder => builder
.value(fields => fields.string)
.title("Color Title")
})
)
))
.toTemplate()


pie

pie(def):

VegaRadialViewFinalizer

Define a

Pie chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType
Colorextends IntegerType | FloatType | StringType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.angle(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the angle value
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omit<ArcMark, "kind" | "orient">the definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width

Returns

VegaRadialViewFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.pie({
angle: builder => builder
.value(fields => fields.float)
.title("Angle Title")
.aggregate('sum')
.sort('descending'),
color: builder => builder
.value(fields => fields.string)
.title("Color Title")
.sort('ascending'),
})
)
))
.toTemplate()


range

range(def):

VegaCartesianViewFinalizer

Define a

Ranged Bar chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType
Yextends IntegerType | FloatType | StringType | DateTimeType
Colorextends IntegerType | FloatType | StringType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omit<BarMark, "kind" | "orient">the definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width
def.x(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the x value
def.x2(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the second x value https://vega.github.io/vega-lite/docs/encoding.html#position
def.y(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the y value

Returns

VegaCartesianViewFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.range({
x: builder => builder
.value(fields => fields.float)
.title("X Title")
.aggregate('max')
.sort('descending'),
x: builder => builder
.value(fields => Add(fields.float, 1))
.title("X Title")
.aggregate('max')
.sort('descending'),
y: builder => builder
.value(fields => fields.string)
.title("Y Title")
.sort('ascending'),
})
)
))
.toTemplate()

scatter

scatter(def):

VegaCartesianViewFinalizer

Define a

Scatter chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType | StringType | DateTimeType
Yextends IntegerType | FloatType | StringType | DateTimeType
Colorextends IntegerType | FloatType | StringType | DateTimeType
Shapeextends IntegerType | FloatType | StringType | DateTimeType
Sizeextends IntegerType | FloatType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omitthe definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.shape?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the size value https://vega.github.io/vega-lite/docs/encoding.html#mark-prop
def.size?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the size value https://vega.github.io/vega-lite/docs/encoding.html#mark-prop
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width
def.x(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the x value
def.y(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the y value

Returns

VegaCartesianViewFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.heatmap({
x: builder => builder
.value(fields => fields.date)
.title("X Title")
.sort('descending'),
y: builder => builder
.value(fields => fields.float)
.title("Y Title")
.sort('ascending'),
color: builder => builder
.value(fields => fields.string)
.title("Color Title")
})
)
))
.toTemplate()


spec

spec(def): T extends

DictType ? VegaSpecViewFinalizer<TypeToFields, T> : T extends ArrayType ? VegaSpecViewFinalizer<ArrayToFields, T> : never

Define a unit Vega-Lite specification for a

VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Fextends ArrayToFieldNames<ArrayType> | TypeToFieldNames<DictType>

Parameters

NameTypeDescription
def(fields: F) => Omita function returning the Vega-Lite specification from the Stream fields names.

Returns

T extends

DictType ? VegaSpecViewFinalizer<TypeToFields, T> : T extends ArrayType ? VegaSpecViewFinalizer<ArrayToFields, T> : never

Remarks

The data is automatically defined from the stream contents, so is to be excluded from the definition.

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);


// create a layered vega specification in a layout
const layout = new LayoutBuilder("My Other Layout")
.vega("My Chart", builder => builder
builder.fromStream(stream)
.unitSpec((fields) => ({
$schema: "https://vega.github.io/schema/vega-lite/v5.json",
title: "",
mark: "point",
encoding: {
x: { field: fields.date, type: 'temporal', title: `Date Range` },
y: { field: fields.integer, type: 'quantitative' },
color: {
field: fields.float,
type: 'quantitative',
},
tooltip: [
{ field: fields.date, aggregate: 'min', type: 'temporal' },
{ field: fields.integer, aggregate: 'max', type: 'quantitative' },
{ field: fields.float, type: 'quantitative' },
]
}
})))
.toTemplate()

strip

strip(def):

VegaCartesianViewFinalizer

Define a

Strip chart for a VegaBuilder within a LayoutBuilder.

Type parameters

NameType
Xextends IntegerType | FloatType
Yextends IntegerType | FloatType | StringType | DateTimeType
Colorextends IntegerType | FloatType | StringType
Opacityextends IntegerType | FloatType | StringType | DateTimeType
FillOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeOpacityextends IntegerType | FloatType | StringType | DateTimeType
StrokeWidthextends IntegerType | FloatType | StringType | DateTimeType
StrokeDashextends IntegerType | FloatType | StringType | DateTimeType
Detailextends IntegerType | FloatType | StringType | DateTimeType

Parameters

NameTypeDescription
defObjectthe Vega-Lite specification define from the Stream fields names.
def.color?(builder: VegaColorEncodingSpecifier) => VegaColorEncodingFinalizerthe definition and EastFunction for the color value
def.detail?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the detail
def.fill_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill opacity
def.mark?Omitthe definition of the chart mark
def.opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the fill and stroke opacity
def.stroke_dash?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke dash
def.stroke_opacity?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke opacity
def.stroke_width?(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the stroke width
def.x(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the x value
def.y(builder: VegaFieldEncodingBuilder) => VegaFieldEncodingFinalizerthe definition and EastFunction for the y value

Returns

VegaCartesianViewFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
})
)
);

// create a vega specification in a layout
const layout = new LayoutBuilder("My Layout")
.vega("My Vega-Lite Chart", builder => builder
.view(
builder => builder
.fromStream(stream)
.strip({
x: builder => builder
.value(fields => fields.float)
.title("X Title")
.aggregate('sum')
.sort('descending'),
y: builder => builder
.value(fields => fields.string)
.title("Y Title")
.sort('ascending'),
})
)
))
.toTemplate()