@@ -1586,6 +1586,14 @@ axes.draw = function(gd, arg, opts) {
1586
1586
} ) ) ;
1587
1587
} ;
1588
1588
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
+ */
1589
1597
axes . drawOne = function ( gd , ax , opts ) {
1590
1598
opts = opts || { } ;
1591
1599
@@ -1831,9 +1839,9 @@ axes.drawOne = function(gd, ax, opts) {
1831
1839
* Which direction do the 'ax.side' values, and free ticks go?
1832
1840
*
1833
1841
* @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
1837
1845
* @return {array } all entries are either -1 or 1
1838
1846
* - [0]: sign for top/right ticks (i.e. negative SVG direction)
1839
1847
* - [1]: sign for bottom/left ticks (i.e. positive SVG direction)
@@ -1852,6 +1860,15 @@ axes.getTickSigns = function(ax) {
1852
1860
return out ;
1853
1861
} ;
1854
1862
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
+ */
1855
1872
axes . makeTransFn = function ( ax ) {
1856
1873
var axLetter = ax . _id . charAt ( 0 ) ;
1857
1874
var offset = ax . _offset ;
@@ -1860,6 +1877,17 @@ axes.makeTransFn = function(ax) {
1860
1877
function ( d ) { return 'translate(0,' + ( offset + ax . l2p ( d . x ) ) + ')' ; } ;
1861
1878
} ;
1862
1879
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
+ */
1863
1891
axes . makeTickPath = function ( ax , shift , sgn ) {
1864
1892
var axLetter = ax . _id . charAt ( 0 ) ;
1865
1893
var pad = ( ax . linewidth || 1 ) / 2 ;
@@ -1869,6 +1897,26 @@ axes.makeTickPath = function(ax, shift, sgn) {
1869
1897
'M' + ( shift + pad * sgn ) + ',0h' + ( len * sgn ) ;
1870
1898
} ;
1871
1899
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
+ */
1872
1920
axes . makeLabelFns = function ( ax , shift , angle ) {
1873
1921
var axLetter = ax . _id . charAt ( 0 ) ;
1874
1922
var pad = ( ax . linewidth || 1 ) / 2 ;
@@ -1933,6 +1981,22 @@ function makeDataFn(ax) {
1933
1981
} ;
1934
1982
}
1935
1983
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
+ */
1936
2000
axes . drawTicks = function ( gd , ax , opts ) {
1937
2001
opts = opts || { } ;
1938
2002
@@ -1954,6 +2018,26 @@ axes.drawTicks = function(gd, ax, opts) {
1954
2018
ticks . attr ( 'transform' , opts . transFn ) ;
1955
2019
} ;
1956
2020
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
+ */
1957
2041
axes . drawGrid = function ( gd , ax , opts ) {
1958
2042
opts = opts || { } ;
1959
2043
@@ -1984,6 +2068,24 @@ axes.drawGrid = function(gd, ax, opts) {
1984
2068
if ( typeof opts . path === 'function' ) grid . attr ( 'd' , opts . path ) ;
1985
2069
} ;
1986
2070
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
+ */
1987
2089
axes . drawZeroLine = function ( gd , ax , opts ) {
1988
2090
opts = opts || opts ;
1989
2091
@@ -2019,6 +2121,22 @@ axes.drawZeroLine = function(gd, ax, opts) {
2019
2121
. style ( 'stroke-width' , strokeWidth + 'px' ) ;
2020
2122
} ;
2021
2123
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
+ */
2022
2140
axes . drawLabels = function ( gd , ax , opts ) {
2023
2141
opts = opts || { } ;
2024
2142
0 commit comments