XY chart in Android
Posted: Thu Dec 22, 2011 9:22 pm
Hi,
I want to draw an XY chart.
I used the following code but I haven't get the awaited result.
Below there is the image of the chart that I got:
Below there is instead the image of the chart that I want:
Did I use a wrong series? Can you help me?
Thanks you!
I want to draw an XY chart.
I used the following code but I haven't get the awaited result.
Code: Select all
public class XY_ChartActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LinearLayout layout = (LinearLayout) findViewById(R.id.chartPanel);
TChart chart = new TChart(this);
chart.getGraphics3D().getAspect().setView3D(false);
Line series = new Line();
series.add(12.0,1.1);
series.add(14.0,1.3);
series.add(16.0,1.4);
series.add(20.0,1.6);
series.add(24.0,2.0);
series.add(26.0,2.3);
series.add(25.0,2.4);
series.add(23.0,2.6);
series.add(19.0,2.1);
chart.addSeries(series);
layout.addView(chart);
}
}
Below there is instead the image of the chart that I want:
Did I use a wrong series? Can you help me?
Thanks you!