question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vega-expressions undefined functions

See original GitHub issue

Some documented vega functions seem to not work inside of vega-expressions. Functions like toDate and timeParse are throwing: Error: Unrecognized function: timeParse.

I see that, unlike other functions, they are not tested here: https://github.com/vega/vega/blob/master/packages/vega-expression/test/codegen-test.js.

Functions that do not seem to be tested are:

  • Type Checking functions
  • Type Coercion functions
  • Formatting functions
  • Color functions
  • Scale functions

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
martinRenoucommented, Aug 26, 2019

Thanks a lot for your answers! 😃 I will look at vega-parser and vega-runtime more closely.

0reactions
jheercommented, Aug 26, 2019

That looks like it is close to what we do in Vega. However, instead of passing the external function implementations as a parameter, we bind it to the this context of each parsed expression. This happens in the vega-runtime package (which is invoked by the vega-view code I shared earlier). The vega-parser runs the expression parser to generate the JavaScript code; generated expression code is included within the fully parsed representation of an input Vega JSON specification, which the parser outputs. The vega-runtime library takes the code generated by the expression parser and uses the Function constructor to generate a callable function for each parsed expression.

Here’s the code we use for that: https://github.com/vega/vega/blob/master/packages/vega-runtime/src/expression.js

Note that different parsed expressions may take different input arguments based on the context in which they are used in Vega (e.g., within data transforms, signal updates, encodings, etc). Common arguments include a datum object and the values of signals that the expression depends on (denoted as the _ object). I do not know if these more detailed concerns affect you or not…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expressions | Vega
Returns true if value is not null , undefined , or NaN , false otherwise. Back to Top. Type Coercion Functions. Functions for...
Read more >
Undefined data set name: "source_1" in Vega-Lite interactive ...
It looks like there's some issue with specifying the same data URL in multiple places in the chart. If you move the data...
Read more >
Leaflet-vega / Andy Reagan | Observable
Rather than define vegaLayer and vega functions as methods on L object, ... bindingsContainer: undefined, ... expression parsing in Vega is global,.
Read more >
VegaLite - elm-vegalite 5.3.0 - Elm Packages
Create Vega-Lite visualization specifications in Elm. This package allows you to ... Provide an expression to a map projection property function requiring a ......
Read more >
Vega Reference - data Property - docs
The following properties are required: expr : An expression string to be evaluated. Expressions currently support these operators and functions. as : A...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found