0

我正在尝试向 achartengine 生成的图形添加一个按钮。代码运行良好并显示图形,但未创建按钮。有什么建议么?

public class GraphActivity extends Activity {

public Intent getIntent(final Context context){
    Button buttonDone = new Button (context);
    buttonDone.setText("Done");
    buttonDone.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent done = new Intent(context, MainActivity.class);
            startActivity(done);
        }
    });

    int[] x= {1,2,3,4,5,6,7,8,9,10};
    int[]y={30, 34, 45, 77, 89,100, 110, 120, 130, 150};

    TimeSeries series = new TimeSeries ("LineGraph");
    for (int i=0; i<x.length;i++){
        series.add(x[i], y[i]);
    }

    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
    dataset.addSeries(series);

    XYMultipleSeriesRenderer mrenderer = new XYMultipleSeriesRenderer();
    XYSeriesRenderer renderer = new XYSeriesRenderer();
    mrenderer.addSeriesRenderer(renderer);
    Intent gintent = ChartFactory.getLineChartIntent(context, dataset, mrenderer, "LineGraph");
    return gintent;

}

}

4

0 回答 0