dimple-js
Version:
Dimple is an object-oriented API allowing you to create flexible axis-based charts using [d3.js](http://d3js.org "d3.js").
26 lines (20 loc) • 1.02 kB
JavaScript
// Copyright: 2015 AlignAlytics
// License: "https://github.com/PMSI-AlignAlytics/dimple/blob/master/MIT-LICENSE.txt"
// Source: /src/objects/chart/methods/_axisIndex.js
// Return the ordinal value of the passed axis. If an orientation is passed, return the order for the
// specific orientation, otherwise return the order from all axes. Returns -1 if the passed axis isn't part of the collection
this._axisIndex = function (axis, orientation) {
var i = 0,
axisCount = 0,
index = -1;
for (i = 0; i < this.axes.length; i += 1) {
if (this.axes[i] === axis) {
index = axisCount;
break;
}
if (orientation === null || orientation === undefined || orientation[0] === this.axes[i].position[0]) {
axisCount += 1;
}
}
return index;
};