Android: how to create lists under charts in Achartengine?

Android: Hi, I'm using AchartEngine to display charts in my application.
I tried different ways to display these charts with some lists under the chart in my application, but I did not. I have no idea how to use these diagrams with layout definitions in xml. I can display graphs without using xml layouts.

Thanks a lot at Advance.

Regards, Harry.

+2
source share
2 answers

If Achartengine is referenced in your project (or compiled if you include the source), you should see the view available in the eclipse layout designer.

Just drag the view onto your layout.

Alternatively, you can dynamically create your layout, but this will require a little extra work and research.

+1
source

AchartEngine has a ChartFactory class that is used to create views or intentions.

So, perhaps you can set the view returned to the right place in xml.

So you can create xml, here I have a LinearLayout that will contain my graph.

 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ListView android:id="@+id/list_view" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <LinearLayout android:id="@+id/myLinearLayout" android:layout_width="wrap_content" android:layout_height="wrap_content"> </LinearLayout> </LinearLayout> 

Now in the Activity class, you can display the graph by receiving the LinearLayout identifier and adding it to LinearLayout. The onItemClick() the ListView list shows a graph.

  XYMultipleSeriesRenderer renderer = Bar_Chart.getBarDemoRenderer(); linear_layout.removeAllViews(); View mView = ChartFactory.getBarChartView(this, Bar_Chart.getBarDemoDataset(), renderer, Type.DEFAULT); mView.setLayoutParams(new LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT) ); linear_layout.addView(mView); 
+1
source

All Articles