I'm trying to make some graphics in my application with the AchartEngine API
but it doesn't works.
Can anyone explain me how to have a view with a graphic
instead of Intent
?
Cause in the demo code it's only by Intent
, not by view.
edit: I tried to test the 2 options at the same time: I have a linearLayout with a button in it:
<LinearLayout android:id="@+id/list_infos_layout_stat" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" >
<Button
android:id="@+id/list_infos_bouton_stats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="statistiques"
/>
When I hit the button, a new activity is made by the ChartFactory.getLineChartIntent(..)
method and it works great.
And in the same LinearLayout, I put a view returned by ChartFactory.getLineChartView
method, its ok I have the graphic at the right of the button.
But when I remove the button I have nothing...
View graphique = new ReponsesChart().getView(contexte);
if (graphique !=null){
LinearLayout layout = (LinearLayout)convertView.findViewById(R.id.list_infos_layout_stat);
layout.addView(graphique, new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
} else {
Log.d("Infos", "GRAPHIQUE NULL");
}
edit 2: Fixed by replacing Fill Parent properties when I add the view to the layout by the width of the screen