vega-functions
Version:
Custom functions for the Vega expression language.
19 lines (16 loc) • 475 B
JavaScript
import {getScale} from '../scales.js';
import {pathParse, pathRender} from 'vega-scenegraph';
export function geoShape(projection, geojson, group) {
const p = getScale(projection, (group || this).context);
return function(context) {
return p ? p.path.context(context)(geojson) : '';
};
}
export function pathShape(path) {
let p = null;
return function(context) {
return context
? pathRender(context, (p = p || pathParse(path)))
: path;
};
}