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

Function axisTitle

docs/app/js/sanddance-app.js:149195–149251  ·  view source on GitHub ↗
(spec, config, userEncode, dataRef)

Source from the content-addressed store, hash-verified

149193 }, userEncode);
149194}
149195function axisTitle(spec, config, userEncode, dataRef) {
149196 const _ = lookup(spec, config), orient = spec.orient, sign = getSign(orient, -1, 1);
149197 let enter, update;
149198 const encode = {
149199 enter: enter = {
149200 opacity: zero,
149201 anchor: encoder(_("titleAnchor", null)),
149202 align: {
149203 signal: alignExpr$1
149204 }
149205 },
149206 update: update = (0, _vegaUtil.extend)({}, enter, {
149207 opacity: one,
149208 text: encoder(spec.title)
149209 }),
149210 exit: {
149211 opacity: zero
149212 }
149213 };
149214 const titlePos = {
149215 signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})`
149216 };
149217 update.x = ifX(orient, titlePos);
149218 update.y = ifY(orient, titlePos);
149219 enter.angle = ifX(orient, zero, mult(sign, 90));
149220 enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), {
149221 value: Bottom
149222 });
149223 update.angle = enter.angle;
149224 update.baseline = enter.baseline;
149225 addEncoders(encode, {
149226 fill: _("titleColor"),
149227 fillOpacity: _("titleOpacity"),
149228 font: _("titleFont"),
149229 fontSize: _("titleFontSize"),
149230 fontStyle: _("titleFontStyle"),
149231 fontWeight: _("titleFontWeight"),
149232 limit: _("titleLimit"),
149233 lineHeight: _("titleLineHeight")
149234 }, {
149235 // require update
149236 align: _("titleAlign"),
149237 angle: _("titleAngle"),
149238 baseline: _("titleBaseline")
149239 });
149240 autoLayout(_, orient, encode, userEncode);
149241 encode.update.align = patch(encode.update.align, enter.align);
149242 encode.update.angle = patch(encode.update.angle, enter.angle);
149243 encode.update.baseline = patch(encode.update.baseline, enter.baseline);
149244 return guideMark({
149245 type: TextMark,
149246 role: AxisTitleRole,
149247 style: GuideTitleStyle,
149248 from: dataRef,
149249 encode
149250 }, userEncode);
149251}
149252function autoLayout(_, orient, encode, userEncode) {

Callers 1

parseAxisFunction · 0.70

Calls 13

lookupFunction · 0.70
getSignFunction · 0.70
encoderFunction · 0.70
_Function · 0.70
anchorExprFunction · 0.70
ifXFunction · 0.70
ifYFunction · 0.70
multFunction · 0.70
ifTopFunction · 0.70
addEncodersFunction · 0.70
autoLayoutFunction · 0.70
patchFunction · 0.70

Tested by

no test coverage detected