让一个GraphWidget填充AndroidPlot中的整个视图
有没有一种方法可以让AndroidPlot XYPlot的图形在不填充的情况下填充整个视图 我特别指的是我在图像中标记为红色的左侧空间: 我的目标是将图形覆盖在图像上,并使其与父视图边框齐平。我已经删除了XYPlot子类中的所有标签,通过将它们的Paint设置为null,它们将占用的空间仍然保留 下面是我如何设置绘图的:让一个GraphWidget填充AndroidPlot中的整个视图,androidplot,Androidplot,有没有一种方法可以让AndroidPlot XYPlot的图形在不填充的情况下填充整个视图 我特别指的是我在图像中标记为红色的左侧空间: 我的目标是将图形覆盖在图像上,并使其与父视图边框齐平。我已经删除了XYPlot子类中的所有标签,通过将它们的Paint设置为null,它们将占用的空间仍然保留 下面是我如何设置绘图的: public void setup() { this.setBackgroundPaint(null); setPlotMarginLeft(0);
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));
}
明白了,这是我用来设置没有任何边距、填充或标签的绘图的代码:
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);
明白了,这是我用来设置没有任何边距、填充或标签的绘图的代码:
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);