Charts / Graphs library for android

Published by Kapil Mohan on

Free chart / graph library for android. Include pie chart, line graph, bar chart, histogram and other graphs simply using hellocharts library from github.com

Github link:- https://github.com/lecho/hellocharts-android

dependencies{
		compile 'com.github.lecho:hellocharts-library:1.5.8@aar'
   }

Every chart view can be defined in layout xml file:

 <lecho.lib.hellocharts.view.LineChartView
       android:id="@+id/chart"
       android:layout_width="match_parent"
       android:layout_height="match_parent" />

Programatically creating graph view

LineChartView chart = new LineChartView(context);
   layout.addView(chart);

Use methods from *Chart classes to define chart behaviour, example methods:

 Chart.setInteractive(boolean isInteractive);
   Chart.setZoomType(ZoomType zoomType);
   Chart.setContainerScrollEnabled(boolean isEnabled, ContainerScrollType type);

Use methods from data models to define how chart looks like, example methods:

 ChartData.setAxisXBottom(Axis axisX);
   ColumnChartData.setStacked(boolean isStacked);
   Line.setStrokeWidth(int strokeWidthDp);

Every chart has its own method to set chart data and its own data model, example for line chart:

  List<PointValue> values = new ArrayList<PointValue>();
   values.add(new PointValue(0, 2));
   values.add(new PointValue(1, 4));
   values.add(new PointValue(2, 3));
   values.add(new PointValue(3, 4));

   //In most cased you can call data model methods in builder-pattern-like manner.
   Line line = new Line(values).setColor(Color.BLUE).setCubic(true);
   List<Line> lines = new ArrayList<Line>();
   lines.add(line);

   LineChartData data = new LineChartData();
   data.setLines(lines);

   LineChartView chart = new LineChartView(context);
   chart.setLineChartData(data);

Library Details:

NB:- Verify codes with GitHub current version before using in live projects.

Keywords:

android graph, android chart, android pie chart, line graph, bar graph, histogram, android graph library, android chart library, android pie chart library, android histogram library, including chart in android, android chart / graph java.


Kapil Mohan

Like to add color to developers life and apps. Can create smile using Android, iOS, PHP, codeignitor, web technologies, etc... Feel free to contact me at [email protected] .