2012-08-15 136 views
2

我使用androidplot实现了一个绘图。下面是一些片段:绘图没有正确显示(Androidplot lib)

的.xml

<com.androidplot.xy.XYPlot 
     android:id="@+id/plot" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_marginBottom="5px" 
     android:layout_marginLeft="5px" 
     android:layout_marginRight="5px" 
     android:layout_marginTop="10px" 
     title="Dynamic Plot" /> 

代码

private XYPlot plot; 
// DynamicSerie implements XYSerie 
private DynamicSerie XSerie, YSerie; 
... 
// this thread is just for redrawing 
private class PlotTimerTask extends TimerTask { 
    @Override 
    public void run() { 
     try{ 
      plot.postRedraw(); 
     }catch(InterruptedException e){ 
      e.printStackTrace(); 
     } 
    } 
} 
... 
// most if this init looks just like in Androidplot.com tutorial 

link to tutorial

plot = (XYPlot) findViewById(R.id.plot); 
XSerie = new DynamicSerie(DataSeries.X_VEC, "X Axis Acc"); 
YSerie = new DynamicSerie(DataSeries.Y_VEC, "Y Axis Acc"); 
LineAndPointFormatter f1 = new LineAndPointFormatter(Color.rgb(0, 0, 200), null, Color.rgb(0, 0, 80)); 
f1.getFillPaint().setAlpha(220); 
plot.addSeries(XSerie, f1); 
plot.addSeries(YSerie, new LineAndPointFormatter(Color.rgb(0, 0, 0), null, Color.rgb(0, 80, 0))); 
plot.setGridPadding(5, 0, 5, 0); 
... 
@Override 
protected void onPause() { 
    timerTask.cancel(); 
    timer.purge(); 
    super.onPause(); 
} 
@Override 
protected void onResume() { 
    timerTask = new PlotTimerTask(); 
    timer.schedule(timerTask, 0, Constants.PLOT_REFRESH_RATE); 
    super.onResume(); 
} 

而这就是我到底得的: output plot

我试图操纵XYPlot的和LineAndPointFormatter的选择(无论是在Java代码和XML) - 颜色,填充,描绘了 - 一切我能想到的。并由此产生的阴谋是总是蓝色像这样。如果你看起来足够近,你会看到它背后有一个格式正确的情节 - 有坐标轴,图例,数据系列等等,但我不知道如何摆脱这个蓝色覆盖!

回答

3

plot.disableAllMarkup()。而已。