これが にのみ当てはまることを考えるとPieChart
、AChartEngine のバグと言えます。修正されるまで、次の回避策を見つけました。
public class CustomPieChart extends org.achartengine.chart.PieChart {
private static final long serialVersionUID = 1L;
public CustomPieChart(CategorySeries dataset, DefaultRenderer renderer) {
super(dataset, renderer);
}
@Override
protected void drawLabel(Canvas canvas, String labelText, DefaultRenderer renderer, List<RectF> prevLabelsBounds, int centerX, int centerY, float shortRadius, float longRadius, float currentAngle, float angle, int left, int right, int color, Paint paint, boolean line, boolean display) {
paint.setTypeface(...typeface...);
super.drawLabel(canvas, labelText, renderer, prevLabelsBounds, centerX, centerY, shortRadius, longRadius, currentAngle, angle, left, right, color, paint, line, display);
}
@Override
protected int drawLegend(Canvas canvas, DefaultRenderer renderer, String[] titles, int left, int right, int y, int width, int height, int legendSize, Paint paint, boolean calculate) {
paint.setTypeface(...typeface...);
return super.drawLegend(canvas, renderer, titles, left, right, y, width, height, legendSize, paint, calculate);
}
@Override
public void drawTitle(Canvas canvas, int x, int y, int width, Paint paint) {
paint.setTypeface(...typeface...);
super.drawTitle(canvas, x, y, width, paint);
}
}
次に、を使用する代わりに、次のChartFactory
ように手動でインスタンス化します。
view = new GraphicalView(context, new CustomPieChart(dataset, renderer));