0
androidplot-core-0.6.1.jar를 사용하고 있으며 빠른 시작 자습서에서 SimpleXYPlotActivity 예제를 수정하고 있습니다. 일부 항목과 여백/패딩을 제거했지만 수행 할 방법과 방법을 찾을 수없는 것은 차트의 왼쪽 공간을 제거하는 것입니다. 아래 이미지에서 빨간색으로 제거 할 공간을 표시했습니다. 이 작업을 수행 할 수 있습니까? 활동에서 Androidplot : 차트의 왼쪽 공간을 제거하십시오.
Red shows what I want to remove
코드 :
public class MyXYPlotActivity extends Activity {
private XYPlot plot;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.simple_xy_plot_example);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
plot = (XYPlot) findViewById(R.id.mySimpleXYPlot);
Number[] series1Numbers = {1, 8, 5, 2, 7, 4};
XYSeries series1 = new SimpleXYSeries(
Arrays.asList(series1Numbers), // SimpleXYSeries takes a List so turn our array into a List
SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, // Y_VALS_ONLY means use the element index as the x value
"Foo"); // Set the display title of the series
LineAndPointFormatter series1Format = new LineAndPointFormatter();
series1Format.setPointLabelFormatter(new PointLabelFormatter());
series1Format.configure(getApplicationContext(),
R.xml.line_point_formatter_with_plf1);
plot.addSeries(series1, series1Format);
plot.setDomainValueFormat(new DecimalFormat("#"));
plot.setRangeValueFormat(new DecimalFormat("#"));
plot.setTitle("Title");
plot.setRangeBoundaries(0,10, BoundaryMode.FIXED);
int length = 30;
plot.setDomainBoundaries(1,length, BoundaryMode.FIXED);
plot.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 1);
plot.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 1);
plot.setMarkupEnabled(true);
plot.setTicksPerRangeLabel(1);
plot.setTicksPerDomainLabel(1);
plot.getGraphWidget().setDomainLabelOrientation(90);
plot.getLayoutManager().remove(plot.getLegendWidget());
plot.getLayoutManager().remove(plot.getRangeLabelWidget());
plot.getLayoutManager().remove(plot.getDomainLabelWidget());
plot.setPlotMargins(0, 0, 0, 0);
plot.setPlotPadding(0, 0, 0, 0);
plot.setBorderStyle(Plot.BorderStyle.SQUARE, null, null);
plot.getRangeLabelWidget().setHeight(0);
plot.getRangeLabelWidget().setWidth(0);
plot.getRangeLabelWidget().setPadding(0, 0, 0, 0);
plot.getRangeLabelWidget().setMargins(0, 0, 0, 0);
plot.getDomainLabelWidget().setHeight(0);
plot.getDomainLabelWidget().setWidth(0);
plot.getDomainLabelWidget().setPadding(0, 0, 0, 0);
plot.getDomainLabelWidget().setMargins(0, 0, 0, 0);
}
}
편집 :
XYGraphWidget g = plot.getGraphWidget();
g.setRangeLabelWidth(25);
g.setDomainLabelWidth(25);
이 위 작품 : 나는 해결책을 찾아 냈다.
setMarginsLeft (0)와 setPaddingLeft (0) – BlueCat
당신이 정교한 원하는 효과가 없었어요? 효과가 없습니까, 효과가 너무 많았습니까, 너무 적 었습니까, 원하는 영역 또는 위의 일부 조합에 맞지 않았습니까? – Nick
Nick : 코드를 사용해 보았지만 시각적으로 전혀 변화가 없었습니다. 내가 제공 한 링크 중 하나를 확인하고 일부를 둘러보고 나서 작업 한 것을 발견했습니다. 솔루션을 포함하도록 초기 질문을 편집했습니다. 고맙습니다. – BlueCat