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

Function parseAxis

docs/app/js/sanddance-app.js:149257–149307  ·  view source on GitHub ↗
(spec, scope)

Source from the content-addressed store, hash-verified

149255 encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY));
149256}
149257function parseAxis(spec, scope) {
149258 const config = axisConfig(spec, scope), encode = spec.encode || {}, axisEncode = encode.axis || {}, name = axisEncode.name || undefined, interactive4 = axisEncode.interactive, style = axisEncode.style, _ = lookup(spec, config), band = tickBand(_); // single-element data source for axis group
149259 const datum = {
149260 scale: spec.scale,
149261 ticks: !!_("ticks"),
149262 labels: !!_("labels"),
149263 grid: !!_("grid"),
149264 domain: !!_("domain"),
149265 title: spec.title != null
149266 };
149267 const dataRef = ref(scope.add(Collect({}, [
149268 datum
149269 ]))); // data source for axis ticks
149270 const ticksRef = ref(scope.add(AxisTicks({
149271 scale: scope.scaleRef(spec.scale),
149272 extra: scope.property(band.extra),
149273 count: scope.objectProperty(spec.tickCount),
149274 values: scope.objectProperty(spec.values),
149275 minstep: scope.property(spec.tickMinStep),
149276 formatType: scope.property(spec.formatType),
149277 formatSpecifier: scope.property(spec.format)
149278 }))); // generate axis marks
149279 const children = [];
149280 let size; // include axis gridlines if requested
149281 if (datum.grid) children.push(axisGrid(spec, config, encode.grid, ticksRef, band));
149282 // include axis ticks if requested
149283 if (datum.ticks) {
149284 size = _("tickSize");
149285 children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band));
149286 } // include axis labels if requested
149287 if (datum.labels) {
149288 size = datum.ticks ? size : 0;
149289 children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band));
149290 } // include axis domain path if requested
149291 if (datum.domain) children.push(axisDomain(spec, config, encode.domain, dataRef));
149292 // include axis title if defined
149293 if (datum.title) children.push(axisTitle(spec, config, encode.title, dataRef));
149294 // parse axis specification
149295 return parseMark(guideGroup({
149296 role: AxisRole,
149297 from: dataRef,
149298 encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip),
149299 marks: children,
149300 aria: _("aria"),
149301 description: _("description"),
149302 zindex: _("zindex"),
149303 name,
149304 interactive: interactive4,
149305 style
149306 }), scope);
149307}
149308function buildAxisEncode(_, spec) {
149309 const encode = {
149310 enter: {},

Callers 1

parseScopeFunction · 0.70

Calls 15

axisConfigFunction · 0.70
lookupFunction · 0.70
tickBandFunction · 0.70
_Function · 0.70
refFunction · 0.70
CollectFunction · 0.70
AxisTicksFunction · 0.70
axisGridFunction · 0.70
axisTicksFunction · 0.70
axisLabelsFunction · 0.70
axisDomainFunction · 0.70
axisTitleFunction · 0.70

Tested by

no test coverage detected