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

Function axisGrid

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

Source from the content-addressed store, hash-verified

148971 };
148972}
148973function axisGrid(spec, config, userEncode, dataRef, band) {
148974 const _ = lookup(spec, config), orient = spec.orient, vscale = spec.gridScale, sign = getSign(orient, 1, -1), offset = offsetValue(spec.offset, sign);
148975 let enter, exit, update;
148976 const encode = {
148977 enter: enter = {
148978 opacity: zero
148979 },
148980 update: update = {
148981 opacity: one
148982 },
148983 exit: exit = {
148984 opacity: zero
148985 }
148986 };
148987 addEncoders(encode, {
148988 stroke: _("gridColor"),
148989 strokeCap: _("gridCap"),
148990 strokeDash: _("gridDash"),
148991 strokeDashOffset: _("gridDashOffset"),
148992 strokeOpacity: _("gridOpacity"),
148993 strokeWidth: _("gridWidth")
148994 });
148995 const tickPos = {
148996 scale: spec.scale,
148997 field: Value,
148998 band: band.band,
148999 extra: band.extra,
149000 offset: band.offset,
149001 round: _("tickRound")
149002 };
149003 const sz = ifX(orient, {
149004 signal: "height"
149005 }, {
149006 signal: "width"
149007 });
149008 const gridStart = vscale ? {
149009 scale: vscale,
149010 range: 0,
149011 mult: sign,
149012 offset: offset
149013 } : {
149014 value: 0,
149015 offset: offset
149016 };
149017 const gridEnd = vscale ? {
149018 scale: vscale,
149019 range: 1,
149020 mult: sign,
149021 offset: offset
149022 } : (0, _vegaUtil.extend)(sz, {
149023 mult: sign,
149024 offset: offset
149025 });
149026 enter.x = update.x = ifX(orient, tickPos, gridStart);
149027 enter.y = update.y = ifY(orient, tickPos, gridStart);
149028 enter.x2 = update.x2 = ifY(orient, gridEnd);
149029 enter.y2 = update.y2 = ifX(orient, gridEnd);
149030 exit.x = ifX(orient, tickPos);

Callers 1

parseAxisFunction · 0.70

Calls 8

lookupFunction · 0.70
getSignFunction · 0.70
offsetValueFunction · 0.70
addEncodersFunction · 0.70
_Function · 0.70
ifXFunction · 0.70
ifYFunction · 0.70
guideMarkFunction · 0.70

Tested by

no test coverage detected