MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / fixMinMaxLabelShow

Function fixMinMaxLabelShow

libs/echarts/echarts.simple.js:40765–40821  ·  view source on GitHub ↗
(axisModel, labelEls, tickEls)

Source from the content-addressed store, hash-verified

40763};
40764
40765function fixMinMaxLabelShow(axisModel, labelEls, tickEls) {
40766 if (shouldShowAllLabels(axisModel.axis)) {
40767 return;
40768 }
40769
40770 // If min or max are user set, we need to check
40771 // If the tick on min(max) are overlap on their neighbour tick
40772 // If they are overlapped, we need to hide the min(max) tick label
40773 var showMinLabel = axisModel.get('axisLabel.showMinLabel');
40774 var showMaxLabel = axisModel.get('axisLabel.showMaxLabel');
40775
40776 // FIXME
40777 // Have not consider onBand yet, where tick els is more than label els.
40778
40779 labelEls = labelEls || [];
40780 tickEls = tickEls || [];
40781
40782 var firstLabel = labelEls[0];
40783 var nextLabel = labelEls[1];
40784 var lastLabel = labelEls[labelEls.length - 1];
40785 var prevLabel = labelEls[labelEls.length - 2];
40786
40787 var firstTick = tickEls[0];
40788 var nextTick = tickEls[1];
40789 var lastTick = tickEls[tickEls.length - 1];
40790 var prevTick = tickEls[tickEls.length - 2];
40791
40792 if (showMinLabel === false) {
40793 ignoreEl(firstLabel);
40794 ignoreEl(firstTick);
40795 }
40796 else if (isTwoLabelOverlapped(firstLabel, nextLabel)) {
40797 if (showMinLabel) {
40798 ignoreEl(nextLabel);
40799 ignoreEl(nextTick);
40800 }
40801 else {
40802 ignoreEl(firstLabel);
40803 ignoreEl(firstTick);
40804 }
40805 }
40806
40807 if (showMaxLabel === false) {
40808 ignoreEl(lastLabel);
40809 ignoreEl(lastTick);
40810 }
40811 else if (isTwoLabelOverlapped(prevLabel, lastLabel)) {
40812 if (showMaxLabel) {
40813 ignoreEl(prevLabel);
40814 ignoreEl(prevTick);
40815 }
40816 else {
40817 ignoreEl(lastLabel);
40818 ignoreEl(lastTick);
40819 }
40820 }
40821}
40822

Callers 1

echarts.simple.jsFile · 0.70

Calls 4

shouldShowAllLabelsFunction · 0.70
ignoreElFunction · 0.70
isTwoLabelOverlappedFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected