(fullLayout, ax, max)
| 248 | var TEXTPAD = 3; |
| 249 | |
| 250 | function padInsideLabelsOnAnchorAxis(fullLayout, ax, max) { |
| 251 | var pad = 0; |
| 252 | |
| 253 | var isX = ax._id.charAt(0) === 'x'; |
| 254 | |
| 255 | for(var subplot in fullLayout._plots) { |
| 256 | var plotinfo = fullLayout._plots[subplot]; |
| 257 | |
| 258 | if(ax._id !== plotinfo.xaxis._id && ax._id !== plotinfo.yaxis._id) continue; |
| 259 | |
| 260 | var anchorAxis = (isX ? plotinfo.yaxis : plotinfo.xaxis) || {}; |
| 261 | |
| 262 | if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) { |
| 263 | // increase padding to make more room for inside tick labels of the counter axis |
| 264 | if(( |
| 265 | !max && ( |
| 266 | anchorAxis.side === 'left' || |
| 267 | anchorAxis.side === 'bottom' |
| 268 | ) |
| 269 | ) || ( |
| 270 | max && ( |
| 271 | anchorAxis.side === 'top' || |
| 272 | anchorAxis.side === 'right' |
| 273 | ) |
| 274 | )) { |
| 275 | if(anchorAxis._vals) { |
| 276 | var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + 'tick'] || 0); |
| 277 | var cosA = Math.abs(Math.cos(rad)); |
| 278 | var sinA = Math.abs(Math.sin(rad)); |
| 279 | |
| 280 | // no stashed bounding boxes - stash bounding boxes |
| 281 | if(!anchorAxis._vals[0].bb) { |
| 282 | var cls = anchorAxis._id + 'tick'; |
| 283 | var tickLabels = anchorAxis._selections[cls]; |
| 284 | tickLabels.each(function(d) { |
| 285 | var thisLabel = d3.select(this); |
| 286 | var mathjaxGroup = thisLabel.select('.text-math-group'); |
| 287 | if(mathjaxGroup.empty()) { |
| 288 | d.bb = Drawing.bBox(thisLabel.node()); |
| 289 | } |
| 290 | }); |
| 291 | } |
| 292 | |
| 293 | // use bounding boxes |
| 294 | for(var i = 0; i < anchorAxis._vals.length; i++) { |
| 295 | var t = anchorAxis._vals[i]; |
| 296 | var bb = t.bb; |
| 297 | |
| 298 | if(bb) { |
| 299 | var w = 2 * TEXTPAD + bb.width; |
| 300 | var h = 2 * TEXTPAD + bb.height; |
| 301 | |
| 302 | pad = Math.max(pad, isX ? |
| 303 | Math.max(w * cosA, h * sinA) : |
| 304 | Math.max(h * cosA, w * sinA) |
| 305 | ); |
| 306 | } |
| 307 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…