1

What I tried: I'm using XYPlot for my dynamic graph and it is working well. I tried to customize it inside my initplot() function. I tried using getLegendWidget(), getDomainLabelWidget() and getRangeLabelWidget() functions ( shown below ).

What I'm looking for: But I'm not sure,

  1. how to add X & Y axis label as attached below picture.
  2. how to increase the text size of legend items

Which parameter do I want to use? My attempt is as shown below. I would really appreciate any suggestions on this.

-Thank you-

enter image description here

plot.xml :

   <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <com.androidplot.xy.XYPlot
            android:id="@+id/dynamicPlot"
            title="Data Plot"
            android:layout_width="wrap_content"
            android:layout_height="530dp"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="10dp"
            android:layout_marginRight="10dp"
            android:background="#FFFFFF" />
    </FrameLayout>

initplot() :

private void initPlot() {
        plot = (XYPlot) getView().findViewById(R.id.dynamicPlot);

    //..LPF formatting here 

        plot.getLegendWidget().setTableModel(new DynamicTableModel(1,3));
        Display display = getActivity().getWindowManager().getDefaultDisplay();
        Point size = new Point();
        display.getSize(size);
        int width = size.x;
        int height = size.y;
        plot.getLegendWidget().setSize(new SizeMetrics(width/3, SizeLayoutType.ABSOLUTE, height/4, SizeLayoutType.ABSOLUTE));

    //..domain/range color formatting here 

        plot.getGraphWidget().getDomainLabelPaint().setTextSize(40);
        plot.getDomainLabelWidget().pack();
        outlinePaint = plot.getGraphWidget().getDomainOriginLinePaint();
        outlinePaint.setStrokeWidth(3);
        plot.getGraphWidget().setClippingEnabled(false);
        plot.getGraphWidget().getRangeLabelPaint().setTextSize(30);
        plot.getRangeLabelWidget().pack();
        outlinePaint = plot.getGraphWidget().getRangeOriginLinePaint();
        outlinePaint.setStrokeWidth(3);
        //plot.getLayoutManager().remove(plot.getRangeLabelWidget());
        //plot.getLayoutManager().remove(plot.getDomainLabelWidget());
        plot.getDomainLabelWidget().setVisible(true);
    }
Sachz
  • 391
  • 5
  • 21

0 Answers0