2013-10-30 2 views
1

AndroidPlot XYPlot의 그래프를 패딩없이 전체보기에 채우게 할 수있는 방법이 있습니까? 내가 특별히 내가 이미지에서 빨간색으로 표시 왼쪽에있는 공간에 대해 이야기하고GraphWidget을 AndroidPlot의 전체보기로 채우십시오

:

enter image description here

내 목표는 이미지 위에 그래프를 오버레이하고하는 것입니다 그것은 부모 전망 플러시 테두리. 나는 XYPlot의 서브 클래스에있는 모든 라벨을 제거 했으므로, Paint를 null로 설정하여 사용하게 될 공간을 남겨 둡니다.

public void setup() { 
    this.setBackgroundPaint(null); 
    setPlotMarginLeft(0); 

    setRangeBoundaries(-2, 2, BoundaryMode.FIXED); 
    setDomainBoundaries(0, HISTORY_SIZE, BoundaryMode.FIXED); 


    XYGraphWidget g = getGraphWidget(); 

    g.setDomainLabelPaint(null); 
    g.setRangeLabelPaint(null); 
    g.setDomainOriginLabelPaint(null); 
    g.setRangeOriginLabelPaint(null); 
    g.setGridBackgroundPaint(null); 
    g.setGridPaddingLeft(0); 
    g.setGridPaddingRight(0); 
    g.setMarginLeft(0); 
    g.setBackgroundPaint(null); 
    g.position(-0.5f, XLayoutStyle.RELATIVE_TO_RIGHT, 
      -0.5f, YLayoutStyle.RELATIVE_TO_BOTTOM, 
      AnchorPosition.CENTER); 
    g.setSize(new SizeMetrics(
      0, SizeLayoutType.FILL, 
      0, SizeLayoutType.FILL)); 

    LayoutManager l = getLayoutManager(); 
    l.remove(this.getDomainLabelWidget()); 
    l.remove(this.getRangeLabelWidget()); 
    l.remove(getLegendWidget()); 

    mSeries = new SimpleXYSeries("Azimuth"); 
    mSeries.useImplicitXVals(); 
    addSeries(mSeries, new LineAndPointFormatter(Color.BLACK, null, null, null)); 

} 

답변

1

이있어 여기, 내가 어떤 여백, 패딩 또는 레이블이없는 플롯 설정하기 위해 사용하고있는 코드입니다 : 여기

내가 플롯을 설정하는 방법입니다

XYGraphWidget g = getGraphWidget(); 

    g.setDomainLabelPaint(null); 
    g.setRangeLabelPaint(null); 
    g.setDomainOriginLabelPaint(null); 
    g.setRangeOriginLabelPaint(null); 
    g.setGridBackgroundPaint(null); 
    g.setGridPaddingLeft(0); 
    g.setGridPaddingRight(0); 
    g.setMarginLeft(0); 
    g.setBackgroundPaint(null); 
    g.position(-0.5f, XLayoutStyle.RELATIVE_TO_RIGHT, 
      -0.5f, YLayoutStyle.RELATIVE_TO_BOTTOM, 
      AnchorPosition.CENTER); 
    g.setSize(new SizeMetrics(
      0, SizeLayoutType.FILL, 
      0, SizeLayoutType.FILL)); 

    LayoutManager l = getLayoutManager(); 
    l.remove(this.getDomainLabelWidget()); 
    l.remove(this.getRangeLabelWidget()); 
    l.remove(getLegendWidget()); 

    g.setRangeLabelWidth(0); 
    g.setDomainLabelWidth(0); 
    g.setPadding(0, 0, 0, 0); 
    g.setMargins(0, 0, 0, 0); 
    g.setGridPadding(0, 0, 0, 0); 
    setPlotMargins(0, 0, 0, 0); 
    setPlotPadding(0, 0, 0, 0);