Sid
Sid

Reputation: 1270

How to display only non-zero values in pie-chart?

I am using mpandroid chart to display my data. Here I have 5 xvals(A,B,C,D,E). Every xval has a yval(2.2,0.0,4.4,5.1,0.0,9.0).

I want to only display values on the pie-chart which are non-zero. Is there any way to do this?

So my PieData finally is created like this:

PieData d = new PieData(xVals, ds1);

wherein, xvals contains:

0 = "A"
1 = "B"
2 = "C"
3 = "D"
4 = "E"
5 = "entry0"
6 = "entry1"
7 = "entry2"
8 = "entry3"
9 = "entry4"

and, ds1 contains:

0 = {Entry@4129} "Entry, xIndex: 0 val (sum): 0.0"
1 = {Entry@4130} "Entry, xIndex: 1 val (sum): 7400.0"
2 = {Entry@4131} "Entry, xIndex: 2 val (sum): 20634.4"
3 = {Entry@4132} "Entry, xIndex: 3 val (sum): 0.0"
4 = {Entry@4133} "Entry, xIndex: 4 val (sum): 60203.52"

Upvotes: 0

Views: 325

Answers (1)

Philipp Jahoda
Philipp Jahoda

Reputation: 51411

I recommend that you simply write your own logic that excludes zero values from being added to the dataset.

Upvotes: 2

Related Questions