lecho/hellocharts-android

label of left/right axis overlap label of top axis

lxd19850415 opened this issue · 0 comments

In function Paint.drawText , parameter x,y means left and bottom of label , so last(from bottom to top) label of left/right axis show too high . finally it overlap with label of top axis。

this is my method to fix it:
in class “AxesRenderer”,and in function “drawAxisLabelsAndName”

        if (isAxisVertical) {
            if(valueToDrawIndex == valuesToDrawNumTab[position] - 1){  //last lable
                Paint.FontMetrics fontMetrics = labelPaintTab[position].getFontMetrics();
                float fontHight = (fontMetrics.bottom - fontMetrics.top);

                labelY = rawValuesTab[position][valueToDrawIndex] + fontHight; //avoid text overlap with top axis
            }else{

                labelY = rawValuesTab[position][valueToDrawIndex];
            }
        } else {
            labelX = rawValuesTab[position][valueToDrawIndex];
        }

Best Wishes!