I'm using GraphView library (see: https://github.com/jjoe64/GraphView or http://www.jjoe64.com/p/graphview-library.html)
But I would like to use Date/Time for the X-as. Does anyone knows a easy way to accomplish this or can anyone push me in the right direction?
I created the horizontal labels at the same time I was setting the values:
This is the correct way to do this
You just have to use the unix timestamp (seconds from 1.01.1970) as x value.
Then you can set a custom label formatter and convert the unix timestamp to a String:
Here's the updated answer from jjoe64, with the x-values obtained from Date#getTime()
GraphView is a great library to use, i find it the easiest as well. The first step in doing this would be to add a String Variable in the GraphViewData Class within GraphView.java. Like So:
When you create your GraphViewData object when creating a GraphView Graph, you will need to add the date data in string form (along with the X and Y).
Lets say you have 80 data points in your graph (index 0 - 79). There is a method within GraphView that is responsible for generating and returning the horizontal labels, i believe its called generateHorLabels. Instead of just returning the X Value (0-79), Use the X value to get the String from the GraphData object.
In the code you have now, it should have the following in a for loop
instead of the above, you could do something like this.
Hope this helped!