Mpandroidchart: Float to Double on entry

Created on 11 Feb 2017  路  8Comments  路  Source: PhilJay/MPAndroidChart

Why you are using float on entry? Maybe you can use Double instead of float.

Most helpful comment

Just use BigDecimal, then use .floatValue() on that and you will be able to use entry.

All 8 comments

I am stuck now, i need to display big number in Pie Chart. Because of float entry I can't.. Any solutions?

+1

+2

+1

Just use BigDecimal, then use .floatValue() on that and you will be able to use entry.

Still didn't work @Specko93

double d = detail.getValue();//162444145
BigDecimal bigDecimal = new BigDecimal(d);
Log.i("hello", bigDecimal + "");//162444145
Log.i("hello", bigDecimal.floatValue() + "");//1.6244414E8
entry = new Entry(bigDecimal.floatValue(), i);//162444144 //showing on the line chart value

@ratikanta-sdrc
Strange.. It worked for me. Let me try it when I get home. I will post you my code.

i send a list(Double) and new barEntry(float x, float y, data) ,i order data is 0,1,2,3...then getformatter() reture list.get(entry.getdata),i solved by this way
for (int i = 0, n = yAxisValue.size(); i < n; ++i) { entries.add(new BarEntry(i, yAxisValue.get(i),i)); }

data.setValueFormatter(new IValueFormatter() { @Override public String getFormattedValue(float value, Entry entry, int i, ViewPortHandler viewPortHandler) { return String.valueOf(list.get(entry.getData())); } });

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thanhcly920 picture thanhcly920  路  3Comments

vishvendu picture vishvendu  路  3Comments

rohitkumarbhagat picture rohitkumarbhagat  路  3Comments

AiTheAnswer picture AiTheAnswer  路  3Comments

mrZizik picture mrZizik  路  3Comments