2

I am making a PieChart in android studio but am running into some issues with styling. The size of description (and legend and values are really small). I read the docs about this and it said there i had to use the setDescriptionTextSize() method and that it is available for every chart type.
However that method is not resolved for some reason.

extra info about project:
-the problem occurs in a fragment
-my pieChart is built in the "onChildAdded" method because it needs to be created when that function runs.
-the MPAndroidChart version is: v3.0.3

Here is my code:

pieChart = (PieChart) myView.findViewById(R.id.idPieChart);
pieChart.setCenterTextSize(25f);
pieChart.setUsePercentValues(true);
pieChart.setExtraOffsets(5, 10, 5, 5);
pieChart.setDrawHoleEnabled(true);
pieChart.setHoleColor(Color.WHITE);
pieChart.setTransparentCircleRadius(61f);
pieChart.setEntryLabelTextSize(25f);
pieChart.setUsePercentValues(true);
pieChart.setDescriptionTextSize(25f);  //THIS IS NOT RESOLVED

List<PieEntry> entries = new ArrayList<>();

entries.add(new PieEntry(likeCount.getLikes(), "Leuk"));
entries.add(new PieEntry(likeCount.getDislikes(), "Niet leuk"));
PieDataSet set = new PieDataSet(entries, "likes/dislikes");
PieData data = new PieData(set);
set.setColors(getResources().getColor(R.color.chartgreen)
                ,getResources().getColor(R.color.chartred));
pieChart.setData(data);
pieChart.invalidate(); // refresh

Does anyone know a possible solution to this problem?

0

2 Answers 2

1

you can use

pieChart.getDescription().setTextSize(25f);

instead of

pieChart.setDescriptionTextSize(25f); 
Sign up to request clarification or add additional context in comments.

Comments

1

The value has to be between 6f and 16f. Other values aren't accepted.

setDescriptionTextSize(float size): Sets the size of the description text in pixels, min 6f, max 16f.

2 Comments

I tried searching their github page but that method doesn't exist in their code. Maybe you need to contact the author.
alright! thanks for helping anyways. i will try that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.