2017-03-01 4 views
0

HorizontalScrollView 안에 파이 차트가 동적으로 생성됩니다. 그렇게하면 파이 차트의 제목이 기본적으로 흰색으로 설정됩니다. XML없이 (XML이 없으므로) 어떻게 변경합니까? 아래는 차트를 동적으로 생성하는 데 사용 된 코드입니다.androidplot에서 표제 색상 변경 xml없이 파이 차트

LinearLayout l_layout=chart_container; 
LinearLayout.LayoutParams lp_view = new LinearLayout.LayoutParams(300,300); 

PieChart pie = new PieChart(this,"BYE"); 

s1 = new Segment("s1", 10000); 
s1.setTitle("10000"); 
s2 = new Segment("s2", 5000); 
s2.setTitle("5000"); 

SegmentFormatter sf1 = new SegmentFormatter(getApplicationContext(), R.xml.pie_segment_formatter1); 
sf1.getOuterEdgePaint().setColor(Color.TRANSPARENT); 

SegmentFormatter sf2 = new SegmentFormatter(getApplicationContext(), R.xml.pie_segment_formatter2 
sf2.getOuterEdgePaint().setColor(Color.TRANSPARENT); 

pie.addSeries(s1, sf1); 
pie.addSeries(s2, sf2); 
pie.getBorderPaint().setColor(Color.TRANSPARENT); 
pie.getBackgroundPaint().setColor(Color.TRANSPARENT); 

pie.getRenderer(PieRenderer.class).setDonutSize(0.1f,PieRenderer.DonutMode.PERCENT); 
pie.redraw(); 


l_layout.addView(pie, lp_view); 

setupIntroAnimation(pie); 

답변

0

이 트릭을 수행해야합니다

pie.getTitle().getLabelPaint().setColor(Color.RED);