1

是否可以在 中设置x/y 轴的线宽AChartEngine

默认情况下,两个轴的线宽均为 1 像素。我想将宽度设置为 1 dp (或其他),但我在Javadoc中找不到相应的方法。那么,有人知道这是否可能吗?

4

1 回答 1

2

我通过创建自定义图表和覆盖解决了这个问题draw()

public class CustomChart extends CombinedXYChart {

public CustomChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, String[] types) {
    super(dataset, renderer, types);
}

@Override
public void draw(android.graphics.Canvas canvas, int x, int y, int width, int height, android.graphics.Paint paint) {
    float strokeWidth = paint.getStrokeWidth();
    paint.setStrokeWidth(3);  // set your axes line width
    super.draw(canvas, x, y, width, height, paint);
    paint.setStrokeWidth(strokeWidth);
}
}
于 2013-08-24T10:04:26.157 回答