MCPcopy Create free account
hub / github.com/idank/explainshell / d3_scale_linearNice

Function d3_scale_linearNice

explainshell/web/static/js/d3.v3.js:6455–6465  ·  view source on GitHub ↗
(dx)

Source from the content-addressed store, hash-verified

6453 return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
6454 }
6455 function d3_scale_linearNice(dx) {
6456 dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
6457 return dx && {
6458 floor: function(x) {
6459 return Math.floor(x / dx) * dx;
6460 },
6461 ceil: function(x) {
6462 return Math.ceil(x / dx) * dx;
6463 }
6464 };
6465 }
6466 function d3_scale_linearTickRange(domain, m) {
6467 var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;
6468 if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected