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