1

androidplot の凡例ウィジェットを必要な場所に移動するのに苦労しています。

一連のデータをレンダリングするために androidplot を使用しようとしています。DemoApp で使用されている position() メソッドを呼び出して、凡例ウィジェットをポイントに配置する方法に従いました。しかし、私は決して成功しませんでした。これでほぼ1週間ブロックされました。コードに間違いがあったかどうかを確認するのを手伝ってくれませんか。サンプルコードを除いて、このライブラリの使用方法に関するドキュメントは見つかりませんでした。

私のレイアウトxml:

<com.androidplot.xy.XYPlot
    android:id="@+id/mySimpleXYPlot"
    android:layout_width="fill_parent"
    android:layout_height="200dp"
    android:layout_below="@+id/seperator1"
    androidPlot.domainLabelWidget.labelPaint.textSize="@dimen/domain_label_font_size"
  androidPlot.graphWidget.domainLabelPaint.textSize="@dimen/domain_tick_label_font_size"
        androidPlot.graphWidget.domainOriginLabelPaint.textSize="@dimen/domain_tick_label_font_size"
        androidPlot.graphWidget.rangeLabelPaint.textSize="@dimen/range_tick_label_font_size"
        androidPlot.graphWidget.rangeOriginLabelPaint.textSize="@dimen/range_tick_label_font_size"
        androidPlot.legendWidget.heightMetric.value="25dp"
        androidPlot.graphWidget.marginBottom="25dp"
        androidPlot.graphWidget.marginLeft="15dp"
        androidPlot.graphWidget.marginRight="10dp"
        androidPlot.graphWidget.marginTop="20dp"
        androidPlot.legendWidget.iconSizeMetrics.heightMetric.value="15dp"
        androidPlot.legendWidget.iconSizeMetrics.widthMetric.value="15dp"
        androidPlot.legendWidget.positionMetrics.anchor="left_top"
        androidPlot.legendWidget.positionMetrics.xPositionMetric.value="0"
        androidPlot.legendWidget.textPaint.textSize="@dimen/legend_text_font_size"
        androidPlot.legendWidget.widthMetric.value="100dp"
        androidPlot.rangeLabelWidget.labelPaint.textSize="@dimen/range_label_font_size"
        androidPlot.titleWidget.labelPaint.textSize="@dimen/title_font_size" />
    <!-- androidPlot.graphWidget.gridLinePaint.color="#000000"/> -->

私のソースコード:

 private void makePlotPretty() {
            // use a 2x2 grid with room for 4 items:
            plot.getLegendWidget().setTableModel(new DynamicTableModel(2, 2));

            // add a semi-transparent black background to the legend
            // so it's easier to see overlaid on top of our plot:
            Paint bgPaint = new Paint();
            bgPaint.setColor(Color.BLACK);
            bgPaint.setStyle(Paint.Style.FILL);
            bgPaint.setAlpha(255);

            plot.getLegendWidget().setBackgroundPaint(bgPaint);

/*          plot.getLegendWidget().setPositionMetrics(null);
*/

            plot.getLegendWidget().setWidth(PixelUtils.dpToPix(40), SizeLayoutType.FILL);

            plot.getGraphWidget().setRangeLabelHorizontalOffset(-1);

            plot.getLegendWidget().position(125, XLayoutStyle.ABSOLUTE_FROM_LEFT, 100, YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);

        }
4

1 に答える 1