Skip to content

Commit ea6e76f

Browse files
committed
add jsDoc to new Axes methods
1 parent 016b8e4 commit ea6e76f

File tree

1 file changed

+121
-3
lines changed

1 file changed

+121
-3
lines changed

src/plots/cartesian/axes.js

Lines changed: 121 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,14 @@ axes.draw = function(gd, arg, opts) {
15861586
}));
15871587
};
15881588

1589+
/**
1590+
* Draw one cartesian axis
1591+
*
1592+
* @param {DOM element} gd
1593+
* @param {object} ax (full) axis object
1594+
* @param {object} opts
1595+
* - @param {boolean} skipTitle (set to true to skip axis title draw call)
1596+
*/
15891597
axes.drawOne = function(gd, ax, opts) {
15901598
opts = opts || {};
15911599

@@ -1831,9 +1839,9 @@ axes.drawOne = function(gd, ax, opts) {
18311839
* Which direction do the 'ax.side' values, and free ticks go?
18321840
*
18331841
* @param {object} ax (full) axis object
1834-
* - @param {string} _id (starting with 'x' or 'y')
1835-
* - @param {string} side
1836-
* - @param {string} ticks
1842+
* - {string} _id (starting with 'x' or 'y')
1843+
* - {string} side
1844+
* - {string} ticks
18371845
* @return {array} all entries are either -1 or 1
18381846
* - [0]: sign for top/right ticks (i.e. negative SVG direction)
18391847
* - [1]: sign for bottom/left ticks (i.e. positive SVG direction)
@@ -1852,6 +1860,15 @@ axes.getTickSigns = function(ax) {
18521860
return out;
18531861
};
18541862

1863+
/**
1864+
* Make axis translate transform function
1865+
*
1866+
* @param {object} ax (full) axis object
1867+
* - {string} _id
1868+
* - {number} _offset
1869+
* - {fn} l2p
1870+
* @return {fn} function of calcTicks items
1871+
*/
18551872
axes.makeTransFn = function(ax) {
18561873
var axLetter = ax._id.charAt(0);
18571874
var offset = ax._offset;
@@ -1860,6 +1877,17 @@ axes.makeTransFn = function(ax) {
18601877
function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; };
18611878
};
18621879

1880+
/**
1881+
* Make axis tick path string
1882+
*
1883+
* @param {object} ax (full) axis object
1884+
* - {string} _id
1885+
* - {number} ticklen
1886+
* - {number} linewidth
1887+
* @param {number} shift along direction of ticklen
1888+
* @param {1 or -1} sng tick sign
1889+
* @return {string}
1890+
*/
18631891
axes.makeTickPath = function(ax, shift, sgn) {
18641892
var axLetter = ax._id.charAt(0);
18651893
var pad = (ax.linewidth || 1) / 2;
@@ -1869,6 +1897,26 @@ axes.makeTickPath = function(ax, shift, sgn) {
18691897
'M' + (shift + pad * sgn) + ',0h' + (len * sgn);
18701898
};
18711899

1900+
/**
1901+
* Make axis tick label x, y and anchor functions
1902+
*
1903+
* @param {object} ax (full) axis object
1904+
* - {string} _id
1905+
* - {string} ticks
1906+
* - {number} ticklen
1907+
* - {string} side
1908+
* - {number} linewidth
1909+
* - {number} tickfont.size
1910+
* - {boolean} showline
1911+
* @param {number} shift
1912+
* @param {number} angle [in degrees] ...
1913+
* @return {object}
1914+
* - {fn} labelXFn
1915+
* - {fn} labelYFn
1916+
* - {fn} labelAnchorFn
1917+
* - {number} labelStandoff
1918+
* - {number} labelShift
1919+
*/
18721920
axes.makeLabelFns = function(ax, shift, angle) {
18731921
var axLetter = ax._id.charAt(0);
18741922
var pad = (ax.linewidth || 1) / 2;
@@ -1933,6 +1981,22 @@ function makeDataFn(ax) {
19331981
};
19341982
}
19351983

1984+
/**
1985+
* Draw axis ticks
1986+
*
1987+
* @param {DOM element} gd
1988+
* @param {object} ax (full) axis object
1989+
* - {string} _id
1990+
* - {string} ticks
1991+
* - {number} linewidth
1992+
* - {string} tickcolor
1993+
* @param {object} opts
1994+
* - {array of object} vals (calcTicks output-like)
1995+
* - {d3 selection} layer
1996+
* - {string or fn} path
1997+
* - {fn} transFn
1998+
* - {boolean} crisp (set to false to unset crisp-edge SVG rendering)
1999+
*/
19362000
axes.drawTicks = function(gd, ax, opts) {
19372001
opts = opts || {};
19382002

@@ -1954,6 +2018,26 @@ axes.drawTicks = function(gd, ax, opts) {
19542018
ticks.attr('transform', opts.transFn);
19552019
};
19562020

2021+
2022+
/**
2023+
* Draw axis grid
2024+
*
2025+
* @param {DOM element} gd
2026+
* @param {object} ax (full) axis object
2027+
* - {string} _id
2028+
* - {boolean} showgrid
2029+
* - {string} gridcolor
2030+
* - {string} gridwidth
2031+
* - {boolean} zeroline
2032+
* - {string} type
2033+
* - {string} dtick
2034+
* @param {object} opts
2035+
* - {array of object} vals (calcTicks output-like)
2036+
* - {d3 selection} layer
2037+
* - {string or fn} path
2038+
* - {fn} transFn
2039+
* - {boolean} crisp (set to false to unset crisp-edge SVG rendering)
2040+
*/
19572041
axes.drawGrid = function(gd, ax, opts) {
19582042
opts = opts || {};
19592043

@@ -1984,6 +2068,24 @@ axes.drawGrid = function(gd, ax, opts) {
19842068
if(typeof opts.path === 'function') grid.attr('d', opts.path);
19852069
};
19862070

2071+
/**
2072+
* Draw axis zero-line
2073+
*
2074+
* @param {DOM element} gd
2075+
* @param {object} ax (full) axis object
2076+
* - {string} _id
2077+
* - {boolean} zeroline
2078+
* - {number} zerolinewidth
2079+
* - {string} zerolinecolor
2080+
* - {number (optional)} _gridWidthCrispRound
2081+
* @param {object} opts
2082+
* - {array of object} vals (calcTicks output-like)
2083+
* - {d3 selection} layer
2084+
* - {object} counterAxis (full axis object corresponding to counter axis)
2085+
* - {string or fn} path
2086+
* - {fn} transFn
2087+
* - {boolean} crisp (set to false to unset crisp-edge SVG rendering)
2088+
*/
19872089
axes.drawZeroLine = function(gd, ax, opts) {
19882090
opts = opts || opts;
19892091

@@ -2019,6 +2121,22 @@ axes.drawZeroLine = function(gd, ax, opts) {
20192121
.style('stroke-width', strokeWidth + 'px');
20202122
};
20212123

2124+
/**
2125+
* Draw axis tick labels
2126+
*
2127+
* @param {DOM element} gd
2128+
* @param {object} ax (full) axis object
2129+
* - {string} _id
2130+
* - {boolean} showticklabels
2131+
* - {number} tickangle
2132+
* @param {object} opts
2133+
* - {array of object} vals (calcTicks output-like)
2134+
* - {d3 selection} layer
2135+
* - {fn} transFn
2136+
* - {fn} labelXFn
2137+
* - {fn} labelYFn
2138+
* - {fn} labelAnchorFn
2139+
*/
20222140
axes.drawLabels = function(gd, ax, opts) {
20232141
opts = opts || {};
20242142

0 commit comments

Comments
 (0)