我通过实现PieChart在MPAndroidChart库上进行了以下设置,但我需要设置描述文本大小。
PieData data = new PieData(valsPieX, set1);
data.setValueTextSize(20f);
if(usePercentSymbol)
data.setValueFormatter(new PercentFormatter());
pieChart.setData(data);
pieChart.setDrawSliceText(false);
*pieChart.setDescription(Description);*
pieChart.highlightValues(null);
pieChart.invalidate();
答案 0 :(得分:4)
pieChart.getDescription().setText("Description Text goes here"); //the text which will be displayed.
pieChart.getDescription().setTextSize(16f); //sets the size of the label text in density pixels min = 6f, max = 24f, default is 10f, font size will be in dp
pieChart.getDescription().setTextColor(ContextCompat.getColor(context, android.R.color.holo_red_dark)); //the color of the font
pieChart.getDescription().setTextAlign(Paint.Align.RIGHT); //Sets the text alignment of the description text. Default RIGHT
pieChart :是您的图表对象,可以是PieChart
,BarChart
,LineChart
或任何其他图表类型。
说明:是getDescription()
从图表中返回的对象。
答案 1 :(得分:2)
pieChart.getDescription().setTextSize(16f);