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

Function domainCaption

docs/app/js/sanddance-app.js:127279–127292  ·  view source on GitHub ↗
(locale, scale19, opt)

Source from the content-addressed store, hash-verified

127277 return !specifier && type === Time ? locale.timeFormat("%A, %d %B %Y, %X") : !specifier && type === UTC ? locale.utcFormat("%A, %d %B %Y, %X UTC") : labelFormat(locale, scale18, 5, null, specifier, formatType, true);
127278}
127279function domainCaption(locale, scale19, opt) {
127280 opt = opt || {};
127281 const max = Math.max(3, opt.maxlen || 7), fmt = format(locale, scale19, opt.format, opt.formatType); // if scale breaks domain into bins, describe boundaries
127282 if (isDiscretizing(scale19.type)) {
127283 const v = labelValues(scale19).slice(1).map(fmt), n = v.length;
127284 return "".concat(n, " boundar").concat(n === 1 ? "y" : "ies", ": ").concat(v.join(", "));
127285 } else if (isDiscrete(scale19.type)) {
127286 const d = scale19.domain(), n = d.length, v = n > max ? d.slice(0, max - 2).map(fmt).join(", ") + ", ending with " + d.slice(-1).map(fmt) : d.map(fmt).join(", ");
127287 return "".concat(n, " value").concat(n === 1 ? "" : "s", ": ").concat(v);
127288 } else {
127289 const d = scale19.domain();
127290 return "values from ".concat(fmt(d[0]), " to ").concat(fmt((0, _vegaUtil.peek)(d)));
127291 }
127292}
127293
127294},{"vega-util":"dPFAY","d3-array":"8JMcC","d3-scale":"03x1i","d3-interpolate":"dQqYJ","vega-time":"hDlOp","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"03x1i":[function(require,module,exports) {
127295var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers

nothing calls this directly

Calls 5

formatFunction · 0.70
isDiscretizingFunction · 0.70
labelValuesFunction · 0.70
isDiscreteFunction · 0.70
maxMethod · 0.45

Tested by

no test coverage detected