You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I want to save my values from Azure sql database into an array list for graph view to plot it real time.this is the code I have , please help me out. I am newbie to programming
package com.example.myappgvtest;
public class MainActivity extends AppCompatActivity {
private static final Random RANDOM = new Random();
private int lastX =0;
private LineGraphSeries series;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GraphView graph = (GraphView) findViewById(R.id.graph); //instance
// List<DataPoint> myPointList = ....
// LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(Arrays.asList(myPointList));
series = new LineGraphSeries<DataPoint>(); //data
graph.addSeries(series);
Viewport viewport = graph.getViewport();
viewport.setYAxisBoundsManual(true);
viewport.setMinY(0);
viewport.setMaxY(10);
viewport.setScrollable(true);
}
@Override
protected void onResume() {
super.onResume();
new Thread (new Runnable() {
public void run(){
for (int i=0;1<100;i++) {
runOnUiThread(new Runnable() {
public void run() {
addEntry();
}
});
try {
Thread.sleep(600);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} }).start();
Hi, I want to save my values from Azure sql database into an array list for graph view to plot it real time.this is the code I have , please help me out. I am newbie to programming
package com.example.myappgvtest;
import androidx.appcompat.app.AppCompatActivity;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.Viewport;
import com.jjoe64.graphview.series.DataPoint;
import com.jjoe64.graphview.series.LineGraphSeries;
import android.os.Bundle;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
private static final Random RANDOM = new Random();
private int lastX =0;
private LineGraphSeries series;
}
private void addEntry() {
series.appendData(new DataPoint(lastX++ , RANDOM.nextDouble()*10d),true,10);
The text was updated successfully, but these errors were encountered: