GraphViewSeries构造函数未定义

时间:2014-06-12 18:50:36

标签: android-graphview

我正在尝试使用graphview显示图表。我得到错误:“构造函数GraphViewSeries(String,int,GraphView.GraphViewData [])未定义”

这是我的一部分:

import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.GraphView.GraphViewData;
import com.jjoe64.graphview.GraphViewSeries;
import com.jjoe64.graphview.LineGraphView;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.os.Build;

public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.container, new PlaceholderFragment())
                .commit();
    }

 // first init data
 // sin curve
 int num = 150;
 GraphViewData[] data = new GraphViewData[num];
 double v=0;
 for (int i=0; i<num; i++) {
   v += 0.2;
   data[i] = new GraphViewData(i, Math.sin(v));
 }
 GraphViewSeries seriesSin = new GraphViewSeries("Sinus curve", Color.rgb(200, 50, 00), data);

我不确定是什么问题。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

你可以试试这个:

GraphViewSeries seriesSin = new GraphViewSeries(&#34; Sinus curve&#34;,new GraphViewSeriesStyle(Color.BLUE,2),data);