September 28th, 2017

GraphLib: An open source Android library for graphs

Java Android Developer, Java App Dev, Libraries and Frameworks, Mobile Java, Open Source, others, Programing, by admin.

Graphs and data plots are wonderful tools for illustrating relationships, depicting data trends, and tracking goals in your Android applications. I saw this for myself several years ago, when a former student of mine won first place in a student mobile app competition sponsored by the Charleston Defense Contractors Association. A key feature of the winning app, “Diabetes and Me,” was the ability to graph daily sugar levels.

As another example, consider a weight-tracking application that plots progress against a goal weight. Figure 1 illustrates how such an application might look on an Android phone. The figure uses a red line-graph to show average monthly weights for the year 2017. It shows the goal weight as a green straight line near the bottom. (Although the data values shown in the line graph are hypothetical, they are, unfortunately, realistic pertaining to the author of this article.)

weightforyearJohn I. Moore

Figure 1. Tracking weight for the year

In this article I’ll use my open source library, GraphLib, to demonstrate the basics of graphing mathematical functions in Android. It’s not the same graph library that my student used for his application. In fact, it’s much simpler and easier to use.

download

Get the source code for the open source Android graphing library introduced in this article. Created by John I. Moore.

Overview of GraphLib

GraphLib consists of one interface and eight classes. Three of those classes are internal to the library and have only package access, so you will not need to understand them in order to use GraphLib. Two of the remaining classes have very simple functionality, and the remainder are not hard to pick up.

Back Top

Leave a Reply