GraphView を使用して単純なグラフを描画しようとしていますが、コンパイル エラーが発生します:「シンボル クラス GraphViewSeries が見つかりません」。「import com.jjoe64.graphview.GraphViewSeries;」も追加してみました。しかし、同じエラーが発生します。このエラーの解決にご協力ください。
build.gradle ファイル:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.jjoe64:graphview:4.0.1'
}
コード:
import android.graphics.Color;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.LinearLayout;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.GridLabelRenderer;
import com.jjoe64.graphview.Viewport;
import com.jjoe64.graphview.series.DataPoint;
import com.jjoe64.graphview.series.LineGraphSeries;
import java.util.Random;
public class ResultGraph extends AppCompatActivity {
private final Handler mHandler = new Handler();
private Runnable mTimer1;
private Runnable mTimer2;
private GraphView graphView;
private GraphViewSeries exampleSeries1;
private GraphViewSeries exampleSeries2;
private double graph2LastXValue = 5d;
private GraphViewSeries exampleSeries3;
//change graphType to line if bar chart not required
private String graphType = "bar";
private double getRandom() {
double high = 3;
double low = 0.5;
return Math.random() * (high - low) + low;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_student_result_graph);
//example series data
exampleSeries1 = new GraphViewSeries(new GraphViewData[] {
new GraphViewData(1, 2.0d)
, new GraphViewData(2, 1.5d)
, new GraphViewData(2.5, 3.0d)
, new GraphViewData(3, 2.5d)
, new GraphViewData(4, 1.0d)
, new GraphViewData(5, 3.0d)
});
exampleSeries3 = new GraphViewSeries(new GraphViewData[] {});
exampleSeries3.getStyle().color = Color.CYAN;
}
}