Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show integer values instead of decimal in MPAndroidChart by PhilJay?

I'm using MPAndroidChart for showing hours of work by day.

Everything is working fine, but I can't figure out how to show integer, not float. For example, if I insert 19 hours in chart, it's showing like this at the top of each chart. Can I show it like 19 h?

enter image description here

like image 571
Jelena123 Avatar asked Sep 03 '25 02:09

Jelena123


1 Answers

Set value formatter, If you set 0 in DefaultValueFormatter it will be shown like integer value example 25, if you set 1 now the output will be 25.0

val barDataSet = BarDataSet(entries, "")

barDataSet.valueFormatter = DefaultValueFormatter(0)
like image 101
sunaina gupta Avatar answered Sep 04 '25 18:09

sunaina gupta