Is It Possible To Show A Chart By Using Mpandroid From Web Server Api?
I am newbie android developer and i have a list of different currency items and I should open a new screen with chart of clicked item. when user clicks on a list item a new screen
Solution 1:
I think that i should format the value by using
XAxis
like thatxAxis.setValueFormatter(here i should use a class);
Elaborating on my answer to your other question and not knowing MPAndoirdChart, it would seem to me from the documentation that you need to make your own subclass of ValueFormatter
and override getFormattedValue(float)
to return something like LocalDate.ofEpochDay(Math.round(value)).toString()
. Instead of toString
you may want to use a DateTimeFormatter
.
Here’s a quick attempt, not tested:
publicclassDateValueFormatterextendsValueFormatter {
@Override
String getFormattedValue(float value) {
intepochDay= Math.round(value);
LocalDatedate= LocalDate.ofEpochDay(epochDay);
return date.toString();
}
}
My humble and tentative suggestion is that you instantiate an object of this class and pass it to xAxis.setValueFormatter()
.
Post a Comment for "Is It Possible To Show A Chart By Using Mpandroid From Web Server Api?"