MCPcopy Index your code
hub / github.com/microsoft/SandDance / buildLegendEncode

Function buildLegendEncode

docs/app/js/sanddance-app.js:148549–148571  ·  view source on GitHub ↗
(_, spec, config)

Source from the content-addressed store, hash-verified

148547 return LegendScales.reduce((count, type)=>count + (spec[type] ? 1 : 0), 0);
148548}
148549function buildLegendEncode(_, spec, config) {
148550 const encode = {
148551 enter: {},
148552 update: {}
148553 };
148554 addEncoders(encode, {
148555 orient: _("orient"),
148556 offset: _("offset"),
148557 padding: _("padding"),
148558 titlePadding: _("titlePadding"),
148559 cornerRadius: _("cornerRadius"),
148560 fill: _("fillColor"),
148561 stroke: _("strokeColor"),
148562 strokeWidth: config.strokeWidth,
148563 strokeDash: config.strokeDash,
148564 x: _("legendX"),
148565 y: _("legendY"),
148566 // accessibility support
148567 format: spec.format,
148568 formatType: spec.formatType
148569 });
148570 return encode;
148571}
148572function sizeExpression(spec, scope, marks) {
148573 const size = deref(getChannel("size", spec, marks)), strokeWidth = deref(getChannel("strokeWidth", spec, marks)), fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle));
148574 return (0, _vegaFunctions.parseExpression)(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, scope);

Callers 1

parseLegendFunction · 0.70

Calls 2

addEncodersFunction · 0.70
_Function · 0.70

Tested by

no test coverage detected