Optimized Expressions#

VegaFusion supports optimizing a subset of Vega’s expression language. Below is a detailed breakdown of expression features that are eligible for optimization.

Note

When a Vega spec includes unsupported expressions, these expressions will be included in the client Vega spec for evaluation by the standard Vega library in the browser. See How it works for more details.

Key:

  • ✅: Full optimization support for the feature and all its options

  • 🟡: Partial optimization support with limitations

  • ❌: Feature is not currently eligible for optimization

Core Language Features#

Feature

Status

Details

a + b

a - b

a * b

a / b

a % b

-a

+a

a == b

a != b

a < b

a > b

a <= b

a >= b

a && b

a || b

!a

a ? b : c

{a: 1, b: 2}

[1, 2, 3]

a.b

a["b"]

Bound Variables#

Variable

Status

Details

datum

event

item

parent

Signal Names

Constants#

Constant

Status

Details

NaN

E

LN2

LN10

LOG2E

LOG10E

MAX_VALUE

MIN_VALUE

PI

SQRT1_2

SQRT2

Type Checking#

Function

Status

Details

isArray(value)

isBoolean(value)

isDate(value)

isDefined(value)

isNumber(value)

isObject(value)

isRegExp(value)

isString(value)

isValid(value)

Type Coercion#

Function

Status

Details

toBoolean(value)

toDate(value)

toNumber(value)

toString(value)

Control Flow#

Function

Status

Details

if(test, thenValue, elseValue)

Math Functions#

Function

Status

Details

isNaN(value)

isFinite(value)

abs(value)

acos(value)

asin(value)

atan(value)

atan2(dy, dx)

ceil(value)

clamp(value, min, max)

cos(value)

exp(exponent)

floor(value)

hypot(value)

log(value)

max(value1, value2, …)

min(value1, value2, …)

pow(value, exponent)

random()

round(value)

sin(value)

sqrt(value)

tan(value)

Statistical Functions#

Function

Status

Details

sampleNormal([mean, stdev])

cumulativeNormal(value[, mean, stdev])

densityNormal(value[, mean, stdev])

quantileNormal(probability[, mean, stdev])

sampleLogNormal([mean, stdev])

cumulativeLogNormal(value[, mean, stdev])

densityLogNormal(value[, mean, stdev])

quantileLogNormal(probability[, mean, stdev])

sampleUniform([min, max])

cumulativeUniform(value[, min, max])

densityUniform(value[, min, max])

quantileUniform(probability[, min, max])

Date-Time Functions#

Function

Status

Details

now()

datetime(year, month[, day, hour, min, sec, millisec])

date(datetime)

day(datetime)

dayofyear(datetime)

year(datetime)

quarter(datetime)

month(datetime)

week(datetime)

hours(datetime)

minutes(datetime)

seconds(datetime)

milliseconds(datetime)

time(datetime)

timezoneoffset(datetime)

timeOffset(unit, date[, step])

timeSequence(unit, start, stop[, step])

utc(year, month[, day, hour, min, sec, millisec])

utcdate(datetime)

utcday(datetime)

utcdayofyear(datetime)

utcyear(datetime)

utcquarter(datetime)

utcmonth(datetime)

utcweek(datetime)

utchours(datetime)

utcminutes(datetime)

utcseconds(datetime)

utcmilliseconds(datetime)

utcOffset(unit, date[, step])

utcSequence(unit, start, stop[, step])

Array Functions#

Function

Status

Details

extent(array)

clampRange(range, min, max)

indexof(array, value)

inrange(value, range)

join(array[, separator])

lastindexof(array, value)

length(array)

lerp(array, fraction)

peek(array)

pluck(array, field)

reverse(array)

sequence([start, ]stop[, step])

slice(array, start[, end])

sort(array)

span(array)

String Functions#

Function

Status

Details

indexof(string, substring)

lastindexof(string, substring)

length(string)

lower(string)

pad(string, length[, character, align])

parseFloat(string)

parseInt(string)

replace(string, pattern, replacement)

slice(string, start[, end])

split(string, separator[, limit])

substring(string, start[, end])

trim(string)

truncate(string, length[, align, ellipsis])

upper(string)

Object Functions#

Function

Status

Details

merge(object1[, object2, …])

Formatting Functions#

Function

Status

Details

dayFormat(day)

dayAbbrevFormat(day)

format(value, specifier)

monthFormat(month)

monthAbbrevFormat(month)

timeUnitSpecifier(units[, specifiers])

timeFormat(value, specifier)

timeParse(string, specifier)

utcFormat(value, specifier)

utcParse(value, specifier)

RegExp Functions#

Function

Status

Details

regexp(pattern[, flags])

test(regexp[, string])

Color Functions#

Function

Status

Details

rgb(r, g, b[, opacity])

hsl(h, s, l[, opacity])

lab(l, a, b[, opacity])

hcl(h, c, l[, opacity])

luminance(specifier)

contrast(specifier1, specifier2)

Event Functions#

Function

Status

Details

item()

group([name])

xy([item])

x([item])

y([item])

pinchDistance(event)

pinchAngle(event)

inScope(item)

Data Functions#

Function

Status

Details

data(name)

indata(name, field, value)

modify

More Info

This is a private function that Vega-Lite uses to implement selections.

Scale and Projection Functions#

Function

Status

Details

scale(name, value[, group])

invert(name, value[, group])

copy(name[, group])

domain(name[, group])

range(name[, group])

bandwidth(name[, group])

bandspace(count[, paddingInner, paddingOuter])

gradient(scale, p0, p1[, count])

panLinear(domain, delta)

panLog(domain, delta)

panPow(domain, delta, exponent)

panSymlog(domain, delta, constant)

zoomLinear(domain, anchor, scaleFactor)

zoomLog(domain, anchor, scaleFactor)

zoomPow(domain, anchor, scaleFactor, exponent)

zoomSymlog(domain, anchor, scaleFactor, constant)

Geographic Functions#

Function

Status

Details

geoArea(projection, feature[, group])

geoBounds(projection, feature[, group])

geoCentroid(projection, feature[, group])

geoScale(projection[, group])

Tree (Hierarchy) Functions#

Function

Status

Details

treePath(name, source, target)

treeAncestors(name, node)

Browser Functions#

Function

Status

Details

containerSize()

screen()

windowSize()

Logging Functions#

Function

Status

Details

warn(value1[, value2, …])

info(value1[, value2, …])

debug(value1[, value2, …])

Selection Functions#

These are private functions that Vega-Lite uses to implement selections.

Function

Status

Details

vlSelectionTest

vlSelectionResolve