android - AChartEngine TimeSeries XAxis Time grid Settings -


i'm trying use achartengine library using time series. x axis time, , y axis integer values.

the problem not setup renderer.setxaxismin , max x axis time. either data points crumbed together, or time apart large cannot see datapoints.

this classes i've used:

    //for chart 1 private static random random = new random(); private static timeseries timeseries; private static xymultipleseriesdataset dataset; private static xymultipleseriesrenderer renderer; private static xyseriesrenderer rendererseries; private static graphicalview view; 

initialization:

    if(timeseries == null)     {         //chart 1         dataset = new xymultipleseriesdataset();         renderer = new xymultipleseriesrenderer();         timeseries = new timeseries("channel 1");         rendererseries = new xyseriesrenderer();     } 

renderer:

    //for chart 1     renderer.setaxescolor(color.blue);     renderer.setaxistitletextsize(16);     renderer.setcharttitle("real time seizure monitoring graph");     renderer.setcharttitletextsize(15);     renderer.setfitlegend(true);     renderer.setgridcolor(color.ltgray);     renderer.setpanenabled(true, true);     renderer.setpointsize(1);     renderer.setxtitle("time");     renderer.setytitle("amplitude (dac)");     renderer.setmargins( new int []{60, 60, 60, 60});     renderer.setzoombuttonsvisible(false);     renderer.setbarspacing(10);     renderer.setshowgrid(true);     renderer.setlabelscolor(color.blue);     renderer.setapplybackgroundcolor(true);     renderer.setbackgroundcolor(color.black);     renderer.setaxistitletextsize(16);     renderer.setcharttitletextsize(20);     renderer.setlabelstextsize(15);     renderer.setlegendtextsize(15);     renderer.setzoombuttonsvisible(false);     renderer.setpointsize(5);     renderer.setxlabels(10);     renderer.setylabels(10);     renderer.setshowgrid(true);     renderer.setxlabelsalign(align.center);     renderer.setylabelsalign(align.right);     renderer.setinscroll(true);     renderer.setxlabels(5);     //renderer.setxaxismin(0.00000001);     //renderer.setxaxismax(new date().gettime());     //renderer.setxaxismin(100);     //renderer.setxaxismax(1000000);     renderer.addseriesrenderer(rendererseries);     rendererseries.setfillpoints(true);     rendererseries.setpointstyle(pointstyle.circle);     rendererseries.setcolor(color.red); 

adding datasets , series:

    //setting chart 1     dataset.addseries(timeseries);     view = chartfactory.gettimechartview(this, dataset, renderer, "real time seizure monitoring graph");     view.refreshdrawablestate();     view.repaint(); 

function start inserting random variables:

void starttest() {        mthread = new thread()     {         public void run()         {             while(true)             {                 try                  {                     thread.sleep(2000l);                 }                 catch (interruptedexception e)                  {                     e.printstacktrace();                 }                 //chart 1 random data                 int someint = random.nextint(4096);                 timeseries.add(new date(), someint);                 timeseries.addannotation(new date().tostring(), new date().gettime(), someint);                 view.refreshdrawablestate();                 view.repaint();             }         }     };     mthread.start(); } 

}

without set x axis min , max commented, datapoints updated no problems, , points visible.

furthermore, if there lot of data points created thread, panning appears slow.

the x axis min should value around first value added series. x axis max should value around last value in series.

anyway, depends on visible range want have in chart. setting value of 100 see in 1 of commented out line means minimum visible value on x axis in year 1970, makes values crowded somewhere on right side of chart.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -