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
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();
}
그리고 이것은 내가 결국 무엇을 얻을 : 여기에 몇 가지 조각입니다색상, 채우기, 페인트 - - 내가 생각할 수있는 모든
17,451,515,나는 (자바 코드와 XML 모두) 옵션을 XYPlot
조작 시도 년대와 LineAndPointFormatter
의. 그리고 결과 플롯은 항상 푸른 색이었습니다. 충분히 가까이서 보면 축 뒤에, 축, 전설, 데이터 시리즈 등과 같은 형식화 된 플롯이 있습니다. 그러나이 파란색 오버레이를 제거하는 방법을 모르겠습니다!