android - Graph visible outside X and Y axis -


i using achartengine data application continuously receiving on socket connection. point plotted against time x axis. once graph in place user can pan , zoom on graph. buttery smooth. problem when user zooms graph, portions of graph visible on other side of x , y axis.

how restrict graph being visible outside x , y axis?

here portion of code.

xymultipleseriesrenderer renderer = new xymultipleseriesrenderer();  renderer.setcharttitletextsize(12); renderer.setlabelstextsize(15); renderer.setmarginscolor(color.argb(0x00, 0x01, 0x01, 0x01)); renderer.setapplybackgroundcolor(true); renderer.setbackgroundcolor(color.transparent); renderer.setzoomenabled(true, true);     renderer.setpointsize(5f); renderer.setshowgrid(true); renderer.setxtitle(xtitle); renderer.setytitle(ytitle); renderer.setlabelscolor(getresources().getcolor(r.color.black)); renderer.setxlabelscolor(getresources().getcolor(r.color.black)); renderer.setylabelscolor(0, getresources().getcolor(r.color.black)); renderer.setdisplayvalues(true); renderer.setselectablebuffer(20); renderer.setshowlegend(false);      renderer.setrange(new double[] { timeserieschart.getminx(),             timeserieschart.getmaxx(), 0/* miny */, maxy });      renderer.setpanlimits(getchartlimit(      istimechart, timeserieschart.getminx(), timeserieschart.getmaxx(),      (maxy*-1)+timeserieschart.getminy(),      maxy)); 

enter image description here

i had similar requirement. solved clamping dataset max , min value. of course in case worked because transforming data received server before placing in dataset.

timeseries mtimeseries;  ... ...  private void addvalue(date time, double val){     if(val >= max_value){         val = max_value;     }     if(val <= min_value){         val = min_value;     }      mtimeseries.add(time, val); } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -