Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #312 from FormidableLabs/bug/ticks
Browse files Browse the repository at this point in the history
remove unused method
  • Loading branch information
boygirl authored Oct 19, 2017
2 parents f7d6555 + 3eeebc8 commit 1647965
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
23 changes: 0 additions & 23 deletions src/victory-util/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,28 +349,5 @@ export default {

return domainMin instanceof Date || domainMax instanceof Date ?
[new Date(finalDomain.min), new Date(finalDomain.max)] : [finalDomain.min, finalDomain.max];
},

/**
* Returns the domain or the reversed domain depending on orientation
* @param {Array} domain: the original domain
* @param {Object} orientations: the x and y orientations
* @param {String} axis: the current axis
* @returns {Array} the domain or the reversed domain
*/
orientDomain(domain, orientations, axis) {
// If the other axis is in a reversed orientation, the domain of this axis
// needs to be reversed
const otherAxis = axis === "x" ? "y" : "x";
const defaultOrientation = (ax) => ax === "x" ? "bottom" : "left";
const flippedAxis = orientations.x === "left" || orientations.x === "right";
const standardOrientation = flippedAxis ?
orientations[otherAxis] === defaultOrientation(axis) :
orientations[otherAxis] === defaultOrientation(otherAxis);
if (flippedAxis) {
return standardOrientation ? domain.concat().reverse() : domain;
} else {
return standardOrientation ? domain : domain.concat().reverse();
}
}
};
22 changes: 0 additions & 22 deletions test/client/spec/victory-util/domain.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,6 @@ describe("helpers/domain", () => {
});
});

describe("orientDomain", () => {
const domain = [0, 10];
const reversedDomain = [10, 0];
it("returns a domain for standard orientations", () => {
const orientations = { x: "bottom", y: "left" };
const domainResult = Domain.orientDomain(domain, orientations, "x");
expect(domainResult).to.eql(domain);
});

it("reverses a domain for non-standard orientations", () => {
const orientations = { x: "top", y: "right" };
const domainResult = Domain.orientDomain(domain, orientations, "x");
expect(domainResult).to.eql(reversedDomain);
});

it("reverses a domain for flipped axes", () => {
const orientations = { x: "right", y: "bottom" };
const domainResult = Domain.orientDomain(domain, orientations, "x");
expect(domainResult).to.eql(reversedDomain);
});
});

describe("getDomain", () => {
let sandbox;
beforeEach(() => {
Expand Down

0 comments on commit 1647965

Please sign in to comment.