如何设置饼图切片' achartengine的边框颜色?

时间:2014-03-22 22:50:14

标签: java android achartengine

我正在寻找一种方法来为使用AChartEngine Android库制作的饼图切片设置边框颜色。有没有人知道如何实现这个目标?

1 个答案:

答案 0 :(得分:1)

achartengine的内置函数无法实现这一点。

但是你可以通过编辑achartengine的库来实现这一点。

PieChart.java课程中进行以下更改。请参阅//new line added

 if (seriesRenderer.isHighlighted()) {
        double rAngle = Math.toRadians(90 - (currentAngle + angle / 2));
        float translateX = (float) (radius * 0.1 * Math.sin(rAngle));
        float translateY = (float) (radius * 0.1 * Math.cos(rAngle));
        oval.offset(translateX, translateY);
        canvas.drawArc(oval, currentAngle, angle, true, paint);
        oval.offset(-translateX, -translateY);
      } else {
        paint.setStyle(Style.FILL);   //new line added
        canvas.drawArc(oval, currentAngle, angle, true, paint);
        paint.setColor(Color.BLACK);  //new line added
        paint.setStyle(Style.STROKE);  //new line added
        canvas.drawArc(oval, currentAngle, angle, true, paint); //new line added
      }