有没有办法让AndroidPlot XYPlot的图形填充整个视图而不填充?
我特别谈到左侧的空间,我在图像中标记为红色:
我的目标是将图形叠加在图像上,并使其与父视图边框齐平。我已经删除了我的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));
}
答案 0 :(得分:1)
知道了,这是我用来设置Plot而没有任何边距,填充或标签的代码:
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);