Graphing on Android

Graphing on Android was one of the hardest problem we had to conquer because the Android platform, similar to other platforms, does not have native libraries that support plots like it does for text and images, or tables. And it does not support Java's native graphing libraries that are available online. Furthermore, unlike iPhone and desktop applications, our graph has to occupy a variable amount of space to fit the different screen sizes supported by different devices.

Upon research, I found that there are several options:

  1. Buy a professionally designed library native for Android such as the aiChart. The problem with this is that all the libraries are very expensive, and we don't think it is necessary to spend that much money on those if it is possible for us to do it ourself.
  2. Render the graph using a web view which will redirect the user to a browser, either rendering the graph using javascript or rendering it online using cloud services such as the Google Charts. We decided against we because of that will use a lot more resources (as compare to our last resort) and it does not offer as much flexibility as we may want it to have in the future.
  3. So there is only one option left: writing our own native graphing library for Android (we are not porting a Java graphing library because those do not offer as much flexibility as well).
Building a graphing library only for the line graph came out not that bad. By making all the lines, dots, and text relative to each other and setting the size of the objects from multiplying the current screen spec to a standard one, we finally made our graph.

Here is a prototype of our graph that shows the last ten days of one of our developers' sleep hours:

[caption id="attachment_79" align="alignnone" width="300" caption="A graph that shows my sleep hours for the past ten days"][/caption]