Skip to content

steprobe/GraphView

 
 

Repository files navigation

Chart and Graph Library for Android

What is GraphView

GraphView is a library for Android to programmatically create flexible and nice-looking diagramms. It is easy to understand, to integrate and to customize it. At the moment there are two different types:
  • Line Charts
  • Bar Charts

Tested on Android 1.6, 2.2, 2.3 and 3.0 (honeycomb, tablet).

Features

  • Two types: Line and Bar
  • Custom labels The labels for the x- and y-axis are generated automatically. But you can set your only labels, Strings are possible.
  • Background Optionally draws a light background under the diagramm stroke.
  • Handle incomplete data It's possible to give the data in different frequency.
  • Viewport You can limit the viewport so that only a part of the data will be displayed.
  • Scrolling You can scroll with a finger touch move gesture.
  • Scaling / Zooming Since Android 2.3! With two-fingers touch scale gesture, the viewport can be changed.

How to use

http://www.jjoe64.com/2011/07/chart-and-graph-library-for-android.html
// line graph with dynamically genereated horizontal and vertical labels
LineGraphView graphView = new LineGraphView(
  this // context
  , new GraphViewData[] {
    new GraphViewData(1, 2.0d)
    , new GraphViewData(2, 1.5d)
    , new GraphViewData(2.5, 3.0d) // another frequency
    , new GraphViewData(3, 2.5d)
    , new GraphViewData(4, 1.0d)
    , new GraphViewData(5, 3.0d)
  } // data
  , "GraphViewDemo" // heading
  , null // dynamic labels
  , null // dynamic labels
);
LinearLayout layout = (LinearLayout) findViewById(R.id.graph1);
layout.addView(graphView);

Important

To show you how to integrate the library into an existing project see the GraphView-Demos project! See GraphView-Demos for examples. https://github.com/jjoe64/GraphView-Demos
http://www.jjoe64.com/2011/07/chart-and-graph-library-for-android.html

About

Android Graph Library for creating zoomable and scrollable line and bar graphs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%