Tuesday, July 30, 2013

Adding AChartEngine Library To Android Application

So here is a self sufficient place to find all about AChartEngine. Which includes link to download,

1. achartengine-1.1.0-demo-source.zip The AChartEngine 1.1.0 demo project source code. May 15 May 15 168 KB 8149
   2. achartengine-1.1.0-javadocs.zip The AChartEngine 1.1.0 javadoc documentation. May 15 May 15 374 KB 3610
   3. achartengine-1.1.0.jar The AChartEngine 1.1.0 binary build library. May 15 May 15 117 KB 5264

Which are latest for now(while posting this answer). Now follow these easy steps in order to add new chart file:

 - Download and add achartengine-1.1.0.jar to your project's lib section
 - Now right click on file and add it to build path, like in image



 - Now as define in previous answers, add following code to your class:

private GraphicalView mChartView;
private XYMultipleSeriesDataset dataset;
private XYMultipleSeriesRenderer renderer;
private BarChart.Type type;


protected void onResume() {
     super.onResume();
     if (mChartView == null) {
       LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
       /*getBarChartView(android.content.Context context, XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, BarChart.Type type)
         Creates a bar chart view.*/
       mChartView = ChartFactory.getBarChartView(this, dataset, renderer, type);//tView(this,getBarDemoDataset(values),renderer,Type.DEFAULT);
       layout.addView(mChartView);
     } else {
       mChartView.repaint();
     }
   }

- To get detail about any class of AChartEngineAPI, download achartengine-1.1.0-javadocs.zip and open by clicking in index.html

- achartengine-1.1.0-demo-source.zip will be helpful during further deepar development where you can take reference for all charts


No comments:

Post a Comment