I am using EazeGraph library to plot my Double values
// in percent
Double PROTEIN_percent = ((PROTEIN_grams / TOTALCALORIES_numbers) * 100);
Double FAT_percent = ((FAT_grams / TOTALCALORIES_numbers) * 100);
Double CARBS_percent = ((CARBS_grams / TOTALCALORIES_numbers) * 100);
The problem is it does not let me plot it without adding .floatValue to the Double
mPieChart.addPieSlice(new PieModel("CARBS", CARBS_percent.floatValue(), Color.parseColor("#FE6DA8")));
mPieChart.addPieSlice(new PieModel("PROTEIN", PROTEIN_percent.floatValue(), Color.parseColor("#56B7F1")));
mPieChart.addPieSlice(new PieModel("FAT", FAT_percent.floatValue(), Color.parseColor("#FED70E")));
mPieChart.startAnimation();
Also I want the output to be rounded to 2 digits, It does not let me use String.format("%.2f" because it is not a string.
This is what I am getting : 62.1232131342
and this is what I want: 62.12