(axisModel, labelEls, tickEls)
| 47254 | } |
| 47255 | |
| 47256 | function fixMinMaxLabelShow(axisModel, labelEls, tickEls) { |
| 47257 | if (shouldShowAllLabels(axisModel.axis)) { |
| 47258 | return; |
| 47259 | } // If min or max are user set, we need to check |
| 47260 | // If the tick on min(max) are overlap on their neighbour tick |
| 47261 | // If they are overlapped, we need to hide the min(max) tick label |
| 47262 | |
| 47263 | |
| 47264 | var showMinLabel = axisModel.get(['axisLabel', 'showMinLabel']); |
| 47265 | var showMaxLabel = axisModel.get(['axisLabel', 'showMaxLabel']); // FIXME |
| 47266 | // Have not consider onBand yet, where tick els is more than label els. |
| 47267 | |
| 47268 | labelEls = labelEls || []; |
| 47269 | tickEls = tickEls || []; |
| 47270 | var firstLabel = labelEls[0]; |
| 47271 | var nextLabel = labelEls[1]; |
| 47272 | var lastLabel = labelEls[labelEls.length - 1]; |
| 47273 | var prevLabel = labelEls[labelEls.length - 2]; |
| 47274 | var firstTick = tickEls[0]; |
| 47275 | var nextTick = tickEls[1]; |
| 47276 | var lastTick = tickEls[tickEls.length - 1]; |
| 47277 | var prevTick = tickEls[tickEls.length - 2]; |
| 47278 | |
| 47279 | if (showMinLabel === false) { |
| 47280 | ignoreEl(firstLabel); |
| 47281 | ignoreEl(firstTick); |
| 47282 | } else if (isTwoLabelOverlapped(firstLabel, nextLabel)) { |
| 47283 | if (showMinLabel) { |
| 47284 | ignoreEl(nextLabel); |
| 47285 | ignoreEl(nextTick); |
| 47286 | } else { |
| 47287 | ignoreEl(firstLabel); |
| 47288 | ignoreEl(firstTick); |
| 47289 | } |
| 47290 | } |
| 47291 | |
| 47292 | if (showMaxLabel === false) { |
| 47293 | ignoreEl(lastLabel); |
| 47294 | ignoreEl(lastTick); |
| 47295 | } else if (isTwoLabelOverlapped(prevLabel, lastLabel)) { |
| 47296 | if (showMaxLabel) { |
| 47297 | ignoreEl(prevLabel); |
| 47298 | ignoreEl(prevTick); |
| 47299 | } else { |
| 47300 | ignoreEl(lastLabel); |
| 47301 | ignoreEl(lastTick); |
| 47302 | } |
| 47303 | } |
| 47304 | } |
| 47305 | |
| 47306 | function ignoreEl(el) { |
| 47307 | el && (el.ignore = true); |
no test coverage detected
searching dependent graphs…