Skip to content

Commit

Permalink
Prefix symbols with “symbol”.
Browse files Browse the repository at this point in the history
Prefix curves with “curve”.
  • Loading branch information
mbostock committed Jan 7, 2016
1 parent 5eab4e6 commit 988a8b2
Show file tree
Hide file tree
Showing 34 changed files with 324 additions and 324 deletions.
146 changes: 73 additions & 73 deletions README.md

Large diffs are not rendered by default.

62 changes: 31 additions & 31 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@ export {default as radialArea} from "./src/radialArea";
export {default as radialLine} from "./src/radialLine";

export {default as symbol, symbols} from "./src/symbol";
export {default as circle} from "./src/symbol/circle";
export {default as cross} from "./src/symbol/cross";
export {default as diamond} from "./src/symbol/diamond";
export {default as square} from "./src/symbol/square";
export {default as star} from "./src/symbol/star";
export {default as triangle} from "./src/symbol/triangle";
export {default as wye} from "./src/symbol/wye";
export {default as symbolCircle} from "./src/symbol/circle";
export {default as symbolCross} from "./src/symbol/cross";
export {default as symbolDiamond} from "./src/symbol/diamond";
export {default as symbolSquare} from "./src/symbol/square";
export {default as symbolStar} from "./src/symbol/star";
export {default as symbolTriangle} from "./src/symbol/triangle";
export {default as symbolWye} from "./src/symbol/wye";

export {default as basisClosed} from "./src/curve/basisClosed";
export {default as basisOpen} from "./src/curve/basisOpen";
export {default as basis} from "./src/curve/basis";
export {default as bundle} from "./src/curve/bundle";
export {default as cardinalClosed} from "./src/curve/cardinalClosed";
export {default as cardinalOpen} from "./src/curve/cardinalOpen";
export {default as cardinal} from "./src/curve/cardinal";
export {default as catmullRomClosed} from "./src/curve/catmullRomClosed";
export {default as catmullRomOpen} from "./src/curve/catmullRomOpen";
export {default as catmullRom} from "./src/curve/catmullRom";
export {default as linearClosed} from "./src/curve/linearClosed";
export {default as linear} from "./src/curve/linear";
export {default as monotone} from "./src/curve/monotone";
export {default as natural} from "./src/curve/natural";
export {default as step, stepAfter, stepBefore} from "./src/curve/step";
export {default as curveBasisClosed} from "./src/curve/basisClosed";
export {default as curveBasisOpen} from "./src/curve/basisOpen";
export {default as curveBasis} from "./src/curve/basis";
export {default as curveBundle} from "./src/curve/bundle";
export {default as curveCardinalClosed} from "./src/curve/cardinalClosed";
export {default as curveCardinalOpen} from "./src/curve/cardinalOpen";
export {default as curveCardinal} from "./src/curve/cardinal";
export {default as curveCatmullRomClosed} from "./src/curve/catmullRomClosed";
export {default as curveCatmullRomOpen} from "./src/curve/catmullRomOpen";
export {default as curveCatmullRom} from "./src/curve/catmullRom";
export {default as curveLinearClosed} from "./src/curve/linearClosed";
export {default as curveLinear} from "./src/curve/linear";
export {default as curveMonotone} from "./src/curve/monotone";
export {default as curveNatural} from "./src/curve/natural";
export {default as curveStep, stepAfter as curveStepAfter, stepBefore as curveStepBefore} from "./src/curve/step";

export {default as stack} from "./src/stack";
export {default as offsetExpand} from "./src/offset/expand";
export {default as offsetNone} from "./src/offset/none";
export {default as offsetSilhouette} from "./src/offset/silhouette";
export {default as offsetWiggle} from "./src/offset/wiggle";
export {default as orderAscending} from "./src/order/ascending";
export {default as orderDescending} from "./src/order/descending";
export {default as orderInsideOut} from "./src/order/insideOut";
export {default as orderNone} from "./src/order/none";
export {default as orderReverse} from "./src/order/reverse";
export {default as stackOffsetExpand} from "./src/offset/expand";
export {default as stackOffsetNone} from "./src/offset/none";
export {default as stackOffsetSilhouette} from "./src/offset/silhouette";
export {default as stackOffsetWiggle} from "./src/offset/wiggle";
export {default as stackOrderAscending} from "./src/order/ascending";
export {default as stackOrderDescending} from "./src/order/descending";
export {default as stackOrderInsideOut} from "./src/order/insideOut";
export {default as stackOrderNone} from "./src/order/none";
export {default as stackOrderReverse} from "./src/order/reverse";
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d3-shape",
"version": "0.3.0",
"version": "0.4.0",
"description": "Graphical primitives for visualization, such as lines and areas.",
"keywords": [
"d3",
Expand Down Expand Up @@ -30,7 +30,7 @@
"d3-path": "~0.1.3"
},
"devDependencies": {
"d3-polygon": "~0.0.3",
"d3-polygon": "~0.1.0",
"faucet": "0.0",
"rollup": "0.20.5",
"tape": "4",
Expand Down
12 changes: 6 additions & 6 deletions test/area-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tape("area() returns a default area shape", function(test) {
test.equal(a.y0()([42, 34]), 0);
test.equal(a.y1()([42, 34]), 34);
test.equal(a.defined()([42, 34]), true);
test.equal(a.curve(), shape.linear);
test.equal(a.curve(), shape.curveLinear);
test.equal(a.context(), null);
test.pathEqual(a([[0, 1], [2, 3], [4, 5]]), "M0,1L2,3L4,5L4,0L2,0L0,0Z");
test.end();
Expand Down Expand Up @@ -105,13 +105,13 @@ tape("area.y(y)(data) observes the specified constant", function(test) {
});

tape("area.curve(curve) sets the curve method", function(test) {
var a = shape.area().curve(shape.cardinal);
var a = shape.area().curve(shape.curveCardinal);
test.pathEqual(a([[0, 1], [1, 3], [2, 1], [3, 3]]), "M0,1C0,1,0.666667,3,1,3C1.333333,3,1.666667,1,2,1C2.333333,1,3,3,3,3L3,0C3,0,2.333333,0,2,0C1.666667,0,1.333333,0,1,0C0.666667,0,0,0,0,0Z");
test.end();
});

tape("area.curve(cardinal, tension) sets the cardinal spline tension", function(test) {
var a = shape.area().curve(shape.cardinal, 0.1);
tape("area.curve(curveCardinal, tension) sets the cardinal spline tension", function(test) {
var a = shape.area().curve(shape.curveCardinal, 0.1);
test.equal(a([]), null);
test.pathEqual(a([[0, 1]]), "M0,1L0,0Z");
test.pathEqual(a([[0, 1], [1, 3]]), "M0,1L1,3L1,0L0,0Z");
Expand All @@ -120,8 +120,8 @@ tape("area.curve(cardinal, tension) sets the cardinal spline tension", function(
test.end();
});

tape("area.curve(cardinal, tension) coerces the specified tension to a number", function(test) {
var a = shape.area().curve(shape.cardinal, "0.1");
tape("area.curve(curveCardinal, tension) coerces the specified tension to a number", function(test) {
var a = shape.area().curve(shape.curveCardinal, "0.1");
test.equal(a([]), null);
test.pathEqual(a([[0, 1]]), "M0,1L0,0Z");
test.pathEqual(a([[0, 1], [1, 3]]), "M0,1L1,3L1,0L0,0Z");
Expand Down
8 changes: 4 additions & 4 deletions test/curve/basis-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ var tape = require("tape"),

require("../pathEqual");

tape("line.curve(basis)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.basis);
tape("line.curve(curveBasis)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.curveBasis);
test.equal(l([]), null);
test.pathEqual(l([[0, 1]]), "M0,1Z");
test.pathEqual(l([[0, 1], [1, 3]]), "M0,1L1,3");
test.pathEqual(l([[0, 1], [1, 3], [2, 1]]), "M0,1L0.166667,1.333333C0.333333,1.666667,0.666667,2.333333,1,2.333333C1.333333,2.333333,1.666667,1.666667,1.833333,1.333333L2,1");
test.end();
});

tape("area.curve(basis)(data) generates the expected path", function(test) {
var a = shape.area().curve(shape.basis);
tape("area.curve(curveBasis)(data) generates the expected path", function(test) {
var a = shape.area().curve(shape.curveBasis);
test.equal(a([]), null);
test.pathEqual(a([[0, 1]]), "M0,1L0,0Z");
test.pathEqual(a([[0, 1], [1, 3]]), "M0,1L1,3L1,0L0,0Z");
Expand Down
4 changes: 2 additions & 2 deletions test/curve/basisClosed-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var tape = require("tape"),

require("../pathEqual");

tape("line.curve(basisClosed)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.basisClosed);
tape("line.curve(curveBasisClosed)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.curveBasisClosed);
test.equal(l([]), null);
test.pathEqual(l([[0, 0]]), "M0,0Z");
test.pathEqual(l([[0, 0], [0, 10]]), "M0,6.666667L0,3.333333Z");
Expand Down
8 changes: 4 additions & 4 deletions test/curve/basisOpen-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var tape = require("tape"),

require("../pathEqual");

tape("line.curve(basisOpen)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.basisOpen);
tape("line.curve(curveBasisOpen)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.curveBasisOpen);
test.equal(l([]), null);
test.equal(l([[0, 0]]), null);
test.equal(l([[0, 0], [0, 10]]), null);
Expand All @@ -14,8 +14,8 @@ tape("line.curve(basisOpen)(data) generates the expected path", function(test) {
test.end();
});

tape("area.curve(basisOpen)(data) generates the expected path", function(test) {
var a = shape.area().curve(shape.basisOpen);
tape("area.curve(curveBasisOpen)(data) generates the expected path", function(test) {
var a = shape.area().curve(shape.curveBasisOpen);
test.equal(a([]), null);
test.equal(a([[0, 1]]), null);
test.equal(a([[0, 1], [1, 3]]), null);
Expand Down
10 changes: 5 additions & 5 deletions test/curve/bundle-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ var tape = require("tape"),

require("../pathEqual");

tape("line.curve(bundle) uses a default beta of 0.85", function(test) {
var l = shape.line().curve(shape.bundle, 0.85);
test.equal(shape.line().curve(shape.bundle)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.bundle, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.bundle, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
tape("line.curve(curveBundle) uses a default beta of 0.85", function(test) {
var l = shape.line().curve(shape.curveBundle, 0.85);
test.equal(shape.line().curve(shape.curveBundle)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.curveBundle, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.curveBundle, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.end();
});
28 changes: 14 additions & 14 deletions test/curve/cardinal-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var tape = require("tape"),

require("../pathEqual");

tape("line.curve(cardinal)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.cardinal);
tape("line.curve(curveCardinal)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.curveCardinal);
test.equal(l([]), null);
test.pathEqual(l([[0, 1]]), "M0,1Z");
test.pathEqual(l([[0, 1], [1, 3]]), "M0,1L1,3");
Expand All @@ -13,16 +13,16 @@ tape("line.curve(cardinal)(data) generates the expected path", function(test) {
test.end();
});

tape("line.curve(cardinal) uses a default tension of zero", function(test) {
var l = shape.line().curve(shape.cardinal, 0);
test.equal(shape.line().curve(shape.cardinal)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.cardinal, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.cardinal, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
tape("line.curve(curveCardinal) uses a default tension of zero", function(test) {
var l = shape.line().curve(shape.curveCardinal, 0);
test.equal(shape.line().curve(shape.curveCardinal)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.curveCardinal, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.curveCardinal, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.end();
});

tape("area.curve(cardinal)(data) generates the expected path", function(test) {
var a = shape.area().curve(shape.cardinal);
tape("area.curve(curveCardinal)(data) generates the expected path", function(test) {
var a = shape.area().curve(shape.curveCardinal);
test.equal(a([]), null);
test.pathEqual(a([[0, 1]]), "M0,1L0,0Z");
test.pathEqual(a([[0, 1], [1, 3]]), "M0,1L1,3L1,0L0,0Z");
Expand All @@ -31,10 +31,10 @@ tape("area.curve(cardinal)(data) generates the expected path", function(test) {
test.end();
});

tape("area.curve(cardinal) uses a default tension of zero", function(test) {
var a = shape.area().curve(shape.cardinal, 0);
test.equal(shape.area().curve(shape.cardinal)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.area().curve(shape.cardinal, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.area().curve(shape.cardinal, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
tape("area.curve(curveCardinal) uses a default tension of zero", function(test) {
var a = shape.area().curve(shape.curveCardinal, 0);
test.equal(shape.area().curve(shape.curveCardinal)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.area().curve(shape.curveCardinal, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.area().curve(shape.curveCardinal, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.end();
});
14 changes: 7 additions & 7 deletions test/curve/cardinalClosed-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var tape = require("tape"),

require("../pathEqual");

tape("line.curve(cardinalClosed)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.cardinalClosed);
tape("line.curve(curveCardinalClosed)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.curveCardinalClosed);
test.equal(l([]), null);
test.pathEqual(l([[0, 1]]), "M0,1Z");
test.pathEqual(l([[0, 1], [1, 3]]), "M1,3L0,1Z");
Expand All @@ -13,10 +13,10 @@ tape("line.curve(cardinalClosed)(data) generates the expected path", function(te
test.end();
});

tape("line.curve(cardinalClosed) uses a default tension of zero", function(test) {
var l = shape.line().curve(shape.cardinalClosed, 0);
test.equal(shape.line().curve(shape.cardinalClosed)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.cardinalClosed, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.cardinalClosed, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
tape("line.curve(curveCardinalClosed) uses a default tension of zero", function(test) {
var l = shape.line().curve(shape.curveCardinalClosed, 0);
test.equal(shape.line().curve(shape.curveCardinalClosed)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.curveCardinalClosed, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.curveCardinalClosed, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.end();
});
28 changes: 14 additions & 14 deletions test/curve/cardinalOpen-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var tape = require("tape"),

require("../pathEqual");

tape("line.curve(cardinalOpen)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.cardinalOpen);
tape("line.curve(curveCardinalOpen)(data) generates the expected path", function(test) {
var l = shape.line().curve(shape.curveCardinalOpen);
test.equal(l([]), null);
test.equal(l([[0, 1]]), null);
test.equal(l([[0, 1], [1, 3]]), null);
Expand All @@ -13,16 +13,16 @@ tape("line.curve(cardinalOpen)(data) generates the expected path", function(test
test.end();
});

tape("line.curve(cardinalOpen) uses a default tension of zero", function(test) {
var l = shape.line().curve(shape.cardinalOpen, 0);
test.equal(shape.line().curve(shape.cardinalOpen)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.cardinalOpen, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.cardinalOpen, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
tape("line.curve(curveCardinalOpen) uses a default tension of zero", function(test) {
var l = shape.line().curve(shape.curveCardinalOpen, 0);
test.equal(shape.line().curve(shape.curveCardinalOpen)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.curveCardinalOpen, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.line().curve(shape.curveCardinalOpen, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), l([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.end();
});

tape("area.curve(cardinalOpen)(data) generates the expected path", function(test) {
var a = shape.area().curve(shape.cardinalOpen);
tape("area.curve(curveCardinalOpen)(data) generates the expected path", function(test) {
var a = shape.area().curve(shape.curveCardinalOpen);
test.equal(a([]), null);
test.equal(a([[0, 1]]), null);
test.equal(a([[0, 1], [1, 3]]), null);
Expand All @@ -31,10 +31,10 @@ tape("area.curve(cardinalOpen)(data) generates the expected path", function(test
test.end();
});

tape("area.curve(cardinalOpen) uses a default tension of zero", function(test) {
var a = shape.area().curve(shape.cardinalOpen, 0);
test.equal(shape.area().curve(shape.cardinalOpen)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.area().curve(shape.cardinalOpen, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.area().curve(shape.cardinalOpen, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
tape("area.curve(curveCardinalOpen) uses a default tension of zero", function(test) {
var a = shape.area().curve(shape.curveCardinalOpen, 0);
test.equal(shape.area().curve(shape.curveCardinalOpen)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.area().curve(shape.curveCardinalOpen, null)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.equal(shape.area().curve(shape.curveCardinalOpen, undefined)([[0, 1], [1, 3], [2, 1], [3, 3]]), a([[0, 1], [1, 3], [2, 1], [3, 3]]));
test.end();
});
Loading

0 comments on commit 988a8b2

Please sign in to comment.