# Optimized Expressions VegaFusion supports optimizing a subset of [Vega's expression language](https://vega.github.io/vega/docs/expressions/). 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](../about/how_it_works.md) 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 :::{list-table} :header-rows: 1 :widths: 30 10 100 * - 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 :::{list-table} :header-rows: 1 :widths: 30 10 100 * - Variable - Status - Details * - `datum` - ✅ - * - `event` - ❌ - * - `item` - ❌ - * - `parent` - ❌ - * - Signal Names - ✅ - ::: ## Constants :::{list-table} :header-rows: 1 :widths: 20 10 100 * - Constant - Status - Details * - `NaN` - ✅ - * - `E` - ✅ - * - `LN2` - ✅ - * - `LN10` - ✅ - * - `LOG2E` - ✅ - * - `LOG10E` - ✅ - * - `MAX_VALUE` - ✅ - * - `MIN_VALUE` - ✅ - * - `PI` - ✅ - * - `SQRT1_2` - ✅ - * - `SQRT2` - ✅ - ::: ## Type Checking :::{list-table} :header-rows: 1 :widths: 40 10 100 * - Function - Status - Details * - `isArray(value)` - ❌ - * - `isBoolean(value)` - ❌ - * - `isDate(value)` - ✅ - * - `isDefined(value)` - ❌ - * - `isNumber(value)` - ❌ - * - `isObject(value)` - ❌ - * - `isRegExp(value)` - ❌ - * - `isString(value)` - ❌ - * - `isValid(value)` - ✅ - ::: ## Type Coercion :::{list-table} :header-rows: 1 :widths: 40 10 100 * - Function - Status - Details * - `toBoolean(value)` - ✅ - * - `toDate(value)` - ✅ - * - `toNumber(value)` - ✅ - * - `toString(value)` - ✅ - ::: ## Control Flow :::{list-table} :header-rows: 1 :widths: 80 10 100 * - Function - Status - Details * - `if(test, thenValue, elseValue)` - ✅ - ::: ## Math Functions :::{list-table} :header-rows: 1 :widths: 50 10 100 * - 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 :::{list-table} :header-rows: 1 :widths: 80 10 40 * - 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 :::{list-table} :header-rows: 1 :widths: 120 10 40 * - 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 :::{list-table} :header-rows: 1 :widths: 80 10 100 * - 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 :::{list-table} :header-rows: 1 :widths: 70 10 40 * - 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 :::{list-table} :header-rows: 1 :widths: 100 10 60 * - Function - Status - Details * - `merge(object1[, object2, …])` - ❌ - ::: ## Formatting Functions :::{list-table} :header-rows: 1 :widths: 80 10 60 * - 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 :::{list-table} :header-rows: 1 :widths: 80 10 60 * - Function - Status - Details * - `regexp(pattern[, flags])` - ❌ - * - `test(regexp[, string])` - ❌ - ::: ## Color Functions :::{list-table} :header-rows: 1 :widths: 60 10 60 * - 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 :::{list-table} :header-rows: 1 :widths: 50 10 100 * - Function - Status - Details * - `item()` - ❌ - * - `group([name])` - ❌ - * - `xy([item])` - ❌ - * - `x([item])` - ❌ - * - `y([item])` - ❌ - * - `pinchDistance(event)` - ❌ - * - `pinchAngle(event)` - ❌ - * - `inScope(item)` - ❌ - ::: ## Data Functions :::{list-table} :header-rows: 1 :widths: 60 10 60 * - Function - Status - Details * - `data(name)` - ✅ - * - `indata(name, field, value)` - ❌ - * - `modify` - ✅ - :::{dropdown} More Info This is a private function that Vega-Lite uses to implement selections. ::: ::: ## Scale and Projection Functions :::{list-table} :header-rows: 1 :widths: 80 10 40 * - 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 :::{list-table} :header-rows: 1 :widths: 60 10 40 * - Function - Status - Details * - `geoArea(projection, feature[, group])` - ❌ - * - `geoBounds(projection, feature[, group])` - ❌ - * - `geoCentroid(projection, feature[, group])` - ❌ - * - `geoScale(projection[, group])` - ❌ - ::: ## Tree (Hierarchy) Functions :::{list-table} :header-rows: 1 :widths: 60 10 60 * - Function - Status - Details * - `treePath(name, source, target)` - ❌ - * - `treeAncestors(name, node)` - ❌ - ::: ## Browser Functions :::{list-table} :header-rows: 1 :widths: 40 10 100 * - Function - Status - Details * - `containerSize()` - ❌ - * - `screen()` - ❌ - * - `windowSize()` - ❌ - ::: ## Logging Functions :::{list-table} :header-rows: 1 :widths: 50 10 70 * - 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. :::{list-table} :header-rows: 1 :widths: 50 10 100 * - Function - Status - Details * - `vlSelectionTest` - ✅ - * - `vlSelectionResolve` - ✅ - :::