(codegen, fnctx, visitors)
| 142851 | return (0, _vegaUtil.isFunction)(name) ? name : (0, _vegaUtil.isString)(name) ? (s = ctx.scales[name]) && s.value : undefined; |
| 142852 | } |
| 142853 | function internalScaleFunctions(codegen, fnctx, visitors) { |
| 142854 | // add helper method to the 'this' expression function context |
| 142855 | fnctx.__bandwidth = (s)=>s && s.bandwidth ? s.bandwidth() : 0; // register AST visitors for internal scale functions |
| 142856 | visitors._bandwidth = scaleVisitor; |
| 142857 | visitors._range = scaleVisitor; |
| 142858 | visitors._scale = scaleVisitor; // resolve scale reference directly to the signal hash argument |
| 142859 | const ref = (arg)=>"_[" + (arg.type === (0, _vegaExpression.Literal) ? (0, _vegaUtil.stringValue)(ScalePrefix + arg.value) : (0, _vegaUtil.stringValue)(ScalePrefix) + "+" + codegen(arg)) + "]"; // define and return internal scale function code generators |
| 142860 | // these internal functions are called by mark encoders |
| 142861 | return { |
| 142862 | _bandwidth: (args)=>`this.__bandwidth(${ref(args[0])})`, |
| 142863 | _range: (args)=>`${ref(args[0])}.range()`, |
| 142864 | _scale: (args)=>`${ref(args[0])}(${codegen(args[1])})` |
| 142865 | }; |
| 142866 | } |
| 142867 | function geoMethod(methodName, globalMethod) { |
| 142868 | return function(projection, geojson, group) { |
| 142869 | if (projection) { |
no test coverage detected