0
これまでのAndroidPlotを使ってボード線図を作成していますが、これまでのところグラフはよく見えます。下のグラフです:グラフエリアを拡大してマークアップエリアを使用する方法Androidplot
私は今、グラフ領域を拡張し、その周辺のすべての不要なスペースを削除しようとしています。私が試してみました: How do I remove all space around a chart in AndroidPlot?
http://androidplot.com/docs/borders-margins-and-padding/
彼らはトリックを行うようには見えません。私はパズルの1つか2つが足りないかもしれない。以下のコード断片である:
/**
* 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