Back

android - MPAndroidChart - 调整饼状图的文字提示跟图的距离,以及调整好文字的位置不要跑偏

发布时间: 2017-09-25 07:30:00

调整饼状图跟文字提示的距离:

dataSet.setValueLinePart1Length(0.43f);

调整好文字跟饼状图的对应:

PieChartRenderer: 

                    /**
                     * 这个变量会引起饼状图的文字提示的位置变化。 
                     */
                    float temp = dataSet.isValueLineVariableLength()
                            ? labelRadius * valueLineLength2 * (float) Math.abs(Math.sin(
                            transformedAngle * Utils.FDEG2RAD))
                            : labelRadius * valueLineLength2;
                    final float polyline2Width =  0 - temp/2 ;

Back