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.

Expose access to `vega.expressionFunction`

See original GitHub issue

In https://github.com/vega/vega-embed/blob/next/src/embed.ts#L348, we already expose formatLocale and timeFormatLocale as opts for Vega embed.

To let people specify custom expression function, I think we should expose expressionFunction in our opts as well.

Since vega.expressionFunction(name[, fn, visitor]) has a slightly more complicated signature than formatLocale(definition) , timeFormatLocale(definition), we need to define opt.expressionFunction’s structure.

I think {<name>: <fn>, <name2>: <fn2>} as the short form and {<name>: {fn: <fn>, visitor: <visitor>}, ...} as the full form probably makes sense.

Basically, we’ll add

expressionFunction: ExpressionFunction

to EmbedOptions’s interface where the type is

type ExpressionFunction = Record<string, Function | {fn: Function, visitor: Function}>;

@domoritz @jheer – any opinion?

cc: @zacharybys

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
kanitwcommented, Jun 7, 2022

For the prop name, should we do expressionFunction: {...} or expressionFunctions: {...} or sth else ?

Basically the function is vega.expressionFunction, but the object passed in technically can represent multiple expressionFunction.

There is also expr: for “Custom Vega Expression interpreter” (which is basically the same as expr: in vega.View).

I think I prefer expressionFunction: so that the name exactly matches the function so it’s easier to know that it’s a wrapper for the same thing.

1reaction
domoritzcommented, Jun 7, 2022

Okay. I’m convinced to have the shorthand. The design makes sense to me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

APIs to interact with Selection · Issue #1830 · vega/vega-lite
I lean towards exposing selections as signals for both being the simplest, ... If we point users to Vega view APIs to access...
Read more >
Extensibility API - Vega & Vega-Lite
Registry function for adding and accessing cartographic projections. The type argument is a String indicating the name of the projection type.
Read more >
vega lite - How to access the underlying data from a viz
I stumbled across the loader and inferTypes functions exposed in the vega library, which allows me to inspect the data a bit, but...
Read more >
Vega | Kibana Guide [master] - Elastic
Learn how to connect Vega-Lite with Kibana filters and Elasticsearch data, ... You can access the clicked datum in the expression used to...
Read more >
Top 5 vega-expression Code Examples - Snyk
Learn more about how to use vega-expression, based on vega-expression code ... register Vega-Lite selection functions expressionFunction('vlSelectionTest', ...
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