I am trying to display a line graph using aChartEngine, however, the page is coming up blank and I am receiving the error "eglSurfaceAttrib not implemented"
Code for Progress(display) page:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".LineGraph" >
</RelativeLayout>
Code for LineGraph.java :
package com.lifematters;
import org.achartengine.ChartFactory;
import org.achartengine.model.TimeSeries;
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.renderer.XYMultipleSeriesRenderer;
import org.achartengine.renderer.XYSeriesRenderer;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
public class LineGraph extends Activity {
//define layout
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.progress);
}
public Intent getIntent(Context context)
{
int[] x = {1, 2, 3, 4, 5, 6, 7}; //x values
int[] y = {3, 2, 3, 4, 2, 1, 3}; //y values
//need to create series as graph does not support arrays
TimeSeries series = new TimeSeries("Line1");
for( int i = 0; i < x.length; i++)
{
series.add(x[i], y[i]);
}
//allows more than 1 line to be added to linegraph
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
dataset.addSeries(series);
//customize lines
XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
XYSeriesRenderer renderer = new XYSeriesRenderer();
mRenderer.addSeriesRenderer(renderer);
Intent intent = ChartFactory.getLineChartIntent(context, dataset, mRenderer,
"Line Graph Title");
return intent;
}
}
Code for .MainActivity :
package com.lifematters;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.ImageButton;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//define Navigation Image Buttons
final ImageButton progressBtn = (ImageButton) findViewById(R.id.ImagebtnProgress);
//Set up listener for Progress
progressBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//listener call this function
openProgress();
}
});
}
//Open progress page
public void openProgress() {
//create new textview
Intent i = new Intent(getApplicationContext(), LineGraph.class);
startActivity(i);
}
public void lineGraphHandler (View view)
{
LineGraph line = new LineGraph();
Intent lineIntent = line.getIntent(this);
startActivity(lineIntent);
}
}
This is the log cat:
01-22 23:44:24.583: E/Trace(3973): error opening trace file: No such file or directory (2)
01-22 23:44:24.703: D/dalvikvm(3973): GC_CONCURRENT freed 149K, 3% free 10996K/11271K, paused 13ms+5ms, total 70ms
01-22 23:44:24.707: D/dalvikvm(3973): WAIT_FOR_CONCURRENT_GC blocked 50ms
01-22 23:44:24.775: D/dalvikvm(3973): GC_FOR_ALLOC freed 93K, 4% free 11162K/11527K, paused 14ms, total 15ms
01-22 23:44:24.851: D/libEGL(3973): loaded /system/lib/egl/libEGL_emulation.so
01-22 23:44:24.855: D/(3973): HostConnection::get() New Host Connection established 0xb885bbf8, tid 3973
01-22 23:44:24.867: D/libEGL(3973): loaded /system/lib/egl/libGLESv1_CM_emulation.so
01-22 23:44:24.867: D/libEGL(3973): loaded /system/lib/egl/libGLESv2_emulation.so
01-22 23:44:24.955: W/EGL_emulation(3973): eglSurfaceAttrib not implemented
01-22 23:44:24.979: D/OpenGLRenderer(3973): Enabling debug mode 0
01-22 23:44:25.027: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb8866190): name, size, mSize = 1, 1048576, 1048576
01-22 23:44:25.107: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb8864ad0): name, size, mSize = 2, 9216, 1057792
01-22 23:44:25.187: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb8878a60): name, size, mSize = 4, 36864, 1094656
01-22 23:44:25.207: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb8864638): name, size, mSize = 6, 13312, 1107968
01-22 23:44:25.215: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb886f080): name, size, mSize = 7, 43264, 1151232
01-22 23:44:25.219: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb88664a8): name, size, mSize = 8, 43264, 1194496
01-22 23:44:25.227: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb886f6c8): name, size, mSize = 9, 57600, 1252096
01-22 23:44:25.239: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb886f738): name, size, mSize = 10, 77284, 1329380
01-22 23:44:25.243: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb887f598): name, size, mSize = 11, 88804, 1418184
01-22 23:44:25.251: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb886da70): name, size, mSize = 12, 73984, 1492168
01-22 23:44:25.255: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb886d918): name, size, mSize = 13, 43264, 1535432
01-22 23:44:25.259: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb8864f28): name, size, mSize = 14, 43264, 1578696
01-22 23:44:25.263: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb887e3e8): name, size, mSize = 15, 4096, 1582792
01-22 23:44:38.119: D/OpenGLRenderer(3973): TextureCache::get: create texture(0xb88942a0): name, size, mSize = 19, 13312, 1596104
01-22 23:44:38.767: W/EGL_emulation(3973): eglSurfaceAttrib not implemented
Any help would be much appreciated. Thank you