2013-10-30 25 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);