Comparing version 1.0.0 to 1.0.1
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-axis/ Version 1.0.0. Copyright 2016 Mike Bostock. | ||
// https://d3js.org/d3-axis/ Version 1.0.1. Copyright 2016 Mike Bostock. | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-axis/ Version 1.0.0. Copyright 2016 Mike Bostock. | ||
// https://d3js.org/d3-axis/ Version 1.0.1. Copyright 2016 Mike Bostock. | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})}(this,function(t){"use strict";function n(t){return t}function e(t,n,e){var r=t(e);return"translate("+(isFinite(r)?r:n(e))+",0)"}function r(t,n,e){var r=t(e);return"translate(0,"+(isFinite(r)?r:n(e))+")"}function i(t){var n=t.bandwidth()/2;return function(e){return t(e)+n}}function a(){return!this.__axis}function o(t,o){function c(c){var f,_=null==l?o.ticks?o.ticks.apply(o,u):o.domain():l,v=null==s?o.tickFormat?o.tickFormat.apply(o,u):n:s,F=Math.max(g,0)+y,b=t===d||t===m?e:r,z=o.range(),A=z[0]+.5,M=z[z.length-1]+.5,V=(o.bandwidth?i:n)(o.copy()),H=c.selection?c.selection():c,S=H.selectAll(".domain").data([null]),j=H.selectAll(".tick").data(_,o).order(),w=j.exit(),N=j.enter().append("g").attr("class","tick"),O=j.select("line"),P=j.select("text"),B=t===d||t===h?-1:1,I=t===h||t===p?(f="x","y"):(f="y","x");S=S.merge(S.enter().insert("path",".tick").attr("class","domain").attr("stroke","#000")),j=j.merge(N),O=O.merge(N.append("line").attr("stroke","#000").attr(f+"2",B*g).attr(I+"1",.5).attr(I+"2",.5)),P=P.merge(N.append("text").attr("fill","#000").attr(f,B*F).attr(I,.5).attr("dy",t===d?"0em":t===m?".71em":".32em")),c!==H&&(S=S.transition(c),j=j.transition(c),O=O.transition(c),P=P.transition(c),w=w.transition(c).attr("opacity",x).attr("transform",function(t){return b(V,this.parentNode.__axis||V,t)}),N.attr("opacity",x).attr("transform",function(t){return b(this.parentNode.__axis||V,V,t)})),w.remove(),S.attr("d",t===h||t==p?"M"+B*k+","+A+"H0.5V"+M+"H"+B*k:"M"+A+","+B*k+"V0.5H"+M+"V"+B*k),j.attr("opacity",1).attr("transform",function(t){return b(V,V,t)}),O.attr(f+"2",B*g),P.attr(f,B*F).text(v),H.filter(a).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===p?"start":t===h?"end":"middle"),H.each(function(){this.__axis=V})}var u=[],l=null,s=null,g=6,k=6,y=3;return c.scale=function(t){return arguments.length?(o=t,c):o},c.ticks=function(){return u=f.call(arguments),c},c.tickArguments=function(t){return arguments.length?(u=null==t?[]:f.call(t),c):u.slice()},c.tickValues=function(t){return arguments.length?(l=null==t?null:f.call(t),c):l&&l.slice()},c.tickFormat=function(t){return arguments.length?(s=t,c):s},c.tickSize=function(t){return arguments.length?(g=k=+t,c):g},c.tickSizeInner=function(t){return arguments.length?(g=+t,c):g},c.tickSizeOuter=function(t){return arguments.length?(k=+t,c):k},c.tickPadding=function(t){return arguments.length?(y=+t,c):y},c}function c(t){return o(d,t)}function u(t){return o(p,t)}function l(t){return o(m,t)}function s(t){return o(h,t)}var f=Array.prototype.slice,d=1,p=2,m=3,h=4,x=1e-6;t.axisTop=c,t.axisRight=u,t.axisBottom=l,t.axisLeft=s,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-axis", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Displays automatic reference lines for scales.", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-axis.js -c -m -o build/d3-axis.min.js", | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-axis.js ../d3.github.com/d3-axis.v1.js && cp build/d3-axis.min.js ../d3.github.com/d3-axis.v1.min.js && cd ../d3.github.com && git add d3-axis.v1.js d3-axis.v1.min.js && git commit -m \"d3-axis ${VERSION}\" && git push && cd - && zip -j build/d3-axis.zip -- LICENSE README.md build/d3-axis.js build/d3-axis.min.js" | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-axis/build/d3-axis.js d3-axis.v1.js && cp ../d3-axis/build/d3-axis.min.js d3-axis.v1.min.js && git add d3-axis.v1.js d3-axis.v1.min.js && git commit -m \"d3-axis ${VERSION}\" && git push && cd - && zip -j build/d3-axis.zip -- LICENSE README.md build/d3-axis.js build/d3-axis.min.js" | ||
}, | ||
@@ -35,3 +35,3 @@ "devDependencies": { | ||
"package-preamble": "0.0", | ||
"rollup": "0.33", | ||
"rollup": "0.34", | ||
"tape": "4", | ||
@@ -38,0 +38,0 @@ "uglify-js": "2" |
@@ -7,3 +7,3 @@ # d3-axis | ||
If you use NPM, `npm install d3-axis`. Otherwise, download the [latest release](https://github.com/d3/d3-axis/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-axis.v1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). (To be useful, you’ll also want to use [d3-scale](https://github.com/d3/d3-scale) and [d3-selection](https://github.com/d3/d3-selection), but these are soft dependencies.) AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3_axis` global is exported: | ||
If you use NPM, `npm install d3-axis`. Otherwise, download the [latest release](https://github.com/d3/d3-axis/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-axis.v1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). (To be useful, you’ll also want to use [d3-scale](https://github.com/d3/d3-scale) and [d3-selection](https://github.com/d3/d3-selection), but these are soft dependencies.) AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: | ||
@@ -91,9 +91,25 @@ ```html | ||
If *scale* is specified, sets the scale and returns the axis. If *scale* is not specified, returns the current scale. | ||
If *scale* is specified, sets the [scale](https://github.com/d3/d3-scale) and returns the axis. If *scale* is not specified, returns the current scale. | ||
<a name="axis_ticks" href="#axis_ticks">#</a> <i>axis</i>.<b>ticks</b>(<i>arguments…</i>) | ||
<br><a href="#axis_ticks">#</a> <i>axis</i>.<b>ticks</b>([<i>count</i>[, <i>specifier</i>]]) | ||
<br><a href="#axis_ticks">#</a> <i>axis</i>.<b>ticks</b>([<i>interval</i>[, <i>specifier</i>]]) | ||
A convenience function for setting the [tick arguments](#axis_tickArguments). For example, this: | ||
Sets the *arguments* that will be passed to [*scale*.ticks](https://github.com/d3/d3-scale#continuous_ticks) and [*scale*.tickFormat](https://github.com/d3/d3-scale#continuous_tickFormat) when the axis is [rendered](#_axis), and returns the axis generator. The meaning of the *arguments* depends on the [axis’ scale](#axis_scale) type: most commonly, the arguments are a suggested *count* for the number of ticks (or a [time *interval*](https://github.com/d3/d3-time) for time scales), and an optional [format *specifier*](https://github.com/d3/d3-format) to customize how the tick values are formatted. | ||
For example, to generate twenty ticks with SI-prefix formatting on a linear scale, say: | ||
```js | ||
axis.ticks(20, "s"); | ||
``` | ||
To generate ticks every fifteen minutes with a time scale, say: | ||
```js | ||
axis.ticks(d3.timeMinute.every(15)); | ||
``` | ||
This method is an alternative to setting the tick values explicitly via [*axis*.tickValues](#axis_tickValues), and setting the tick format explicitly via [*axis*.tickFormat](#axis_tickFormat). This method is also a convenience function for [*axis*.tickArguments](#axis_tickArguments). For example, this: | ||
```js | ||
axis.ticks(10); | ||
@@ -110,6 +126,18 @@ ``` | ||
If *arguments* are specified, stores the specified arguments for subsequent use in generating ticks and returns the axis. The arguments will later be passed to [*scale*.ticks](https://github.com/d3/d3-scale#continuous_ticks) to generate tick values (unless tick values are specified explicitly via [*axis*.tickValues](#axis_tickValues)). These arguments are also passed to the scale’s [tickFormat method](https://github.com/d3/d3-scale#continuous_tickFormat) to generate a tick format (unless a tick format is specified explicitly via [*axis*.tickFormat](#axis_tickFormat)). If no arguments are specified, returns the current tick arguments, which defaults to the empty array. | ||
If *arguments* are specified, sets the *arguments* that will be passed to [*scale*.ticks](https://github.com/d3/d3-scale#continuous_ticks) and [*scale*.tickFormat](https://github.com/d3/d3-scale#continuous_tickFormat) when the axis is [rendered](#_axis), and returns the axis generator. The meaning of the *arguments* depends on the [axis’ scale](#axis_scale) type: most commonly, the arguments are a suggested *count* for the number of ticks (or a [time *interval*](https://github.com/d3/d3-time) for time scales), and an optional [format *specifier*](https://github.com/d3/d3-format) to customize how the tick values are formatted. This method is a convenient alternative to setting the tick values explicitly via [*axis*.tickValues](#axis_tickValues), and setting the tick format explicitly via [*axis*.tickFormat](#axis_tickFormat). If *arguments* is not specified, returns the current tick arguments, which defaults to the empty array. | ||
Suitable arguments depends on the associated scale: for a [quantitative scale](https://github.com/d3/d3-scale#continuous-scales), you might specify a suggested tick count such as `[20]` or a tick count and a tick format specifier such as `[10, "$,.2f"]`; for a [time scale](https://github.com/d3/d3-scale#time-scales), a [time interval](https://github.com/d3/d3-time#intervals) such as `[d3.timeMinute, 15]` might be appropriate. | ||
For example, to generate twenty ticks with SI-prefix formatting on a linear scale, say: | ||
```js | ||
axis.tickArguments([20, "s"]); | ||
``` | ||
To generate ticks every fifteen minutes with a time scale, say: | ||
```js | ||
axis.tickArguments([d3.timeMinute.every(15)]); | ||
``` | ||
This method is an alternative to setting the tick values explicitly via [*axis*.tickValues](#axis_tickValues), and setting the tick format explicitly via [*axis*.tickFormat](#axis_tickFormat). See also [*axis*.ticks](#axis_ticks). | ||
<a name="axis_tickValues" href="#axis_tickValues">#</a> <i>axis</i>.<b>tickValues</b>([<i>values</i>]) | ||
@@ -116,0 +144,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29620
184