MCPcopy
hub / github.com/microsoft/SandDance / calendar

Function calendar

docs/app/js/sanddance-app.js:129231–129259  ·  view source on GitHub ↗
(ticks, tickInterval, year, month, week, day, hour, minute, second, format)

Source from the content-addressed store, hash-verified

129229 return t instanceof Date ? +t : +new Date(+t);
129230}
129231function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) {
129232 var scale = (0, _continuousJsDefault.default)(), invert = scale.invert, domain = scale.domain;
129233 var formatMillisecond = format(".%L"), formatSecond = format(":%S"), formatMinute = format("%I:%M"), formatHour = format("%I %p"), formatDay = format("%a %d"), formatWeek = format("%b %d"), formatMonth = format("%B"), formatYear = format("%Y");
129234 function tickFormat(date1) {
129235 return (second(date1) < date1 ? formatMillisecond : minute(date1) < date1 ? formatSecond : hour(date1) < date1 ? formatMinute : day(date1) < date1 ? formatHour : month(date1) < date1 ? week(date1) < date1 ? formatDay : formatWeek : year(date1) < date1 ? formatMonth : formatYear)(date1);
129236 }
129237 scale.invert = function(y) {
129238 return new Date(invert(y));
129239 };
129240 scale.domain = function(_) {
129241 return arguments.length ? domain(Array.from(_, number)) : domain().map(date);
129242 };
129243 scale.ticks = function(interval) {
129244 var d = domain();
129245 return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);
129246 };
129247 scale.tickFormat = function(count, specifier) {
129248 return specifier == null ? tickFormat : format(specifier);
129249 };
129250 scale.nice = function(interval) {
129251 var d = domain();
129252 if (!interval || typeof interval.range !== "function") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval);
129253 return interval ? domain((0, _niceJsDefault.default)(d, interval)) : scale;
129254 };
129255 scale.copy = function() {
129256 return (0, _continuousJs.copy)(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format));
129257 };
129258 return scale;
129259}
129260function time() {
129261 return (0, _initJs.initRange).apply(calendar((0, _d3Time.timeTicks), (0, _d3Time.timeTickInterval), (0, _d3Time.timeYear), (0, _d3Time.timeMonth), (0, _d3Time.timeWeek), (0, _d3Time.timeDay), (0, _d3Time.timeHour), (0, _d3Time.timeMinute), (0, _d3Time.timeSecond), (0, _d3TimeFormat.timeFormat)).domain([
129262 new Date(2000, 0, 1),

Callers 1

timeFunction · 0.70

Calls 5

formatFunction · 0.70
invertFunction · 0.70
domainFunction · 0.70
tickIntervalFunction · 0.70
fromMethod · 0.45

Tested by

no test coverage detected