Limited-time offer! Save up to 50% Off | Solutions starting at $6 each  

Code. Plot Value Status[ low,normal,high] data against

Added on - 16 Sep 2019

Trusted by 2+ million users,
1000+ happy students everyday
Showing pages 1 to 1 of 2 pages
CodePlot Value Status[ low,normal,high] data against time and date saved on CSV file and display them inandroid line graphI successfully understand how to display the graph however I have problem on how to extract data fromCSV file and plotted them in the line graph the x axis should be the time and data and the y axisrepresent the Value status .This what I tried as first step, can you explain to me how I can plot status against time and datepackagecom.example.aliaaldhaheri.displaychart;;;importandroid.os.Bundle;importcom.androidplot.xy.LineAndPointFormatter;importcom.androidplot.xy.PointLabelFormatter;importcom.androidplot.xy.SimpleXYSeries;importcom.androidplot.xy.XYPlot;importcom.androidplot.xy.XYSeries;importjava.util.Arrays;public classMainActivityextendsAppCompatActivity {privateXYPlotplot;@Overrideprotected voidonCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);// initialize our XYPlot reference:plot= (XYPlot) findViewById(;// XYSeries s1=newSimpleXYSeries(SimpleXYSeries.ArrayFormat.XY_VALS_INTERLEAVED,"series1",1,5,2,8,3,9);//plot.addSeries(s1,newLineAndPointFormatter(Color.GREEN,Color.GREEN,null,null));// Create a couple arrays of y-values to plot:Number[] series1Numbers = {64,100,85,100,160,70};// get blood pressurevaules in array listXYSeries series1 =newSimpleXYSeries(Arrays.asList(series1Numbers),// SimpleXYSeries takes a Listso turn our array into a ListSimpleXYSeries.ArrayFormat.Y_VALS_ONLY,// Y_VALS_ONLY means use theelement index as the x value"Blood Pressure");// Set the displaytitle of the seriesplot.setDomainLabel("Date");plot.setRangeLabel("Pressure Status");
You’re reading a preview
Preview Documents

To View Complete Document

Click the button to download
Subscribe to our plans

Download This Document