Expose access to `vega.expressionFunction`
See original GitHub issueIn 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:
- Created a year ago
- Comments:6 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For the prop name, should we do
expressionFunction: {...}
orexpressionFunctions: {...}
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 asexpr:
invega.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.Okay. I’m convinced to have the shorthand. The design makes sense to me.