Comparing version 0.3.2 to 0.4.0
@@ -0,9 +1,8 @@ | ||
// https://d3js.org/d3-axis/ Version 0.4.0. Copyright 2016 Mike Bostock. | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.d3_axis = global.d3_axis || {}))); | ||
(factory((global.d3 = global.d3 || {}))); | ||
}(this, function (exports) { 'use strict'; | ||
var version = "0.3.2"; | ||
var slice = Array.prototype.slice; | ||
@@ -37,2 +36,6 @@ | ||
function entering() { | ||
return !this.__axis; | ||
} | ||
function axis(orient, scale) { | ||
@@ -73,7 +76,11 @@ var tickArguments = [], | ||
.attr("stroke", "#000") | ||
.attr(x + "2", k * tickSizeInner)); | ||
.attr(x + "2", k * tickSizeInner) | ||
.attr(y + "1", 0.5) | ||
.attr(y + "2", 0.5)); | ||
text = text.merge(tickEnter.append("text") | ||
.attr("fill", "#000") | ||
.attr(x, k * spacing)); | ||
.attr(x, k * spacing) | ||
.attr(y, 0.5) | ||
.attr("dy", orient === top ? "0em" : orient === bottom ? ".71em" : ".32em")); | ||
@@ -100,3 +107,3 @@ if (context !== selection) { | ||
? "M" + k * tickSizeOuter + "," + range0 + "H0.5V" + range1 + "H" + k * tickSizeOuter | ||
: "M" + range0 + "," + k * tickSizeOuter + "V0.5H" + range1 + "V" + k * tickSizeOuter) | ||
: "M" + range0 + "," + k * tickSizeOuter + "V0.5H" + range1 + "V" + k * tickSizeOuter); | ||
@@ -108,17 +115,15 @@ tick | ||
line | ||
.attr(x + "2", k * tickSizeInner) | ||
.attr(y + "1", 0.5) | ||
.attr(y + "2", 0.5); | ||
.attr(x + "2", k * tickSizeInner); | ||
text | ||
.attr(x, k * spacing) | ||
.attr(y, 0.5) | ||
.attr("dy", orient === top ? "0em" : orient === bottom ? ".71em" : ".32em") | ||
.text(format); | ||
selection | ||
selection.filter(entering) | ||
.attr("fill", "none") | ||
.attr("font-size", 10) | ||
.attr("font-family", "sans-serif") | ||
.attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle") | ||
.attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle"); | ||
selection | ||
.each(function() { this.__axis = position; }); | ||
@@ -182,3 +187,2 @@ } | ||
exports.version = version; | ||
exports.axisTop = axisTop; | ||
@@ -189,2 +193,4 @@ exports.axisRight = axisRight; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); |
@@ -1,1 +0,2 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3_axis=t.d3_axis||{})}(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(t,a){function o(o){var f,y=null==u?a.ticks?a.ticks.apply(a,c):a.domain():u,v=null==l?a.tickFormat?a.tickFormat.apply(a,c):n:l,_=Math.max(s,0)+k,F=t===d||t===m?e:r,z=a.range(),A=z[0]+.5,V=z[z.length-1]+.5,b=(a.bandwidth?i:n)(a.copy()),H=o.selection?o.selection():o,M=H.selectAll(".domain").data([null]),S=H.selectAll(".tick").data(y,a).order(),w=S.exit(),N=S.enter().append("g",".domain").attr("class","tick"),j=S.select("line"),B=S.select("text"),I=t===d||t===h?-1:1,L=t===h||t===p?(f="x","y"):(f="y","x");M=M.merge(M.enter().append("path").attr("class","domain").attr("stroke","#000")),S=S.merge(N),j=j.merge(N.append("line").attr("stroke","#000").attr(f+"2",I*s)),B=B.merge(N.append("text").attr("fill","#000").attr(f,I*_)),o!==H&&(M=M.transition(o),S=S.transition(o),j=j.transition(o),B=B.transition(o),w=w.transition(o).attr("opacity",x).attr("transform",function(t){return F(b,this.parentNode.__axis||b,t)}),N.attr("opacity",x).attr("transform",function(t){return F(this.parentNode.__axis||b,b,t)})),w.remove(),M.attr("d",t===h||t==p?"M"+I*g+","+A+"H0.5V"+V+"H"+I*g:"M"+A+","+I*g+"V0.5H"+V+"V"+I*g),S.attr("opacity",1).attr("transform",function(t){return F(b,b,t)}),j.attr(f+"2",I*s).attr(L+"1",.5).attr(L+"2",.5),B.attr(f,I*_).attr(L,.5).attr("dy",t===d?"0em":t===m?".71em":".32em").text(v),H.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===p?"start":t===h?"end":"middle").each(function(){this.__axis=b})}var c=[],u=null,l=null,s=6,g=6,k=3;return o.scale=function(t){return arguments.length?(a=t,o):a},o.ticks=function(){return c=f.call(arguments),o},o.tickArguments=function(t){return arguments.length?(c=null==t?[]:f.call(t),o):c.slice()},o.tickValues=function(t){return arguments.length?(u=null==t?null:f.call(t),o):u&&u.slice()},o.tickFormat=function(t){return arguments.length?(l=t,o):l},o.tickSize=function(t){return arguments.length?(s=g=+t,o):s},o.tickSizeInner=function(t){return arguments.length?(s=+t,o):s},o.tickSizeOuter=function(t){return arguments.length?(g=+t,o):g},o.tickPadding=function(t){return arguments.length?(k=+t,o):k},o}function o(t){return a(d,t)}function c(t){return a(p,t)}function u(t){return a(m,t)}function l(t){return a(h,t)}var s="0.3.2",f=Array.prototype.slice,d=1,p=2,m=3,h=4,x=1e-6;t.version=s,t.axisTop=o,t.axisRight=c,t.axisBottom=u,t.axisLeft=l}); | ||
// https://d3js.org/d3-axis/ Version 0.4.0. 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 u(u){var f,_=null==l?o.ticks?o.ticks.apply(o,c):o.domain():l,v=null==s?o.tickFormat?o.tickFormat.apply(o,c):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=u.selection?u.selection():u,S=H.selectAll(".domain").data([null]),j=H.selectAll(".tick").data(_,o).order(),w=j.exit(),N=j.enter().append("g",".domain").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().append("path").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")),u!==H&&(S=S.transition(u),j=j.transition(u),O=O.transition(u),P=P.transition(u),w=w.transition(u).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 c=[],l=null,s=null,g=6,k=6,y=3;return u.scale=function(t){return arguments.length?(o=t,u):o},u.ticks=function(){return c=f.call(arguments),u},u.tickArguments=function(t){return arguments.length?(c=null==t?[]:f.call(t),u):c.slice()},u.tickValues=function(t){return arguments.length?(l=null==t?null:f.call(t),u):l&&l.slice()},u.tickFormat=function(t){return arguments.length?(s=t,u):s},u.tickSize=function(t){return arguments.length?(g=k=+t,u):g},u.tickSizeInner=function(t){return arguments.length?(g=+t,u):g},u.tickSizeOuter=function(t){return arguments.length?(k=+t,u):k},u.tickPadding=function(t){return arguments.length?(y=+t,u):y},u}function u(t){return o(d,t)}function c(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=u,t.axisRight=c,t.axisBottom=l,t.axisLeft=s,Object.defineProperty(t,"__esModule",{value:!0})}); |
export { | ||
version | ||
} from "./build/package"; | ||
export { | ||
axisTop, | ||
@@ -7,0 +3,0 @@ axisRight, |
{ | ||
"name": "d3-axis", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "Displays automatic reference lines for scales.", | ||
@@ -11,3 +11,3 @@ "keywords": [ | ||
], | ||
"homepage": "https://github.com/d3/d3-axis", | ||
"homepage": "https://d3js.org/d3-axis/", | ||
"license": "BSD-3-Clause", | ||
@@ -25,16 +25,12 @@ "author": { | ||
"scripts": { | ||
"pretest": "rm -rf build && mkdir build && json2module package.json > build/package.js && rollup -f umd -g d3-scale:d3_scale,d3-selection:d3_selection -n d3_axis -o build/d3-axis.js -- index.js", | ||
"pretest": "rm -rf build && mkdir build && rollup --banner \"$(preamble)\" -f umd -n d3 -o build/d3-axis.js -- index.js", | ||
"test": "tape 'test/**/*-test.js' && eslint index.js src", | ||
"prepublish": "npm run test && uglifyjs 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.v0.3.js && cp build/d3-axis.min.js ../d3.github.com/d3-axis.v0.3.min.js && cd ../d3.github.com && git add d3-axis.v0.3.js d3-axis.v0.3.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" | ||
"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.v0.4.js && cp build/d3-axis.min.js ../d3.github.com/d3-axis.v0.4.min.js && cd ../d3.github.com && git add d3-axis.v0.4.js d3-axis.v0.4.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" | ||
}, | ||
"dependencies": { | ||
"d3-scale": "~0.7.0", | ||
"d3-selection": "~0.7.0", | ||
"d3-transition": "~0.2.0" | ||
}, | ||
"devDependencies": { | ||
"d3-scale": "~0.9.0", | ||
"eslint": "2", | ||
"json2module": "0.0", | ||
"rollup": "0.26", | ||
"package-preamble": "0.0", | ||
"rollup": "0.27", | ||
"tape": "4", | ||
@@ -41,0 +37,0 @@ "uglify-js": "2" |
@@ -7,22 +7,9 @@ # 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.v0.3.min.js) or as part of [D3 4.0](https://github.com/d3/d3). (Some dependencies are optional.) 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.v0.4.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: | ||
```html | ||
<script src="https://d3js.org/d3-array.v0.7.min.js"></script> | ||
<script src="https://d3js.org/d3-collection.v0.1.min.js"></script> | ||
<script src="https://d3js.org/d3-color.v0.4.min.js"></script> | ||
<script src="https://d3js.org/d3-format.v0.5.min.js"></script> | ||
<script src="https://d3js.org/d3-interpolate.v0.5.min.js"></script> | ||
<script src="https://d3js.org/d3-time.v0.2.min.js"></script> | ||
<script src="https://d3js.org/d3-time-format.v0.3.min.js"></script> | ||
<script src="https://d3js.org/d3-scale.v0.7.min.js"></script> | ||
<script src="https://d3js.org/d3-selection.v0.7.min.js"></script> | ||
<script src="https://d3js.org/d3-dispatch.v0.4.min.js"></script> | ||
<script src="https://d3js.org/d3-ease.v0.7.min.js"></script> | ||
<script src="https://d3js.org/d3-timer.v0.4.min.js"></script> | ||
<script src="https://d3js.org/d3-transition.v0.2.min.js"></script> | ||
<script src="https://d3js.org/d3-axis.v0.3.min.js"></script> | ||
<script src="https://d3js.org/d3-axis.v0.4.min.js"></script> | ||
<script> | ||
var axis = d3_axis.axisLeft(scale); | ||
var axis = d3.axisLeft(scale); | ||
@@ -48,2 +35,4 @@ </script> | ||
Once created, the orientation of an axis is fixed. To change the orientation, remove the old axis and create a new axis. | ||
<a name="axisTop" href="#axisTop">#</a> d3.<b>axisTop</b>(<i>scale</i>) | ||
@@ -50,0 +39,0 @@ |
@@ -27,2 +27,6 @@ import {slice} from "./array"; | ||
function entering() { | ||
return !this.__axis; | ||
} | ||
function axis(orient, scale) { | ||
@@ -63,7 +67,11 @@ var tickArguments = [], | ||
.attr("stroke", "#000") | ||
.attr(x + "2", k * tickSizeInner)); | ||
.attr(x + "2", k * tickSizeInner) | ||
.attr(y + "1", 0.5) | ||
.attr(y + "2", 0.5)); | ||
text = text.merge(tickEnter.append("text") | ||
.attr("fill", "#000") | ||
.attr(x, k * spacing)); | ||
.attr(x, k * spacing) | ||
.attr(y, 0.5) | ||
.attr("dy", orient === top ? "0em" : orient === bottom ? ".71em" : ".32em")); | ||
@@ -90,3 +98,3 @@ if (context !== selection) { | ||
? "M" + k * tickSizeOuter + "," + range0 + "H0.5V" + range1 + "H" + k * tickSizeOuter | ||
: "M" + range0 + "," + k * tickSizeOuter + "V0.5H" + range1 + "V" + k * tickSizeOuter) | ||
: "M" + range0 + "," + k * tickSizeOuter + "V0.5H" + range1 + "V" + k * tickSizeOuter); | ||
@@ -98,17 +106,15 @@ tick | ||
line | ||
.attr(x + "2", k * tickSizeInner) | ||
.attr(y + "1", 0.5) | ||
.attr(y + "2", 0.5); | ||
.attr(x + "2", k * tickSizeInner); | ||
text | ||
.attr(x, k * spacing) | ||
.attr(y, 0.5) | ||
.attr("dy", orient === top ? "0em" : orient === bottom ? ".71em" : ".32em") | ||
.text(format); | ||
selection | ||
selection.filter(entering) | ||
.attr("fill", "none") | ||
.attr("font-size", 10) | ||
.attr("font-family", "sans-serif") | ||
.attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle") | ||
.attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle"); | ||
selection | ||
.each(function() { this.__axis = position; }); | ||
@@ -115,0 +121,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
0
26057
6
11
298
124
- Removedd3-scale@~0.7.0
- Removedd3-selection@~0.7.0
- Removedd3-transition@~0.2.0
- Removedd3-array@0.7.1(transitive)
- Removedd3-collection@0.2.0(transitive)
- Removedd3-color@0.4.2(transitive)
- Removedd3-dispatch@0.4.4(transitive)
- Removedd3-ease@0.7.0(transitive)
- Removedd3-format@0.5.1(transitive)
- Removedd3-interpolate@0.8.3(transitive)
- Removedd3-scale@0.7.2(transitive)
- Removedd3-selection@0.7.3(transitive)
- Removedd3-time@0.2.6(transitive)
- Removedd3-time-format@0.3.2(transitive)
- Removedd3-timer@0.4.4(transitive)
- Removedd3-transition@0.2.10(transitive)