我已经使用android绘图饼图在我的应用程序中绘制数据。我的问题是饼图中的分隔线(在下面的图像中)。无论我采用何种方式设置图表,我似乎无法摆脱黑线。
以下是我设置的方式:
//Sets up the pie chart to display the user beer ratings figures visually
private void chartSetup(PieChart p){
PieWidget pw = p.getPieWidget();
pw.setPadding(0,0,0,0);
SegmentFormatter sf1 = new SegmentFormatter();
sf1.configure(getActivity(),R.xml.pie_segment_formatter1);
sf1.getFillPaint();
SegmentFormatter sf2 = new SegmentFormatter();
sf2.configure(getActivity(), R.xml.pie_segment_formatter2);
sf2.getFillPaint();
Segment monthly = new Segment("", totalBeerCount);
Segment total = new Segment("", monthlyBeerCount);
p.setPlotMarginBottom(0);
p.addSegment(monthly, sf1);
p.addSegment(total, sf2);
p.redraw();
p.getBorderPaint().setColor(Color.TRANSPARENT);
p.getBackgroundPaint().setColor(Color.TRANSPARENT);
p.getRenderer(PieRenderer.class).setDonutSize(.90f, PieRenderer.DonutMode.PERCENT);
}
以下是两个分段格式化程序xml文件:
pie_segment_formatter1
<?xml version="1.0" encoding="utf-8"?>
<config
fillPaint.color="@color/appRed"
labelPaint.textSize="5dp"
innerEdgePaint.color = "@color/appRed"
outerEdgePaint.color = "@color/appRed"/>
pie_segment_formatter2
<?xml version="1.0" encoding="utf-8"?>
<config
fillPaint.color="@color/lightGrey"
labelPaint.textSize="5dp"
innerEdgePaint.color = "@color/lightGrey"
outerEdgePaint.color = "@color/lightGrey"/>
我尝试在配置文件中加入linePaint.strokeWidth="0dp"
,但这并没有任何区别。如果有人能帮助我,我会非常感激。
答案 0 :(得分:0)
您正在寻找的是用于绘制径向边缘的涂料。将此行添加到每个格式化程序xml cfgs:
radialEdgePaint.color="#00000000"
或者在Java src中以编程方式编写:
formatter.setRadialEdgePaint(null);