0
지금까지 AndroidPlot을 사용하여 보드 플롯을 작성했으며 지금까지는 그래프가 잘 보입니다. 지금 그래프 영역을 확장하여 주위 모든 불필요한 공백을 제거하는 것을 시도하고있다그래프 영역을 확장하여 마크 업 영역을 사용하는 방법 Androidplot
: 아래 그래프이다. 나는 시도했다 : How do I remove all space around a chart in AndroidPlot?
http://androidplot.com/docs/borders-margins-and-padding/
그들은 트릭을 할 것 같지 않습니다. 나는 퍼즐 조각 한두 장을 놓칠지도 모른다. 아래의 코드는 다음과 같습니다
/**
* AndroidPlot
*/
// Change Magnitude Plot Display
XYPlot mChart = (XYPlot) mView.findViewById(R.id.plot_magnitude);
Widget magGraphWidget = mChart.getGraphWidget();
// get a handle to the layout manager:
LayoutManager magLayoutManager = mChart.getLayoutManager();
magLayoutManager.remove(mChart.getLegendWidget());
magLayoutManager.remove(mChart.getDomainLabelWidget());
XYSeries magnitudeSeries = new SimpleXYSeries(Arrays.asList(logFreqs), Arrays.asList(magImp), "Magnitude");
// create formatters to use for drawing a series using LineAndPointRenderer
// and configure them from xml:
LineAndPointFormatter magnitudeSeriesFormat = new LineAndPointFormatter(
Color.rgb(0, 0, 0), Color.rgb(50, 180, 50), null, null
);
// just for fun, add some smoothing to the lines:
// see: http://androidplot.com/smooth-curves-and-androidplot/
magnitudeSeriesFormat.setInterpolationParams(new CatmullRomInterpolator.Params(10, CatmullRomInterpolator.Type.Centripetal));
// add a new series' to the xyplot:
mChart.addSeries(magnitudeSeries, magnitudeSeriesFormat);
// rotate domain labels 45 degrees to make them more compact horizontally:
mChart.getGraphWidget().setDomainLabelOrientation(-45);
// FILL mode with values of 0 means fill 100% of container:
mChart.setPlotMargins(0, 0, 0, 0);
mChart.setPlotPadding(0, 0, 0, 0);
mChart.getGraphWidget().setMarginTop(2);
mChart.getGraphWidget().setMarginRight(2);
mChart.getGraphWidget().setMarginLeft(2);
mChart.getGraphWidget().setMarginBottom(2);
mChart.setBorderPaint(null);
mChart.setMarkupEnabled(true);
magGraphWidget.setBackgroundPaint(null);
magGraphWidget.setSize(new Size(0, SizeLayoutType.FILL, 0, SizeLayoutType.FILL));
magGraphWidget.position(-0.5f, XLayoutStyle.ABSOLUTE_FROM_LEFT, -0.5f, YLayoutStyle.ABSOLUTE_FROM_TOP); //, AnchorPosition.CENTER);
mChart.redraw(); //update chart
은 XML입니다 :
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.androidplot.xy.XYPlot
android:id="@+id/plot_magnitude"
style="@style/APDefacto.Light"
android:layout_width="fill_parent"
android:layout_height="200dp"
ap:label="Bode Plot"
ap:rangeLabel="Magnitude (ohm)"
ap:labelTextSize="@dimen/title_font_size"
ap:paddingBottom="0dp"
android:paddingEnd="0dp"
ap:paddingLeft="0dp"
ap:paddingRight="0dp"
ap:paddingTop="0dp"
android:paddingStart="0dp"
android:padding="0dp"
android:layout_margin="0dp"
android:layout_marginBottom="0dp"
android:layout_marginEnd="0dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
/>
</FrameLayout>
누군가가 나에게 손을 제공 할 수 있습니다. 미리 감사드립니다.
고마워요! 그게 빠진 퍼즐이야! – Dan